本文整理汇总了C++中openbabel::OBAtom::IsAromatic方法的典型用法代码示例。如果您正苦于以下问题:C++ OBAtom::IsAromatic方法的具体用法?C++ OBAtom::IsAromatic怎么用?C++ OBAtom::IsAromatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBAtom
的用法示例。
在下文中一共展示了OBAtom::IsAromatic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notaromatic
OpenBabel::OBMol
Schuffenhauer::Rule_11(OpenBabel::OBMol& oldMol)
{
// Return if the molecule contains an acyclic linker
std::vector<OpenBabel::OBAtom*>::iterator avi;
OpenBabel::OBAtom* atom;
for (atom = oldMol.BeginAtom(avi); atom; atom = oldMol.NextAtom(avi))
{
if (!atom->IsInRing() && atom->GetValence() >= 2)
{
return oldMol;
}
}
// Make sure we are dealing with a mixed aromatic/nonaromatic system
bool notaromatic(false);
bool aromatic(false);
for (atom = oldMol.BeginAtom(avi); atom; atom = oldMol.NextAtom(avi))
{
if (atom->IsAromatic())
{
aromatic = true;
}
else
{
notaromatic = true;
}
}
if (aromatic && notaromatic)
{
std::vector<OpenBabel::OBRing*> allrings(oldMol.GetSSSR());
if (allrings.size() <= _ringsToBeRetained)
{
return oldMol;
}
std::vector<OpenBabel::OBMol> mols;
std::vector<unsigned int> aromaticRings;
for (unsigned int i(0); i < allrings.size(); ++i)
{
if (allrings[i]->IsAromatic())
{
mols.push_back(oldMol);
aromaticRings.push_back(i);
}
}
std::vector<OpenBabel::OBMol> validMols;
for (unsigned int i(0); i < aromaticRings.size(); ++i)
{
mols[i] = RemoveRing(mols[i], allrings, aromaticRings[i]);
if (!mols[i].Empty())
{
validMols.push_back(mols[i]);
}
}
if (validMols.size() == 1)
{
return validMols[0];
}
}
return oldMol;
}
示例2: if
bool
_hAccDelocalized(OpenBabel::OBAtom* a)
{
if (a->GetAtomicNum() != 7)
{
return false;
}
if (a->IsAromatic() && a->GetImplicitValence() == 3)
{
return true;
}
std::vector<OpenBabel::OBBond*>::iterator bi1;
for (OpenBabel::OBBond* b1 = a->BeginBond(bi1); b1; b1 = a->NextBond(bi1))
{
OpenBabel::OBAtom* aa = b1->GetNbrAtom(a);
if (aa->IsAromatic() && a->GetImplicitValence() == 3)
{
return true;
}
if (aa->GetAtomicNum() == 6)
{
std::vector<OpenBabel::OBBond*>::iterator bi2;
for (OpenBabel::OBBond* b2 = aa->BeginBond(bi2); b2; b2 = aa->NextBond(bi2))
{
OpenBabel::OBAtom* aaa = b2->GetNbrAtom(aa);
if (aaa == a)
{
continue;
}
if (b2->GetBO() == 2)
{
if (aaa->GetAtomicNum() == 8) return true;
if (aaa->GetAtomicNum() == 7) return true;
if (aaa->GetAtomicNum() == 16) return true;
}
}
}
else if (aa->GetAtomicNum() == 16)
{
std::vector<OpenBabel::OBBond*>::iterator bi2;
for (OpenBabel::OBBond* b2 = aa->BeginBond(bi2); b2; b2 = aa->NextBond(bi2))
{
OpenBabel::OBAtom* aaa = b2->GetNbrAtom(aa);
if (aaa == a)
{
continue;
}
if ((b2->GetBO() == 2) && (aaa->GetAtomicNum() == 8))
{
return true;
}
}
}
}
return false;
}
示例3: broken
OpenBabel::OBMol
Schuffenhauer::Rule_7(OpenBabel::OBMol& oldMol)
{
std::vector<OpenBabel::OBRing*> allrings(oldMol.GetSSSR());
if (allrings.size() <= _ringsToBeRetained)
{
return oldMol;
}
// Are all atoms and bonds aromatic?
std::vector<OpenBabel::OBAtom*>::iterator avi;
OpenBabel::OBAtom* atom;
for (atom = oldMol.BeginAtom(avi); atom; atom = oldMol.NextAtom(avi))
{
if (!atom->IsAromatic())
{
return oldMol;
}
}
std::vector<OpenBabel::OBBond*>::iterator bvi;
OpenBabel::OBBond* bond;
for (bond = oldMol.BeginBond(bvi); bond; bond = oldMol.NextBond(bvi))
{
if (!bond->IsAromatic())
{
return oldMol;
}
}
std::vector<OpenBabel::OBMol> mols;
for (unsigned int i(0); i < allrings.size(); ++i)
{
mols.push_back(oldMol);
}
std::vector<OpenBabel::OBMol> validMols;
for (unsigned int i(0); i < mols.size(); ++i)
{
mols[i] = RemoveRing(mols[i], allrings, i);
if (!mols[i].Empty())
{
// Has aromaticity been broken?
bool broken(false);
for (atom = mols[i].BeginAtom(avi); atom; atom = mols[i].NextAtom(avi))
{
if (atom->IsInRing() && !atom->IsAromatic())
{
broken = true;
break;
}
}
if (!broken)
{
validMols.push_back(mols[i]);
}
}
}
if (validMols.size() == 1)
{
return validMols[0];
}
return oldMol;
}