本文整理汇总了C++中BaseMolecule::vertexEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseMolecule::vertexEnd方法的具体用法?C++ BaseMolecule::vertexEnd怎么用?C++ BaseMolecule::vertexEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseMolecule
的用法示例。
在下文中一共展示了BaseMolecule::vertexEnd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: _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);
}
示例4: 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;
}
}
}
示例5:
MoleculeCleaner2d::MoleculeCleaner2d(BaseMolecule& mol, bool use_biconnected_decompose, const Array<int>& selected_vertices)
: MoleculeCleaner2d(mol, use_biconnected_decompose) {
active_points.clear_resize(mol.vertexEnd());
active_points.zerofill();
for (int i = 0; i < selected_vertices.size(); i++)
active_points[selected_vertices[i]] = true;
}
示例6: 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;
}
}
}
示例7: _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;
}
示例8: _initHashCalculations
MoleculeFingerprintBuilder::MoleculeFingerprintBuilder (BaseMolecule &mol,
const MoleculeFingerprintParameters ¶meters):
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;
}
}
示例9: 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);
}
示例10: 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;
}
示例11: 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);
}
}
示例12: 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;
}
}
}
示例13: _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);
}
示例14:
MoleculeSubstructureMatcher::MoleculeSubstructureMatcher (BaseMolecule &target) :
_target(target),
TL_CP_GET(_3d_constrained_atoms),
TL_CP_GET(_unfolded_target_h),
TL_CP_GET(_used_target_h)
{
vertex_equivalence_handler = NULL;
use_aromaticity_matcher = true;
use_pi_systems_matcher = false;
_query = 0;
match_3d = 0;
rms_threshold = 0;
highlight = false;
find_all_embeddings = false;
find_unique_embeddings = false;
find_unique_by_edges = false;
save_for_iteration = false;
disable_folding_query_h = false;
not_ignore_first_atom = false;
cb_embedding = 0;
cb_embedding_context = 0;
fmcache = 0;
disable_unfolding_implicit_h = false;
restore_unfolded_h = true;
_h_unfold = false;
_query_nei_counters = 0;
_target_nei_counters = 0;
_used_target_h.clear_resize(target.vertexEnd());
// won't ignore target hydrogens because query can contain
// 3d features, hydrogen isotopes, etc.
}
示例15: 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]);
}
}
}