本文整理汇总了C++中OBBond::IsRotor方法的典型用法代码示例。如果您正苦于以下问题:C++ OBBond::IsRotor方法的具体用法?C++ OBBond::IsRotor怎么用?C++ OBBond::IsRotor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBBond
的用法示例。
在下文中一共展示了OBBond::IsRotor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindRotors
bool OBRotorList::FindRotors(OBMol &mol, bool sampleRingBonds)
{
// Find ring atoms & bonds
// This function will set OBBond::IsRotor().
mol.FindRingAtomsAndBonds();
obErrorLog.ThrowError(__FUNCTION__,
"Ran OpenBabel::FindRotors", obAuditMsg);
//
// Score the bonds using the graph theoretical distance (GTD).
// The GTD is the distance from atom i to every other atom j.
// Atoms on the "inside" of the molecule will have a lower GTD
// value than atoms on the "outside"
//
// The scoring will rank "inside" bonds first.
//
vector<int> gtd;
mol.GetGTDVector(gtd);
// compute the scores
vector<OBBond*>::iterator i;
vector<pair<OBBond*,int> > vtmp;
for (OBBond *bond = mol.BeginBond(i);bond;bond = mol.NextBond(i)) {
// check if the bond is "rotatable"
if (bond->IsRotor(sampleRingBonds)) {
// check if the bond is fixed (using deprecated fixed atoms or new fixed bonds)
if ((HasFixedAtoms() || HasFixedBonds()) && IsFixedBond(bond))
continue;
if (bond->IsInRing()) {
//otherwise mark that we have them and add it to the pile
_ringRotors = true;
}
int score = gtd[bond->GetBeginAtomIdx()-1] + gtd[bond->GetEndAtomIdx()-1];
// compute the GTD bond score as sum of atom GTD scores
vtmp.push_back(pair<OBBond*,int> (bond,score));
}
}
// sort the rotatable bonds by GTD score
sort(vtmp.begin(),vtmp.end(),CompareRotor);
// create rotors for the bonds
int count = 0;
vector<pair<OBBond*,int> >::iterator j;
for (j = vtmp.begin(); j != vtmp.end(); ++j, ++count) {
OBRotor *rotor = new OBRotor;
rotor->SetBond((*j).first);
rotor->SetIdx(count);
rotor->SetNumCoords(mol.NumAtoms()*3);
_rotor.push_back(rotor);
}
return true;
}