本文整理汇总了C++中OBMol::FindRingAtomsAndBonds方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::FindRingAtomsAndBonds方法的具体用法?C++ OBMol::FindRingAtomsAndBonds怎么用?C++ OBMol::FindRingAtomsAndBonds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBMol
的用法示例。
在下文中一共展示了OBMol::FindRingAtomsAndBonds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsClosure
bool OBBond::IsClosure()
{
OBMol *mol = (OBMol*)GetParent();
if (!mol)
return false;
if (!mol->HasClosureBondsPerceived())
mol->FindRingAtomsAndBonds();
return HasFlag(OB_CLOSURE_BOND);
}
示例2: 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;
}
示例3: IsInRing
bool OBBond::IsInRing() const
{
if (((OBBond*)this)->HasFlag(OB_RING_BOND))
return(true);
OBMol *mol = (OBMol*)((OBBond*)this)->GetParent();
if (!mol->HasRingAtomsAndBondsPerceived())
{
mol->FindRingAtomsAndBonds();
if (((OBBond*)this)->HasFlag(OB_RING_BOND))
return(true);
}
return(false);
}