当前位置: 首页>>代码示例>>C++>>正文


C++ OBBond::SetInRing方法代码示例

本文整理汇总了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();
}
开发者ID:Acpharis,项目名称:openbabel,代码行数:26,代码来源:obrms.cpp

示例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);
            }
      }
  }
开发者ID:annulen,项目名称:openbabel,代码行数:40,代码来源:ring.cpp

示例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;
 }
开发者ID:Reinis,项目名称:openbabel,代码行数:37,代码来源:ring.cpp


注:本文中的OBBond::SetInRing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。