本文整理汇总了C++中openbabel::OBMol::DeleteAtom方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::DeleteAtom方法的具体用法?C++ OBMol::DeleteAtom怎么用?C++ OBMol::DeleteAtom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBMol
的用法示例。
在下文中一共展示了OBMol::DeleteAtom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rings
void
FilterCores::Calculate(OpenBabel::OBMol* mol)
{
// Any rings?
OpenBabel::OBAtom* atom;
std::vector<OpenBabel::OBAtom*>::iterator i;
bool rings(false);
for (atom = mol->BeginAtom(i); atom; atom = mol->NextAtom(i))
{
if (atom->IsInRing())
{
rings = true;
break;
}
}
if (rings)
{
// Make workcopy of original mol
OpenBabel::OBMol m = *mol; m.DeleteHydrogens();
// Iteratively remove all endstanding atoms until none are left
OpenBabel::OBAtom* atom;
std::vector<OpenBabel::OBAtom*>::iterator i;
bool endstanding(true);
while (endstanding && m.NumAtoms())
{
endstanding = false;
for (atom = m.BeginAtom(i); atom; atom = m.NextAtom(i))
{
if (atom->GetValence() < 2)
{
if (m.DeleteAtom(atom))
{
endstanding = true;
break;
}
}
}
}
if (m.NumAtoms()) _result = 1;
else _result = 0;
}
else
{
_result = 0;
}
if ((_minLimit && (_result < _min)) || (_maxLimit && (_result > _max)))
{
_passed = false;
}
else
{
_passed = true;
}
}
示例2: rings
void
FilterBridgeFraction::Calculate(OpenBabel::OBMol* mol)
{
// Are there rings?
OpenBabel::OBAtom* atom;
std::vector<OpenBabel::OBAtom*>::iterator i;
bool rings(false);
for (atom = mol->BeginAtom(i); atom; atom = mol->NextAtom(i))
{
if (atom->IsInRing())
{
rings = true;
break;
}
}
if (rings)
{
// Make workcopy of original mol
OpenBabel::OBMol m = *mol; m.DeleteHydrogens();
unsigned int natoms(m.NumAtoms());
if (!natoms)
{
_result = 0.0;
_passed = false;
return;
}
// Iteratively remove all endstanding atoms until none are left
OpenBabel::OBAtom* atom;
std::vector<OpenBabel::OBAtom*>::iterator i;
bool endstanding(true);
while (endstanding && m.NumAtoms())
{
endstanding = false;
for (atom = m.BeginAtom(i); atom; atom = m.NextAtom(i))
{
if (atom->GetValence() < 2)
{
if (m.DeleteAtom(atom))
{
endstanding = true;
break;
}
}
}
}
// Now remove all ring atoms
rings = true;
while (rings && m.NumAtoms())
{
rings = false;
for (atom = m.BeginAtom(i); atom; atom = m.NextAtom(i))
{
if (atom->IsInRing())
{
if (m.DeleteAtom(atom))
{
rings = true;
break;
}
}
}
}
_result = (double) m.NumAtoms() / (double) natoms;
}
else
{
_result = 0.0;
}
if ((_minLimit && (_result < _min)) || (_maxLimit && (_result > _max)))
{
_passed = false;
}
else
{
_passed = true;
}
}
示例3: rings
void
FilterAtomsInSmallestBridge::Calculate(OpenBabel::OBMol* mol)
{
// Are there rings?
OpenBabel::OBAtom* atom;
std::vector<OpenBabel::OBAtom*>::iterator i;
bool rings(false);
for (atom = mol->BeginAtom(i); atom; atom = mol->NextAtom(i))
{
if (atom->IsInRing())
{
rings = true;
break;
}
}
if (rings)
{
// Make workcopy of original mol
OpenBabel::OBMol m = *mol; m.DeleteHydrogens();
// Iteratively remove all endstanding atoms until none are left
OpenBabel::OBAtom* atom;
std::vector<OpenBabel::OBAtom*>::iterator i;
bool endstanding(true);
while (endstanding && m.NumAtoms())
{
endstanding = false;
for (atom = m.BeginAtom(i); atom; atom = m.NextAtom(i))
{
if (atom->GetValence() < 2)
{
if (m.DeleteAtom(atom))
{
endstanding = true;
break;
}
}
}
}
// Now remove all ring atoms
rings = true;
while (rings && m.NumAtoms())
{
rings = false;
for (atom = m.BeginAtom(i); atom; atom = m.NextAtom(i))
{
if (atom->IsInRing())
{
if (m.DeleteAtom(atom))
{
rings = true;
break;
}
}
}
}
// Separate into fragments
if (m.NumAtoms())
{
std::vector<std::vector<int> > bridges;
m.ContigFragList(bridges);
_result = bridges[0].size();
for (unsigned int i(1); i < bridges.size(); ++i)
{
if (bridges[i].size() < _result) _result = bridges[i].size();
}
}
if ((_minLimit && (_result < _min)) || (_maxLimit && (_result > _max)))
{
_passed = false;
}
else
{
_passed = true;
}
}
else
{
_result = 0;
_passed = true;
}
}
示例4: rings
void
FilterRingsystems::Calculate(OpenBabel::OBMol* mol)
{
// Are there rings?
bool rings(false);
OpenBabel::OBAtom* atom;
std::vector<OpenBabel::OBAtom*>::iterator i;
for (atom = mol->BeginAtom(i); atom; atom = mol->NextAtom(i))
{
if (atom->IsInRing())
{
rings = true;
break;
}
}
if (rings)
{
// Make workcopy of original mol
OpenBabel::OBMol m = *mol; m.DeleteHydrogens();
// Remove all atoms that are not part of ring
std::vector<OpenBabel::OBAtom*> nonRingAtoms;
nonRingAtoms.clear();
for (atom = m.BeginAtom(i); atom; atom = m.NextAtom(i))
{
if (!atom->IsInRing()) nonRingAtoms.push_back(atom);
}
for (unsigned int i(0); i < nonRingAtoms.size(); ++i)
{
m.DeleteAtom(nonRingAtoms[i]);
}
// Remove all bonds that are not part of a ring
std::vector<OpenBabel::OBBond*> nonRingBonds;
nonRingBonds.clear();
OpenBabel::OBBond* bond;
std::vector<OpenBabel::OBBond*>::iterator j;
for (bond = m.BeginBond(j); bond; bond = m.NextBond(j))
{
if (!bond->IsInRing()) nonRingBonds.push_back(bond);
}
for (unsigned int i(0); i < nonRingBonds.size(); ++i)
{
m.DeleteBond(nonRingBonds[i]);
}
// Count ringsystems
std::vector<std::vector< int > > ringsystems;
m.ContigFragList(ringsystems);
_result = ringsystems.size();
}
else
{
_result = 0;
}
if ((_minLimit && (_result < _min)) || (_maxLimit && (_result > _max)))
{
_passed = false;
}
else
{
_passed = true;
}
}