本文整理汇总了C++中QueryMolecule::getEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryMolecule::getEdge方法的具体用法?C++ QueryMolecule::getEdge怎么用?C++ QueryMolecule::getEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryMolecule
的用法示例。
在下文中一共展示了QueryMolecule::getEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _fixBonds
bool MoleculePiSystemsMatcher::_fixBonds (QueryMolecule &query, const int *mapping)
{
for (int e = query.edgeBegin();
e != query.edgeEnd();
e = query.edgeNext(e))
{
const Edge &query_edge = query.getEdge(e);
if (mapping[query_edge.beg] < 0 || mapping[query_edge.end] < 0)
continue; // Edges connected with ignored vertices
int target_edge = Graph::findMappedEdge(query, _target, e, mapping);
const Edge &edge = _target.getEdge(target_edge);
int p1_idx = _atom_pi_system_idx[edge.beg];
int p2_idx = _atom_pi_system_idx[edge.end];
if (p1_idx == _NOT_IN_PI_SYSTEM || p2_idx == _NOT_IN_PI_SYSTEM || p1_idx != p2_idx)
continue;
if (!_pi_systems[p1_idx].initialized)
throw Error("pi-system must be initialized here");
_Pi_System &pi_system = _pi_systems[p1_idx];
int pi_sys_edge = Graph::findMappedEdge(_target, pi_system.pi_system,
target_edge, pi_system.inv_mapping.ptr());
// Get target topology
int topology = _target.getBondTopology(target_edge);
QueryMolecule::Bond &qbond = query.getBond(e);
bool can_be_single = qbond.possibleValuePair(
QueryMolecule::BOND_ORDER, BOND_SINGLE,
QueryMolecule::BOND_TOPOLOGY, topology);
bool can_be_double = qbond.possibleValuePair(
QueryMolecule::BOND_ORDER, BOND_DOUBLE,
QueryMolecule::BOND_TOPOLOGY, topology);
bool can_be_triple = qbond.possibleValuePair(
QueryMolecule::BOND_ORDER, BOND_TRIPLE,
QueryMolecule::BOND_TOPOLOGY, topology);
if (!can_be_single && !can_be_double && !can_be_triple)
return false;
if (can_be_single && can_be_double && can_be_triple)
continue;
bool ret = false; // initializing to avoid compiler warning
if (can_be_single && can_be_double)
// Here can_be_triple = false because of previous check
ret = pi_system.localizer->fixBondSingleDouble(pi_sys_edge);
else
{
if (can_be_triple)
{
if (can_be_single)
throw Error("Unsupported bond order specified (can be single or triple)");
else if (can_be_double)
throw Error("Unsupported bond order specified (can be double or triple)");
ret = pi_system.localizer->fixBond(pi_sys_edge, BOND_TRIPLE);
}
if (can_be_single)
ret = pi_system.localizer->fixBond(pi_sys_edge, BOND_SINGLE);
if (can_be_double)
ret = pi_system.localizer->fixBond(pi_sys_edge, BOND_DOUBLE);
}
if (!ret)
return false;
}
return true;
}