void OBBond::SetLength(double length) { OBAtom *atom1 = GetBeginAtom(); OBAtom *atom2 = GetEndAtom(); //split the length difference in half, and modify the bond twice double firstLength = length + ((GetLength() - length) / 2); SetLength(atom1, firstLength); SetLength(atom2, length); }
double OBBond::GetLength() const { double d2; const OBAtom *begin, *end; begin = GetBeginAtom(); end = GetEndAtom(); d2 = SQUARE(begin->GetX() - end->GetX()); d2 += SQUARE(begin->GetY() - end->GetY()); d2 += SQUARE(begin->GetZ() - end->GetZ()); return(sqrt(d2)); }
double OBBond::GetEquibLength() const { const OBAtom *begin, *end; begin = GetBeginAtom(); end = GetEndAtom(); double length = CorrectedBondRad(begin->GetAtomicNum(), begin->GetHyb()) + CorrectedBondRad(end->GetAtomicNum(), end->GetHyb()); if (IsAromatic()) return length * 0.93; switch (_order) { case 3: return length * 0.87; case 2: return length * 0.91; } return length; }
double OBBond::GetEquibLength() const { double length; const OBAtom *begin, *end; // CorrectedBondRad will always return a # now // if (!CorrectedBondRad(GetBeginAtom(),rad1)) return(0.0); // if (!CorrectedBondRad(GetEndAtom(),rad2)) return(0.0); begin = GetBeginAtom(); end = GetEndAtom(); length = etab.CorrectedBondRad(begin->GetAtomicNum(), begin->GetHyb()) + etab.CorrectedBondRad(end->GetAtomicNum(), end->GetHyb()); if (IsAromatic()) length *= 0.93; else if (GetBO() == 2) length *= 0.91; else if (GetBO() == 3) length *= 0.87; return(length); }