本文整理汇总了C++中openbabel::OBAtom::MemberOfRingCount方法的典型用法代码示例。如果您正苦于以下问题:C++ OBAtom::MemberOfRingCount方法的具体用法?C++ OBAtom::MemberOfRingCount怎么用?C++ OBAtom::MemberOfRingCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBAtom
的用法示例。
在下文中一共展示了OBAtom::MemberOfRingCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newMol
OpenBabel::OBMol
Schuffenhauer::Rule_1(OpenBabel::OBMol& oldMol)
{
if (oldMol.GetSSSR().size() <= _ringsToBeRetained)
{
return oldMol;
}
OpenBabel::OBMol newMol(oldMol);
std::vector<OpenBabel::OBAtom*>::iterator avi;
OpenBabel::OBBondIterator bi;
OpenBabel::OBAtom* atom;
OpenBabel::OBAtom* nbrAtom[2];
for (atom = newMol.BeginAtom(avi); atom; atom = newMol.NextAtom(avi))
{
if ((atom->MemberOfRingSize() == 3) &&
(atom->IsNitrogen() || atom->IsOxygen()) &&
(atom->MemberOfRingCount() == 1) &&
(atom->GetHvyValence() == 2))
{
nbrAtom[0] = atom->BeginNbrAtom(bi);
nbrAtom[1] = atom->NextNbrAtom(bi);
if (nbrAtom[0] && nbrAtom[1])
{
newMol.DeleteAtom(atom);
newMol.GetBond(nbrAtom[0], nbrAtom[1])->SetBondOrder(2);
}
}
}
return newMol;
}
示例2: allrings
OpenBabel::OBMol
Schuffenhauer::Rule_6(OpenBabel::OBMol& oldMol)
{
std::vector<OpenBabel::OBRing*> allrings(oldMol.GetSSSR());
if (allrings.size() <= _ringsToBeRetained)
{
return oldMol;
}
std::vector<OpenBabel::OBMol> mols;
std::vector<int> rings;
int size;
for (unsigned int i(0); i < allrings.size(); ++i)
{
size = allrings[i]->Size();
if ((size == 3) || (size == 5) || (size == 6))
{
mols.push_back(oldMol);
rings.push_back(i);
}
}
if (mols.empty())
{
return oldMol;
}
// Only focus on ringsystems with more than one ring
std::vector<OpenBabel::OBAtom*>::iterator avi;
OpenBabel::OBAtom* atom;
std::vector<int> fusedRings;
for (unsigned int i(0); i < rings.size(); ++i)
{
for (atom = oldMol.BeginAtom(avi); atom; atom = oldMol.NextAtom(avi))
{
if (allrings[rings[i]]->IsMember(atom) && (atom->MemberOfRingCount() > 1))
{
fusedRings.push_back(rings[i]);
break;
}
}
}
if (fusedRings.empty())
{
return oldMol;
}
std::vector<OpenBabel::OBMol> validMols;
for (unsigned int i(0); i < fusedRings.size(); ++i)
{
mols[i] = RemoveRing(mols[i], allrings, fusedRings[i]);
if (!mols[i].Empty())
{
validMols.push_back(mols[i]);
}
}
if (validMols.size() == 1)
{
return validMols[0];
}
return oldMol;
}