本文整理汇总了C++中OBBond::SetInRing方法的典型用法代码示例。如果您正苦于以下问题:C++ OBBond::SetInRing方法的具体用法?C++ OBBond::SetInRing怎么用?C++ OBBond::SetInRing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBBond
的用法示例。
在下文中一共展示了OBBond::SetInRing方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processMol
//preprocess molecule into a standardized state for heavy atom rmsd computation
static void processMol(OBMol& mol)
{
//isomorphismmapper wants isomorphic atoms to have the same aromatic and ring state,
//but these proporties aren't reliable enough to be trusted in evaluating molecules
//should be considered the same based solely on connectivity
mol.DeleteHydrogens(); //heavy atom rmsd
for(OBAtomIterator aitr = mol.BeginAtoms(); aitr != mol.EndAtoms(); aitr++)
{
OBAtom *a = *aitr;
a->UnsetAromatic();
a->SetInRing();
}
for(OBBondIterator bitr = mol.BeginBonds(); bitr != mol.EndBonds(); bitr++)
{
OBBond *b = *bitr;
b->UnsetAromatic();
b->SetBondOrder(1);
b->SetInRing();
}
//avoid recomputations
mol.SetHybridizationPerceived();
mol.SetRingAtomsAndBondsPerceived();
mol.SetAromaticPerceived();
}
示例2: FindRings
static void FindRings(OBMol &mol,vector<int> &path,OBBitVec &avisit,
OBBitVec &bvisit, int natom,int depth )
{
OBAtom *atom;
OBBond *bond;
vector<OBBond*>::iterator k;
// don't return if all atoms are visited
// (For example, some atoms are in multiple rings!) -GRH
if (avisit[natom])
{
int j = depth-1;
bond=mol.GetBond(path[j--]);
bond->SetInRing();
while( j >= 0 )
{
bond=mol.GetBond(path[j--]);
bond->SetInRing();
(bond->GetBeginAtom())->SetInRing();
(bond->GetEndAtom())->SetInRing();
if(bond->GetBeginAtomIdx()==static_cast<unsigned int>(natom) || bond->
GetEndAtomIdx()==static_cast<unsigned int>(natom))
break;
}
}
else
{
avisit.SetBitOn(natom);
atom = mol.GetAtom(natom);
for(bond = atom->BeginBond(k);bond;bond=atom->NextBond(k))
if( !bvisit[bond->GetIdx()])
{
path[depth] = bond->GetIdx();
bvisit.SetBitOn(bond->GetIdx());
FindRings(mol,path,avisit,bvisit,bond->GetNbrAtomIdx(atom),
depth+1);
}
}
}
示例3: FindRings
/* A recursive O(N) traversal of the molecule */
static int FindRings(OBAtom *atom, int *avisit, unsigned char *bvisit,
unsigned int &frj, int depth)
{
OBBond *bond;
int result = -1;
vector<OBBond*>::iterator k;
for(bond = atom->BeginBond(k);bond;bond=atom->NextBond(k)) {
unsigned int bidx = bond->GetIdx();
if (bvisit[bidx] == 0) {
bvisit[bidx] = 1;
OBAtom *nbor = bond->GetNbrAtom(atom);
unsigned int nidx = nbor->GetIdx();
int nvisit = avisit[nidx];
if (nvisit == 0) {
avisit[nidx] = depth+1;
nvisit = FindRings(nbor,avisit,bvisit,frj,depth+1);
if (nvisit > 0) {
if (nvisit <= depth) {
bond->SetInRing();
if (result < 0 || nvisit < result)
result = nvisit;
}
}
} else {
if (result < 0 || nvisit < result)
result = nvisit;
bond->SetClosure();
bond->SetInRing();
frj++;
}
}
}
if (result > 0 && result <= depth)
atom->SetInRing();
return result;
}