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


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

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


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

示例1: needsLayoutSub

bool RenderParamInterface::needsLayoutSub (BaseMolecule& mol)
{
   QS_DEF(RedBlackSet<int>, atomsToIgnore);
   atomsToIgnore.clear();
   for (int i = mol.multiple_groups.begin(); i < mol.multiple_groups.end(); i = mol.multiple_groups.next(i)) {
      const Array<int>& atoms = mol.multiple_groups[i].atoms;
      const Array<int>& patoms = mol.multiple_groups[i].parent_atoms;
      for (int j = 0; j < atoms.size(); ++j)
         atomsToIgnore.find_or_insert(atoms[j]);
      for (int j = 0; j < patoms.size(); ++j)
         if (atomsToIgnore.find(patoms[j]))
            atomsToIgnore.remove(patoms[j]);
   }
   for (int i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i)) {
      if (atomsToIgnore.find(i))
         continue;
      for (int j = mol.vertexNext(i); j < mol.vertexEnd(); j = mol.vertexNext(j)) {
         if (atomsToIgnore.find(j))
            continue;
         const Vec3f& v = mol.getAtomXyz(i);
         const Vec3f& w = mol.getAtomXyz(j);
         Vec3f d;
         d.diff(v, w);
         d.z = 0;
         if (d.length() < 1e-3)
            return true;
      }
   }
   return false;
}
开发者ID:diniska,项目名称:indigo,代码行数:30,代码来源:render_params.cpp

示例2: getTotalMoleculeClosestDist

float Metalayout::getTotalMoleculeClosestDist (BaseMolecule& mol)
{
   QS_DEF(Array<float>, dst);
   float sum = 0;

   dst.clear_resize(mol.vertexEnd());
   for (int i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
      dst[i] = -1;

   for (int i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
      for (int j = mol.vertexNext(i); j < mol.vertexEnd(); j = mol.vertexNext(j))
      {
         Vec2f u, v;
         Vec2f::projectZ(u, mol.getAtomXyz(i));
         Vec2f::projectZ(v, mol.getAtomXyz(j));
         float d = Vec2f::dist(u, v);
         if (dst[i] < 0 || dst[i] > d)
            dst[i] = d;
         if (dst[j] < 0 || dst[j] > d)
            dst[j] = d;
      }           
      for (int i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
         sum += dst[i];
      return sum;
}
开发者ID:cambDI,项目名称:camb,代码行数:25,代码来源:metalayout.cpp

示例3: markIgnoredHydrogens

void MoleculeSubstructureMatcher::markIgnoredHydrogens (BaseMolecule &mol, int *arr, int value_keep, int value_ignore)
{
   int i;

   for (i = mol.vertexBegin(); i != mol.vertexEnd(); i = mol.vertexNext(i))
      arr[i] = value_keep;

   for (i = mol.vertexBegin(); i != mol.vertexEnd(); i = mol.vertexNext(i))
   {
      if (mol.getAtomNumber(i) != ELEM_H)
         continue;

      if (!mol.possibleAtomIsotope(i, 0))
         continue;

      if (mol.isQueryMolecule())
      {
         // Check if atom has fragment constraint.
         // For example [$([#1][N])] should be ignored
         if (mol.asQueryMolecule().getAtom(i).hasConstraint(QueryMolecule::ATOM_FRAGMENT))
            continue;
      }

      const Vertex &vertex = mol.getVertex(i);

      if (vertex.degree() == 1)
      {
         int nei_idx = vertex.neiVertex(vertex.neiBegin());

         if (mol.getAtomNumber(nei_idx) == ELEM_H && mol.possibleAtomIsotope(nei_idx, 0))
            continue; // do not ignore rare H-H fragment

         // Check if hydrogen forms a cis-trans bond or stereocenter
         int nei_vertex_idx = vertex.neiVertex(vertex.neiBegin());
         if (mol.stereocenters.exists(nei_vertex_idx))
            continue;

         // For example for this query hydrogens should be unfolded: [H]\\C=C/C
         const Vertex &nei_vertex = mol.getVertex(nei_vertex_idx);
         bool not_ignore = false;
         for (int nei = nei_vertex.neiBegin(); nei != nei_vertex.neiEnd(); nei = nei_vertex.neiNext(nei))
         {
            int edge = nei_vertex.neiEdge(nei);
            if (mol.cis_trans.getParity(edge) != 0)
            {
               not_ignore = true;
               break;
            }
         }
         if (not_ignore)
            continue;

         arr[i] = value_ignore;
      }
   }
}
开发者ID:mojca,项目名称:indigo,代码行数:56,代码来源:molecule_substructure_matcher.cpp

示例4: _prepare_ee

bool ReactionExactMatcher::_prepare_ee (EmbeddingEnumerator &ee,
        BaseMolecule &submol, Molecule &supermol, void *context)
{
   int i;

   ReactionExactMatcher &self = *(ReactionExactMatcher *)context;
   
   for (i = submol.vertexBegin(); i != submol.vertexEnd(); i = submol.vertexNext(i))
   {
      const Vertex &vertex = submol.getVertex(i);

      if (submol.getAtomNumber(i) == ELEM_H && vertex.degree() == 1 &&
          submol.getAtomNumber(vertex.neiVertex(vertex.neiBegin())) != ELEM_H)
         if (submol.getAtomIsotope(i) == 0 || !(self.flags & MoleculeExactMatcher::CONDITION_ISOTOPE))
            ee.ignoreSubgraphVertex(i);
   }

   for (i = supermol.vertexBegin(); i != supermol.vertexEnd(); i = supermol.vertexNext(i))
   {
      const Vertex &vertex = supermol.getVertex(i);

      if (supermol.getAtomNumber(i) == ELEM_H && vertex.degree() == 1 &&
          supermol.getAtomNumber(vertex.neiVertex(vertex.neiBegin())) != ELEM_H)
         if (supermol.getAtomIsotope(i) == 0 || !(self.flags & MoleculeExactMatcher::CONDITION_ISOTOPE))
            ee.ignoreSupergraphVertex(i);
   }

   if (ee.countUnmappedSubgraphVertices() != ee.countUnmappedSupergraphVertices())
      return false;
   if (ee.countUnmappedSubgraphEdges() != ee.countUnmappedSupergraphEdges())
      return false;

   return true;
}
开发者ID:Lucas-Gluchowski,项目名称:Indigo,代码行数:34,代码来源:reaction_exact_matcher.cpp

示例5: collect

void GrossFormula::collect (BaseMolecule &mol, Array<int> &gross)
{
   int i;

   gross.clear_resize(ELEM_MAX);
   gross.zerofill();

   for (i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
   {
      if (mol.isPseudoAtom(i) || mol.isRSite(i))
         continue;
      int number = mol.getAtomNumber(i);

      if (number > 0)
         gross[number]++;

      if (!mol.isQueryMolecule())
      {
         int implicit_h = mol.asMolecule().getImplicitH(i);

         if (implicit_h >= 0)
            gross[ELEM_H] += implicit_h;
      }
   }
}
开发者ID:Rillke,项目名称:indigo,代码行数:25,代码来源:gross_formula.cpp

示例6: _makeFingerprint

void MoleculeFingerprintBuilder::_makeFingerprint (BaseMolecule &mol)
{
   QS_DEF(Filter, vfilter);
   int i;

   vfilter.initAll(mol.vertexEnd());

   // remove (possible) hydrogens
   for (i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
      if (mol.possibleAtomNumber(i, ELEM_H))
         vfilter.hide(i);

   Obj<TautomerSuperStructure> tau_super_structure;
   BaseMolecule *mol_for_enumeration = &mol;
   
   if (!query && _parameters.tau_qwords > 0 && !skip_tau)
   {
      tau_super_structure.create(mol.asMolecule());

      _tau_super_structure = tau_super_structure.get();
      mol_for_enumeration = tau_super_structure.get();
   }
   else
      _tau_super_structure = 0;
   
   if (!skip_ord || !skip_any_atoms || !skip_any_atoms_bonds ||
       !skip_any_bonds || !skip_tau || !skip_sim)
   {
      _initHashCalculations(*mol_for_enumeration);

      CycleEnumerator ce(*mol_for_enumeration);
      GraphSubtreeEnumerator se(*mol_for_enumeration);

      ce.vfilter = &vfilter;
      se.vfilter = &vfilter;

      bool sim_only = skip_ord && skip_tau && skip_any_atoms &&
                      skip_any_atoms_bonds && skip_any_bonds;

      _is_cycle = true;
      ce.context = this;
      ce.max_length = sim_only ? 6 : 8;
      ce.cb_handle_cycle = _handleCycle;
      ce.process();
   
      _is_cycle = false;
      se.context = this;
      se.min_vertices = 1;
      se.max_vertices = sim_only ? 5 : 7;
      se.handle_maximal = false;
      se.maximal_critera_value_callback = _maximalSubgraphCriteriaValue;
      se.callback = _handleTree;
      se.process();
   }
   
   if (!skip_ext && _parameters.ext)
      _calcExtraBits(mol, vfilter);
}
开发者ID:Rillke,项目名称:indigo,代码行数:58,代码来源:molecule_fingerprint.cpp

示例7: makeTransposition

void MoleculeSubstructureMatcher::makeTransposition (BaseMolecule &mol, Array<int> &transposition_out)
{
   int i;

   transposition_out.clear();

   for (i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
      transposition_out.push(i);

   transposition_out.qsort(_compare, &mol);
}
开发者ID:mojca,项目名称:indigo,代码行数:11,代码来源:molecule_substructure_matcher.cpp

示例8: canApply

bool MoleculeLayoutMacrocycles::canApply (BaseMolecule &mol)
{
   if (!mol.isConnected(mol)) {
      return false;
   }

   for (int v = mol.vertexBegin(); v != mol.vertexEnd(); v = mol.vertexNext(v)) {
      if (mol.getVertex(v).degree() != 2) {
         return false;
      }
   }

   return true;
}
开发者ID:epam,项目名称:Indigo,代码行数:14,代码来源:molecule_layout_macrocycles.cpp

示例9: _initHashCalculations

MoleculeFingerprintBuilder::MoleculeFingerprintBuilder (BaseMolecule &mol,
                     const MoleculeFingerprintParameters &parameters):
cancellation(0),
_mol(mol),
_parameters(parameters), 
CP_INIT,
TL_CP_GET(_total_fingerprint),
TL_CP_GET(_atom_codes),
TL_CP_GET(_bond_codes),
TL_CP_GET(_atom_codes_empty),
TL_CP_GET(_bond_codes_empty)
{
   _total_fingerprint.resize(_parameters.fingerprintSize());
   cb_fragment = 0;

   query = false;
   
   skip_ord = false;
   skip_sim = false;
   skip_tau = false;
   skip_ext = false;
   skip_ext_charge = false;

   skip_any_atoms = false;
   skip_any_bonds = false;
   skip_any_atoms_bonds = false;
}

void MoleculeFingerprintBuilder::_initHashCalculations (BaseMolecule &mol)
{
   subgraph_hash.create(mol);

   _atom_codes.clear_resize(mol.vertexEnd());
   _atom_codes_empty.clear_resize(mol.vertexEnd());
   _bond_codes.clear_resize(mol.edgeEnd());
   _bond_codes_empty.clear_resize(mol.edgeEnd());
   for (int i = mol.vertexBegin(); i != mol.vertexEnd(); i = mol.vertexNext(i))
   {
      _atom_codes[i] = _atomCode(mol, i);
      _atom_codes_empty[i] = 0;
   }
   for (int i = mol.edgeBegin(); i != mol.edgeEnd(); i = mol.edgeNext(i))
   {
      _bond_codes[i] = _bondCode(mol, i);
      _bond_codes_empty[i] = 0;
   }
}
开发者ID:Rillke,项目名称:indigo,代码行数:47,代码来源:molecule_fingerprint.cpp

示例10: getBoundRect

void Metalayout::getBoundRect (Vec2f& min, Vec2f& max, BaseMolecule& mol)
{
   if (mol.vertexCount() == 0)
   {
      min.zero();
      max.zero();
      return;
   }
   const Vec3f& v0 = mol.getAtomXyz(mol.vertexBegin());
   Vec2f::projectZ(min, v0);
   Vec2f::projectZ(max, v0);
   Vec2f v2;
   for (int i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
   {
      Vec2f::projectZ(v2, mol.getAtomXyz(i));
      min.min(v2);
      max.max(v2);
   }
}
开发者ID:cambDI,项目名称:camb,代码行数:19,代码来源:metalayout.cpp

示例11: _getBounds

void _getBounds (RenderParams& params, BaseMolecule &mol, Vec2f &min, Vec2f &max, float &scale)
{
   // Compute average bond length
   float avg_bond_length = 1;
   if (mol.edgeCount() > 0)
   {
      float bond_length_sum = 0;
      for (int i = mol.edgeBegin(); i != mol.edgeEnd(); i = mol.edgeNext(i))
      {
         const Edge& edge = mol.getEdge(i);
         const Vec3f &p1 = mol.getAtomXyz(edge.beg);
         const Vec3f &p2 = mol.getAtomXyz(edge.end);
         bond_length_sum += Vec3f::dist(p1, p2);
      }
      avg_bond_length = bond_length_sum / mol.edgeCount();
   }

   float bond_length = 1;
   if (params.cnvOpt.bondLength > 0)
      bond_length = params.cnvOpt.bondLength / 100.0f;

   scale = bond_length / avg_bond_length;

   for (int i = mol.vertexBegin(); i != mol.vertexEnd(); i = mol.vertexNext(i))
   {
      Vec3f &p = mol.getAtomXyz(i);
      Vec2f p2(p.x, p.y);

      if (i == mol.vertexBegin())
         min = max = p2;
      else
      {
         min.min(p2);
         max.max(p2);
      }
   }

   min.scale(scale);
   max.scale(scale);
}
开发者ID:epam,项目名称:Indigo,代码行数:40,代码来源:render_cdxml.cpp

示例12: adjustMol

void Metalayout::adjustMol (BaseMolecule& mol, const Vec2f& min, const Vec2f& pos)
{
   float scaleFactor = getScaleFactor();

   // Compute center points for the data sgroups
   QS_DEF(Array<Vec2f>, data_centers);
   data_centers.resize(mol.data_sgroups.end());
   for (int i = mol.data_sgroups.begin(); i < mol.data_sgroups.end(); i = mol.data_sgroups.next(i))
   {
      BaseMolecule::DataSGroup &group = mol.data_sgroups[i];
      if (!group.relative)
         mol.getSGroupAtomsCenterPoint(group, data_centers[i]);
   }

   for (int i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
   {
      Vec2f v;
      Vec2f::projectZ(v, mol.getAtomXyz(i));
      v.sub(min);
      v.scale(scaleFactor);
      v.add(pos);
      v.y = -v.y;
      mol.setAtomXyz(i, v.x, v.y, 0);
   }  

   // Adjust data-sgroup label positions with absolute coordinates
   for (int i = mol.data_sgroups.begin(); i < mol.data_sgroups.end(); i = mol.data_sgroups.next(i))
   {
      BaseMolecule::DataSGroup &group = mol.data_sgroups[i];
      if (!group.relative)
      {
         Vec2f new_center;
         mol.getSGroupAtomsCenterPoint(group, new_center);
         group.display_pos.add(new_center);
         group.display_pos.sub(data_centers[i]);
      }
   }
}
开发者ID:mojca,项目名称:indigo,代码行数:38,代码来源:metalayout.cpp

示例13: _calcExtraBits

void MoleculeFingerprintBuilder::_calcExtraBits (BaseMolecule &mol, Filter &vfilter)
{
   int counters[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
   int i;

   for (i = mol.vertexBegin(); i != mol.vertexEnd(); i = mol.vertexNext(i))
   {
      if (!vfilter.valid(i))
         continue;

      int an = mol.getAtomNumber(i);

      if (an == ELEM_C)
         counters[0]++;
      else if (an == ELEM_N)
         counters[1]++;
      else if (an == ELEM_O)
         counters[2]++;
      else if (an == ELEM_P)
         counters[3]++;
      else if (an == ELEM_S)
         counters[4]++;
      else if (Element::isHalogen(an))
         counters[5]++;
      else if (an > ELEM_H)
         counters[6]++;

      if (!skip_ext_charge && mol.getAtomCharge(i) != 0 && mol.getAtomCharge(i) != CHARGE_UNKNOWN)
         counters[7]++;
      if (mol.getAtomIsotope(i) > 0)
         counters[8]++;
   }
   
   byte *fp = _total_fingerprint.ptr();

   if (counters[0] > 13) // > 13 C
      fp[0] |= 1;
   if (counters[0] > 16) // > 16 C
      fp[0] |= 2;
   if (counters[0] > 19) // > 19 C
      fp[0] |= 4;
   if (counters[1] > 1) // > 1 N
      fp[0] |= 8;
   if (counters[1] > 2) // > 2 N
      fp[0] |= 16;
   if (counters[2] > 3) // > 3 O
      fp[0] |= 32;
   if (counters[2] > 4) // > 4 O
      fp[0] |= 64;
   if (counters[3] > 0) // have P
      fp[0] |= 128;
   if (counters[4] > 0) // have S
      fp[1] |= 1;
   if (counters[4] > 1) // > 1 S
      fp[1] |= 2;
   if (counters[5] > 1) // > 1 halogen
      fp[1] |= 4;
   if (counters[5] > 2) // > 2 halogen
      fp[1] |= 8;
   if (counters[6] > 0) // have rare atoms
      fp[1] |= 16;
   if (counters[6] > 1) // > 1 rare atom
      fp[1] |= 32;
   if (counters[7] > 0) // have charged atoms
      fp[1] |= 64;
   if (counters[8] > 1) // have isotopes
      fp[1] |= 128;
}
开发者ID:Rillke,项目名称:indigo,代码行数:68,代码来源:molecule_fingerprint.cpp


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