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


C++ BaseMolecule::getAtomAromaticity方法代码示例

本文整理汇总了C++中BaseMolecule::getAtomAromaticity方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseMolecule::getAtomAromaticity方法的具体用法?C++ BaseMolecule::getAtomAromaticity怎么用?C++ BaseMolecule::getAtomAromaticity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseMolecule的用法示例。


在下文中一共展示了BaseMolecule::getAtomAromaticity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: atomInAromaticRing

bool TautomerRule::atomInAromaticRing (BaseMolecule &mol, int atom_idx)
{
    if (atom_idx < 0)
        return true;

    return mol.getAtomAromaticity(atom_idx) == ATOM_AROMATIC;
}
开发者ID:mojca,项目名称:indigo,代码行数:7,代码来源:molecule_tautomer_match.cpp

示例2: getHCount

int MoleculeSavers::getHCount (BaseMolecule &mol, int index, int atom_number, int atom_charge)
{
   int hydrogens_count = -1;
   if (!mol.isRSite(index) && !mol.isPseudoAtom(index) && !mol.isTemplateAtom(index))
   {
      if (!mol.isQueryMolecule())
      {
         if (mol.getAtomAromaticity(index) == ATOM_AROMATIC &&
            ((atom_number != ELEM_C && atom_number != ELEM_O) || atom_charge != 0))
            hydrogens_count = mol.asMolecule().getImplicitH_NoThrow(index, -1);
      }
      else
      {
         QueryMolecule::Atom &atom = mol.asQueryMolecule().getAtom(index);

         if (!atom.sureValue(QueryMolecule::ATOM_TOTAL_H, hydrogens_count))
         {
            // Try to check if there are only one constraint
            QueryMolecule::Atom *constraint = atom.sureConstraint(QueryMolecule::ATOM_TOTAL_H);
            if (constraint != NULL)
               hydrogens_count = constraint->value_min;
            else
               hydrogens_count = -1;
         }
      }
   }
   return hydrogens_count;
}
开发者ID:Lucas-Gluchowski,项目名称:Indigo,代码行数:28,代码来源:molecule_savers.cpp

示例3: matchAtoms

bool MoleculeExactMatcher::matchAtoms (BaseMolecule& query, BaseMolecule& target, int sub_idx, int super_idx, int flags)
{
   if (query.isRSite(sub_idx) && target.isRSite(super_idx))
      return query.getRSiteBits(sub_idx) == target.getRSiteBits(super_idx);

   if (query.isRSite(sub_idx) || target.isRSite(super_idx))
      return false;

   if (query.isPseudoAtom(sub_idx) && target.isPseudoAtom(super_idx))
   {
      if (strcmp(query.getPseudoAtom(sub_idx), target.getPseudoAtom(super_idx)) != 0)
         return false;
   }
   else if (query.isTemplateAtom(sub_idx) && target.isTemplateAtom(super_idx))
   {
      if (strcmp(query.getTemplateAtom(sub_idx), target.getTemplateAtom(super_idx)) != 0)
         return false;
   }
   else if (!query.isPseudoAtom(sub_idx) && !target.isPseudoAtom(super_idx) &&
            !query.isTemplateAtom(sub_idx) && !target.isTemplateAtom(super_idx))
   {
      if (query.getAtomNumber(sub_idx) != target.getAtomNumber(super_idx))
         return false;
   }
   else
      return false;

   if (flags & CONDITION_ISOTOPE)
      if (query.getAtomIsotope(sub_idx) != target.getAtomIsotope(super_idx))
         return false;

   if (flags & CONDITION_ELECTRONS)
   {
      int qcharge = query.getAtomCharge(sub_idx);
      int tcharge = target.getAtomCharge(super_idx);

      if (qcharge == CHARGE_UNKNOWN)
         qcharge = 0;
      if (tcharge == CHARGE_UNKNOWN)
         tcharge = 0;

      if (qcharge != tcharge)
         return false;

      if (!query.isPseudoAtom(sub_idx) && !query.isTemplateAtom(sub_idx))
      {
         if (!query.isQueryMolecule() && !target.isQueryMolecule())
         {
            if (query.getAtomValence(sub_idx) != target.getAtomValence(super_idx))
               return false;
         }      
         
         int qrad = query.getAtomRadical(sub_idx);
         int trad = target.getAtomRadical(super_idx);

         if (qrad == -1)
            qrad = 0;
         if (trad == -1)
            trad = 0;

         if (qrad != trad)
            return false;

         if (query.isQueryMolecule())
         {
            int qarom = query.getAtomAromaticity(sub_idx);
            int tarom = target.getAtomAromaticity(super_idx);

            if (qarom != -1 && tarom != -1)
               if (qarom != tarom)
                  return false;
         }
      }
   }

   if (flags & CONDITION_STEREO)
   {
      int qtype = query.stereocenters.getType(sub_idx);

      if (qtype != target.stereocenters.getType(super_idx))
         return false;
   }
   return true;
}
开发者ID:Lucas-Gluchowski,项目名称:Indigo,代码行数:84,代码来源:molecule_exact_matcher.cpp

示例4: Error


//.........这里部分代码省略.........
         return query->valueWithinRange(target.getAtomIsotope(super_idx));
      case QueryMolecule::ATOM_CHARGE:
      {
         if (flags & MATCH_ATOM_CHARGE)
            return query->valueWithinRange(target.getAtomCharge(super_idx));
         return (flags & MATCH_DISABLED_AS_TRUE) != 0;
      }
      case QueryMolecule::ATOM_RADICAL:
      {
         if (target.isPseudoAtom(super_idx) || target.isRSite(super_idx))
            return false;
         return query->valueWithinRange(target.getAtomRadical(super_idx));
      }
      case QueryMolecule::ATOM_VALENCE:
      {
         if (flags & MATCH_ATOM_VALENCE)
         {
            if (target.isPseudoAtom(super_idx) || target.isRSite(super_idx))
               return false;
            return query->valueWithinRange(target.getAtomValence(super_idx));
         }
         return (flags & MATCH_DISABLED_AS_TRUE) != 0;
      }
      case QueryMolecule::ATOM_CONNECTIVITY:
      {
         int conn = target.getVertex(super_idx).degree();
         if (!target.isPseudoAtom(super_idx) && !target.isRSite(super_idx))
            conn += target.asMolecule().getImplicitH(super_idx);
         return query->valueWithinRange(conn);
      }
      case QueryMolecule::ATOM_TOTAL_BOND_ORDER:
      {
         // TODO: target.isPseudoAtom(super_idx) || target.isRSite(super_idx)
         return query->valueWithinRange(target.asMolecule().getAtomConnectivity(super_idx));
      }
      case QueryMolecule::ATOM_TOTAL_H:
      {
         if (target.isPseudoAtom(super_idx) || target.isRSite(super_idx))
            return false;
         return query->valueWithinRange(target.getAtomTotalH(super_idx));
      }
      case QueryMolecule::ATOM_SUBSTITUENTS:
         return query->valueWithinRange(target.getAtomSubstCount(super_idx));
      case QueryMolecule::ATOM_SSSR_RINGS:
         return query->valueWithinRange(target.vertexCountSSSR(super_idx));
      case QueryMolecule::ATOM_SMALLEST_RING_SIZE:
         return query->valueWithinRange(target.vertexSmallestRingSize(super_idx));
      case QueryMolecule::ATOM_RING_BONDS:
      case QueryMolecule::ATOM_RING_BONDS_AS_DRAWN:
         return query->valueWithinRange(target.getAtomRingBondsCount(super_idx));
      case QueryMolecule::ATOM_UNSATURATION:
         return !target.isSaturatedAtom(super_idx);
      case QueryMolecule::ATOM_FRAGMENT:
      {
         if (fmcache == 0)
            throw Error("unexpected 'fragment' constraint");

         QueryMolecule *fragment = query->fragment.get();
         const char *smarts = fragment->fragment_smarts.ptr();

         if (fragment->vertexCount() == 0)
            throw Error("empty fragment");

         if (smarts != 0 && strlen(smarts) > 0)
         {
            fmcache->expand(super_idx + 1);
            int *value = fmcache->at(super_idx).at2(smarts);

            if (value != 0)
               return *value != 0;
         }

         
         MoleculeSubstructureMatcher matcher(target.asMolecule());

         matcher.not_ignore_first_atom = true;
         matcher.setQuery(*fragment);
         matcher.fmcache = fmcache;

         bool result = matcher.fix(fragment->vertexBegin(), super_idx);

         if (result)
            result = matcher.find();

         if (smarts != 0 && strlen(smarts) > 0)
         {
            fmcache->expand(super_idx + 1);
            fmcache->at(super_idx).insert(smarts, result ? 1 : 0);
         }

         return result;
      }
      case QueryMolecule::ATOM_AROMATICITY:
         return query->valueWithinRange(target.getAtomAromaticity(super_idx));
      case QueryMolecule::HIGHLIGHTING:
         return query->valueWithinRange((int)target.isAtomHighlighted(super_idx));
      default:
         throw Error("bad query atom type: %d", query->type);
   }
}
开发者ID:mojca,项目名称:indigo,代码行数:101,代码来源:molecule_substructure_matcher.cpp


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