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


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

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


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

示例1: _checkDoubleBonds

AromatizerBase::AromatizerBase (BaseMolecule &molecule) : _basemol(molecule),
   CP_INIT,
   TL_CP_GET(_bonds_arom),
   TL_CP_GET(_bonds_arom_count),
   TL_CP_GET(_unsure_cycles),
   TL_CP_GET(_cycle_atoms)
{
   _bonds_arom.resize(bitGetSize(molecule.edgeEnd()));
   _bonds_arom_count.resize(molecule.edgeEnd());

   _cycle_atoms.clear_resize(_basemol.vertexEnd());

   reset();
}

AromatizerBase::~AromatizerBase ()
{
}

bool AromatizerBase::_checkDoubleBonds (const int *cycle, int cycle_len)
{
   int j;

   for (j = 0; j < cycle_len; j++)
   {
      int v_left_idx = cycle[j];
      int v_center_idx = cycle[(j + 1) % cycle_len];
      int v_right_idx = cycle[(j + 2) % cycle_len];

      const Vertex &vertex = _basemol.getVertex(v_center_idx);
      int i;

      int internal_double_bond_count = 0;
      for (i = vertex.neiBegin(); i != vertex.neiEnd(); i = vertex.neiNext(i))
      {
         int nei_idx = vertex.neiVertex(i);

         int e_idx = vertex.neiEdge(i);
         int type = _basemol.getBondOrder(e_idx);
         if (type == BOND_DOUBLE && !isBondAromatic(e_idx))
         {
            if (nei_idx != v_left_idx && nei_idx != v_right_idx)
            {
               // Double bond going outside 
               if (!_acceptOutgoingDoubleBond(v_center_idx, e_idx))
                  return false;
            }
            else if (nei_idx == v_left_idx || nei_idx == v_right_idx)
               internal_double_bond_count++;
         }
      }
      if (internal_double_bond_count >= 2)
         return false;
   }
   return true;
}
开发者ID:whztt07,项目名称:Indigo,代码行数:56,代码来源:molecule_arom.cpp

示例2: _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

示例3: buildOnSubmolecule

void MoleculeCisTrans::buildOnSubmolecule (BaseMolecule &super, int *mapping)
{
   BaseMolecule &sub = _getMolecule();

   if (!super.cis_trans.exists())
      return;

   while (_bonds.size() < sub.edgeEnd())
   {
      _Bond &bond = _bonds.push();
      
      memset(&bond, 0, sizeof(_Bond));
   }

   int i, j;

   for (i = super.edgeBegin(); i != super.edgeEnd(); i = super.edgeNext(i))
   {
      int parity = super.cis_trans.getParity(i);
      int sub_edge_idx = Graph::findMappedEdge(super, sub, i, mapping);

      if (sub_edge_idx < 0)
         continue;

      _Bond &bond = _bonds[sub_edge_idx];
      bond.ignored = super.cis_trans.isIgnored(i);
      
      if (parity == 0)
      {
         bond.parity = 0;
         continue;
      }

      const int *substituents = super.cis_trans.getSubstituents(i);

      for (j = 0; j < 4; j++)
      {
         if (substituents[j] < 0 || mapping[substituents[j]] < 0)
            bond.substituents[j] = -1;
         else
            bond.substituents[j] = mapping[substituents[j]];
      }

      bond.parity = parity;
      bool parity_changed;
      if (!sortSubstituents(sub, bond.substituents, &parity_changed))
      {
         bond.parity = 0;
         continue;
      }

      if (parity_changed)
         bond.parity = 3 - bond.parity;
   }
}
开发者ID:mojca,项目名称:indigo,代码行数:55,代码来源:molecule_cis_trans.cpp

示例4: getTotalMoleculeBondLength

float Metalayout::getTotalMoleculeBondLength (BaseMolecule& mol)
{
   Vec2f v1, v2;
   float sum = 0;
   for (int i = mol.edgeBegin(); i < mol.edgeEnd(); i = mol.edgeNext(i))
   {
      const Edge& edge = mol.getEdge(i);
      Vec2f::projectZ(v1, mol.getAtomXyz(edge.beg));
      Vec2f::projectZ(v2, mol.getAtomXyz(edge.end));
      sum += Vec2f::dist(v1, v2);
   }

   return sum;
}
开发者ID:cambDI,项目名称:camb,代码行数:14,代码来源:metalayout.cpp

示例5: _layoutSingleComponent

void MoleculeLayoutGraphSmart::_layoutSingleComponent (BaseMolecule &molecule, bool respect_existing, const Filter * filter, float bond_length)
{
   QS_DEF(Array<Vec2f>, src_layout);
   QS_DEF(Array<int>, molecule_edge_mapping);

   int i;

   molecule_edge_mapping.clear_resize(molecule.edgeEnd());

   for (i = 0; i < molecule_edge_mapping.size(); i++)
      molecule_edge_mapping[i] = i;

   _molecule = &molecule;
   _molecule_edge_mapping = molecule_edge_mapping.ptr();

   src_layout.clear_resize(vertexEnd());

   if (respect_existing)
      for (int i = vertexBegin(); i < vertexEnd(); i = vertexNext(i))
         src_layout[i] = getPos(i);
   else
      src_layout.zerofill();

   if (filter != 0)
   {
      _fixed_vertices.resize(vertexEnd());
      _fixed_vertices.zerofill();

      for (int i = vertexBegin(); i < vertexEnd(); i = vertexNext(i))
         if (!filter->valid(i))
         {
            _fixed_vertices[i] = 1;
            _n_fixed++;
         }
   }


   if (vertexCount() > 1)
   {
       _calcMorganCodes();
       _assignAbsoluteCoordinates(bond_length);
   }
   _assignFinalCoordinates(bond_length, src_layout);
}
开发者ID:epam,项目名称:Indigo,代码行数:44,代码来源:molecule_layout_graph_smart.cpp

示例6: isAutomorphism

bool MoleculeCisTrans::isAutomorphism (BaseMolecule &mol, const Array<int> &mapping, const Filter *edge_filter)
{
   for (int i = mol.edgeBegin(); i != mol.edgeEnd(); i = mol.edgeNext(i))
   {
      if (edge_filter && !edge_filter->valid(i))
         continue;

      const Edge &edge = mol.getEdge(i);
      int parity = mol.cis_trans.getParity(i);
      int parity2 = MoleculeCisTrans::applyMapping(parity, mol.cis_trans.getSubstituents(i), 
         mapping.ptr(), false);

      int i2 = mol.findEdgeIndex(mapping[edge.beg], mapping[edge.end]);
      if (mol.cis_trans.getParity(i2) != parity2)
         return false;
   }

   return true;
}
开发者ID:mojca,项目名称:indigo,代码行数:19,代码来源:molecule_cis_trans.cpp

示例7: checkSub

bool MoleculeCisTrans::checkSub (BaseMolecule &query, BaseMolecule &target, const int *mapping)
{
   int i;

   for (i = query.edgeBegin(); i != query.edgeEnd(); i = query.edgeNext(i))
   {
      if (!query.bondStereoCare(i))
         continue;

      int query_parity = query.cis_trans.getParity(i);

      if (query_parity == 0)
         throw Error("bond #%d has stereo-care flag, but is not cis-trans bond", i); 

      if (getMappingParitySign(query, target, i, mapping) < 0)
         return false;
   }   
   return true;
}
开发者ID:mojca,项目名称:indigo,代码行数:19,代码来源:molecule_cis_trans.cpp

示例8: findAromaticAtoms

void MoleculeAromatizer::findAromaticAtoms (BaseMolecule &mol, Array<int> *atoms, Array<int> *bonds, const AromaticityOptions &options)
{
   AutoPtr<BaseMolecule> clone;
   QS_DEF(Array<int>, mapping);

   clone.reset(mol.neu());
   mapping.clear();

   if (atoms != 0)
   {
      atoms->clear_resize(mol.vertexEnd());
      atoms->zerofill();
   }

   if (bonds != 0)
   {
      bonds->clear_resize(mol.edgeEnd());
      bonds->zerofill();
   }

   clone->clone(mol, &mapping, 0);

   clone->aromatize(options);

   for (int i = clone->edgeBegin(); i != clone->edgeEnd(); i = clone->edgeNext(i))
   {
      if (clone->getBondOrder(i) == BOND_AROMATIC)
      {
         const Edge &edge = clone->getEdge(i);

         if (atoms != 0)
         {
            atoms->at(mapping[edge.beg]) = 1;
            atoms->at(mapping[edge.end]) = 1;
         }

         if (bonds != 0)
            bonds->at(mol.findEdgeIndex(mapping[edge.beg], mapping[edge.end])) = 1;

      }
   }
}
开发者ID:whztt07,项目名称:Indigo,代码行数:42,代码来源:molecule_arom.cpp

示例9: _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


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