本文整理汇总了C++中QueryMolecule::getAllowedRGroups方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryMolecule::getAllowedRGroups方法的具体用法?C++ QueryMolecule::getAllowedRGroups怎么用?C++ QueryMolecule::getAllowedRGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryMolecule
的用法示例。
在下文中一共展示了QueryMolecule::getAllowedRGroups方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _aromatizeBonds
bool QueryMoleculeAromatizer::_aromatizeBonds (QueryMolecule &mol, int additional_atom, const AromaticityOptions &options)
{
bool aromatized = false;
// Mark edges that can be aromatic in some matching
aromatized |= _aromatizeBondsFuzzy(mol, options);
// Aromatize all aromatic cycles
aromatized |= _aromatizeBondsExact(mol, options);
MoleculeRGroups &rgroups = mol.rgroups;
int n_rgroups = rgroups.getRGroupCount();
// Check if r-groups are attached with single bonds
QS_DEF(Array<bool>, rgroups_attached_single);
rgroups_attached_single.clear();
for (int v = mol.vertexBegin(); v != mol.vertexEnd(); v = mol.vertexNext(v))
{
if (v == additional_atom)
continue;
if (mol.isRSite(v))
{
// Check if neighbor bonds are single
const Vertex &vertex = mol.getVertex(v);
for (int nei = vertex.neiBegin(); nei != vertex.neiEnd(); nei = vertex.neiNext(nei))
{
int edge = vertex.neiEdge(nei);
QueryMolecule::Bond &bond = mol.getBond(edge);
// DP TODO: implement smth. like Node::possibleOtherValueExcept() ...
bool can_be_double = bond.possibleValue(QueryMolecule::BOND_ORDER, BOND_DOUBLE);
bool can_be_triple = bond.possibleValue(QueryMolecule::BOND_ORDER, BOND_TRIPLE);
bool can_be_arom = bond.possibleValue(QueryMolecule::BOND_ORDER, BOND_AROMATIC);
if (can_be_double || can_be_triple || can_be_arom)
{
QS_DEF(Array<int>, sites);
mol.getAllowedRGroups(v, sites);
for (int j = 0; j < sites.size(); j++)
{
rgroups_attached_single.expandFill(sites[j] + 1, true);
rgroups_attached_single[sites[j]] = false;
}
}
}
}
}
rgroups_attached_single.expandFill(n_rgroups + 1, true);
for (int i = 1; i <= n_rgroups; i++)
{
PtrPool<BaseMolecule> &frags = rgroups.getRGroup(i).fragments;
for (int j = frags.begin(); j != frags.end(); j = frags.next(j))
{
QueryMolecule &fragment = frags[j]->asQueryMolecule();
aromatized |= _aromatizeRGroupFragment(fragment, rgroups_attached_single[i], options);
}
}
return aromatized;
}