本文整理汇总了C++中OBBond::IsClosure方法的典型用法代码示例。如果您正苦于以下问题:C++ OBBond::IsClosure方法的具体用法?C++ OBBond::IsClosure怎么用?C++ OBBond::IsClosure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBBond
的用法示例。
在下文中一共展示了OBBond::IsClosure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DetermineFRJ
static int DetermineFRJ(OBMol &mol)
{
if (!mol.HasClosureBondsPerceived())
return (int)FindRingAtomsAndBonds2(mol);
int frj = 0;
OBBond *bond;
vector<OBBond*>::iterator j;
for (bond = mol.BeginBond(j);bond;bond = mol.NextBond(j))
if (bond->IsClosure()) // bond->HasFlag(OB_CLOSURE_BOND)?
frj++;
return frj;
}
示例2: FindLSSR
void OBMol::FindLSSR()
{
if (HasLSSRPerceived())
return;
SetLSSRPerceived();
obErrorLog.ThrowError(__FUNCTION__,
"Ran OpenBabel::FindLSSR", obAuditMsg);
// Delete any old data before we start finding new rings
// The following procedure is slow
// So if client code is multi-threaded, we don't want to make them wait
if (HasData("LSSR")) {
DeleteData("LSSR");
}
OBRing *ring;
vector<OBRing*>::iterator j;
//get frerejaque taking int account multiple possible spanning graphs
int frj = DetermineFRJ(*this);
if (frj)
{
vector<OBRing*> vr;
FindRingAtomsAndBonds();
OBBond *bond;
vector<OBBond*> cbonds;
vector<OBBond*>::iterator k;
//restrict search for rings around closure bonds
for (bond = BeginBond(k);bond;bond = NextBond(k))
if (bond->IsClosure())
cbonds.push_back(bond);
if (!cbonds.empty())
{
OBRingSearch rs;
//search for all rings about closures
vector<OBBond*>::iterator i;
for (i = cbonds.begin();i != cbonds.end();++i)
rs.AddRingFromClosure(*this,(OBBond*)*i);
rs.SortRings();
rs.RemoveRedundant(-1); // -1 means LSSR
//store the LSSR set
for (j = rs.BeginRings();j != rs.EndRings();++j)
{
ring = new OBRing ((*j)->_path,NumAtoms()+1);
ring->SetParent(this);
vr.push_back(ring);
}
//rs.WriteRings();
}
OBRingData *rd = new OBRingData();
rd->SetOrigin(perceived); // to separate from user or file input
rd->SetAttribute("LSSR");
rd->SetData(vr);
SetData(rd);
}
}
示例3: SelectRootAtoms
/**
* \brief Select the root atoms for traversing atoms in rings.
*
* Picking only the begin atom of a closure bond can cause
* difficulties when the selected atom is an inner atom
* with three neighbour ring atoms. Why ? Because this atom
* can get trapped by the other atoms when determining aromaticity,
* because a simple visited flag is used in the
* OBAromaticTyper::TraverseCycle() method.
*
* Ported from JOELib, copyright Joerg Wegner, 2003 under the GPL version 2
* Improved by Fabian (fab5) in 2009 -- PR#2889708
*
* @param mol the molecule
* @param avoidInnerRingAtoms inner closure ring atoms with more than 2 neighbours will be avoided
*
*/
void OBAromaticTyper::SelectRootAtoms(OBMol &mol, bool avoidInnerRingAtoms)
{
OBBond *bond;
OBAtom *atom, *nbr, *nbr2;
OBRing *ring;
// vector<OBAtom*>::iterator i;
vector<OBBond*>::iterator j, l, nbr2Iter;
vector<OBRing*> sssRings = mol.GetSSSR();
vector<OBRing*>::iterator k;
int rootAtom;
int ringNbrs;
int heavyNbrs;
int newRoot = -1;
vector<int> tmpRootAtoms;
vector<int> tmp;
vector<OBBond*> cbonds;
vector< vector<OBRing*> > ringAtoms; // store ring pointers on an atom basis
//generate list of closure bonds
for (bond = mol.BeginBond(j);bond;bond = mol.NextBond(j))
{
if( bond->IsClosure() )
{
cbonds.push_back(bond);
if(avoidInnerRingAtoms)
{
tmpRootAtoms.push_back(bond->GetBeginAtomIdx());
}
}
}
if(avoidInnerRingAtoms)
{
//for every atom fill vector with ring pointer it's associated with
ringAtoms.resize(mol.NumAtoms()+1);
for (k = sssRings.begin();k != sssRings.end();++k)
{
tmp = (*k)->_path;
for (unsigned int j (0),j_end(tmp.size()); j < j_end; ++j)
{
ringAtoms[tmp[j]].push_back(*k);
}
}
}
//loop over closure bonds
for(OBBondIterator bd(cbonds.begin()),bd_end(cbonds.end());bd!=bd_end;++bd)
{
bond = *bd;
// BASIC APPROACH
// pick beginning atom at closure bond
// this is really ready, isn't it ! ;-)
rootAtom = bond->GetBeginAtomIdx();
_root[rootAtom] = true;
// EXTENDED APPROACH
if (avoidInnerRingAtoms)
{
// count the number of neighbor ring atoms
atom = mol.GetAtom(rootAtom);
ringNbrs = heavyNbrs = 0;
for (nbr = atom->BeginNbrAtom(l);nbr;nbr = atom->NextNbrAtom(l))
{
// we can get this from atom->GetHvyValence()
// but we need to find neighbors in rings too
// so let's save some time
if (!nbr->IsHydrogen())
{
heavyNbrs++;
if (nbr->IsInRing())
ringNbrs++;
}
// if this atom has more than 2 neighbor ring atoms
// we could get trapped later when traversing cycles
// which can cause aromaticity false detection
newRoot = -1;
//.........这里部分代码省略.........