本文整理汇总了C++中BaseMolecule::edgeNext方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseMolecule::edgeNext方法的具体用法?C++ BaseMolecule::edgeNext怎么用?C++ BaseMolecule::edgeNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseMolecule
的用法示例。
在下文中一共展示了BaseMolecule::edgeNext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: 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;
}
示例3: _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;
}
}
示例4: 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;
}
示例5: 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;
}
示例6: _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);
}