本文整理汇总了C++中Obj::fixBond方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::fixBond方法的具体用法?C++ Obj::fixBond怎么用?C++ Obj::fixBond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj
的用法示例。
在下文中一共展示了Obj::fixBond方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
//.........这里部分代码省略.........
// check if such query bond can be aromatic (not by aromatizer)
if (_submolecule->isQueryMolecule())
{
QueryMolecule &qmol = _submolecule->asQueryMolecule();
AutoPtr<QueryMolecule::Bond> bond(qmol.releaseBond(e_idx));
bond->removeConstraints(QueryMolecule::BOND_ORDER);
AutoPtr<QueryMolecule::Bond> arom_bond(
new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_AROMATIC));
qmol.resetBond(e_idx, QueryMolecule::Bond::und(bond.release(), arom_bond.release()));
}
else
_submolecule->asMolecule().setBondOrder(e_idx, BOND_SINGLE, false);
is_edge_in_aromatic_cycle[e_idx] = AROMATIC_BOND_NOT_IN_AROMATIC_CYCLE;
}
}
// 2. Try to find suitable dearomatization
QS_DEF(DearomatizationsStorage, dearomatizations);
// Dearomatizer and DearomatizationMatcher will be created on demand
Obj<Dearomatizer> dearomatizer;
Obj<DearomatizationMatcher> dearomatizationMatcher;
// Check edges
for (int e = _submolecule->edgeBegin(); e != _submolecule->edgeEnd(); e = _submolecule->edgeNext(e))
{
const Edge &edge = _submolecule->getEdge(e);
int target_edge_index =
_base.findEdgeIndex(mapping[edge.beg], mapping[edge.end]);
const Edge &target_edge = _base.getEdge(target_edge_index);
int query_edge_index =
_query.findEdgeIndex(core_super[target_edge.beg], core_super[target_edge.end]);
if (query_edge_index == -1)
throw Error("(AromaticityMatcher::match) query edge wasn't found");
if (_matching_edges_state[query_edge_index] != AROMATIC)
// Such target bond isn't aromatic. So we don't need to fix such bond
continue;
QueryMolecule::Bond &qbond = _query.getBond(query_edge_index);
bool can_have_arom_order = qbond.possibleValuePair(
QueryMolecule::BOND_ORDER, BOND_AROMATIC,
QueryMolecule::BOND_TOPOLOGY, TOPOLOGY_RING);
if (can_have_arom_order)
// This query bond is aromatic.
continue;
if (is_edge_in_aromatic_cycle[e] == AROMATIC_BOND_NOT_IN_AROMATIC_CYCLE)
{
// Such bond cannot be aromatic without aromatic
// cycle because 'can_have_arom_order' is false
return false;
}
bool has_other = !qbond.hasNoConstraintExcept(QueryMolecule::BOND_ORDER,
QueryMolecule::BOND_TOPOLOGY);
if (has_other)
throw Error("Only bond with order and topology constraints are supported");
bool can_have_single = qbond.possibleValuePair(
QueryMolecule::BOND_ORDER, BOND_SINGLE,
QueryMolecule::BOND_TOPOLOGY, TOPOLOGY_RING);
bool can_have_double = qbond.possibleValuePair(
QueryMolecule::BOND_ORDER, BOND_DOUBLE,
QueryMolecule::BOND_TOPOLOGY, TOPOLOGY_RING);
// Check if query bond can be only single or only double
if (can_have_single && can_have_double)
// Don't fix such bond. It can be single/double, single/aromatic and etc.
continue;
if (!can_have_single && !can_have_double)
// Bond without and specification and etc.
continue;
// Find dearomatization
if (dearomatizer.get() == NULL)
{
dearomatizer.create(_submolecule.ref(), external_conn.ptr(), _arom_options);
dearomatizer->enumerateDearomatizations(dearomatizations);
dearomatizationMatcher.create(dearomatizations,
_submolecule.ref(), external_conn.ptr());
}
// Fix bond
int type = can_have_single ? BOND_SINGLE : BOND_DOUBLE;
if (!dearomatizationMatcher->isAbleToFixBond(e, type))
return false;
dearomatizationMatcher->fixBond(e, type);
}
return true;
}