本文整理汇总了C++中BaseMolecule::possibleBondOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseMolecule::possibleBondOrder方法的具体用法?C++ BaseMolecule::possibleBondOrder怎么用?C++ BaseMolecule::possibleBondOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseMolecule
的用法示例。
在下文中一共展示了BaseMolecule::possibleBondOrder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matchQueryBond
bool MoleculeSubstructureMatcher::matchQueryBond (QueryMolecule::Bond *query,
BaseMolecule &target, int sub_idx, int super_idx, AromaticityMatcher *am, dword flags)
{
int i;
// MR TODO: match topology. Query bond in ring cannot match
// target bond that is not in ring. But R-groups should be
// handled carefully
switch (query->type)
{
case QueryMolecule::OP_NONE:
return true;
case QueryMolecule::OP_AND:
for (i = 0; i < query->children.size(); i++)
if (!matchQueryBond(query->child(i), target, sub_idx, super_idx, am, flags))
return false;
return true;
case QueryMolecule::OP_OR:
for (i = 0; i < query->children.size(); i++)
if (matchQueryBond(query->child(i), target, sub_idx, super_idx, am, flags))
return true;
return false;
case QueryMolecule::OP_NOT:
return !matchQueryBond(query->child(0), target, sub_idx, super_idx, am,
flags ^ MATCH_DISABLED_AS_TRUE);
case QueryMolecule::BOND_ORDER:
{
if (flags & MATCH_BOND_TYPE)
{
if (am != 0)
{
if (target.getBondOrder(super_idx) == BOND_AROMATIC)
return am->canFixQueryBond(sub_idx, true);
else
{
if (!am->canFixQueryBond(sub_idx, false))
return false;
}
}
return target.possibleBondOrder(super_idx, query->value);
}
return (flags & MATCH_DISABLED_AS_TRUE) != 0;
}
case QueryMolecule::BOND_TOPOLOGY:
return target.getEdgeTopology(super_idx) == query->value;
case QueryMolecule::HIGHLIGHTING:
return query->value == (int)target.isAtomHighlighted(super_idx);
default:
throw Error("bad query bond type: %d", query->type);
}
}
示例2: isGeomStereoBond
bool MoleculeCisTrans::isGeomStereoBond (BaseMolecule &mol, int bond_idx,
int *substituents, bool have_xyz)
{
int substituents_local[4];
if (substituents == 0)
substituents = substituents_local;
// it must be [C,N,Si,Ge]=[C,N,Si,Ge] bond
if (!mol.possibleBondOrder(bond_idx, BOND_DOUBLE))
return false;
const Edge &edge = mol.getEdge(bond_idx);
int beg_idx = edge.beg;
int end_idx = edge.end;
if (!mol.possibleAtomNumber(beg_idx, ELEM_C) &&
!mol.possibleAtomNumber(beg_idx, ELEM_N) &&
!mol.possibleAtomNumber(beg_idx, ELEM_Si) &&
!mol.possibleAtomNumber(beg_idx, ELEM_Ge))
return false;
if (!mol.possibleAtomNumber(end_idx, ELEM_C) &&
!mol.possibleAtomNumber(end_idx, ELEM_N) &&
!mol.possibleAtomNumber(end_idx, ELEM_Si) &&
!mol.possibleAtomNumber(end_idx, ELEM_Ge))
return false;
// Double bonds with R-sites are excluded because cis-trans configuration
// cannot be determined when R-site is substituted with R-group
if (mol.isRSite(beg_idx) || mol.isRSite(end_idx))
return false;
// the atoms should have 1 or 2 single bonds
// (apart from the double bond under consideration)
const Vertex &beg = mol.getVertex(beg_idx);
const Vertex &end = mol.getVertex(end_idx);
if (beg.degree() < 2 || beg.degree() > 3 ||
end.degree() < 2 || end.degree() > 3)
return false;
substituents[0] = -1;
substituents[1] = -1;
substituents[2] = -1;
substituents[3] = -1;
int i;
for (i = beg.neiBegin(); i != beg.neiEnd(); i = beg.neiNext(i))
{
int nei_edge_idx = beg.neiEdge(i);
if (nei_edge_idx == bond_idx)
continue;
if (!mol.possibleBondOrder(nei_edge_idx, BOND_SINGLE))
return false;
if (substituents[0] == -1)
substituents[0] = beg.neiVertex(i);
else // (substituents[1] == -1)
substituents[1] = beg.neiVertex(i);
}
for (i = end.neiBegin(); i != end.neiEnd(); i = end.neiNext(i))
{
int nei_edge_idx = end.neiEdge(i);
if (nei_edge_idx == bond_idx)
continue;
if (!mol.possibleBondOrder(nei_edge_idx, BOND_SINGLE))
return false;
if (substituents[2] == -1)
substituents[2] = end.neiVertex(i);
else // (substituents[3] == -1)
substituents[3] = end.neiVertex(i);
}
// Check trianges when substituents are the same: CC1=C(N)C1
if (substituents[0] >= 0)
if (substituents[0] == substituents[2] || substituents[0] == substituents[3])
return false;
if (substituents[1] >= 0)
if (substituents[1] == substituents[2] || substituents[1] == substituents[3])
return false;
if (have_xyz)
{
if (substituents[1] != -1 &&
_sameside(mol, beg_idx, end_idx, substituents[0], substituents[1]) != -1)
return false;
else if (_sameline(mol, beg_idx, end_idx, substituents[0]))
return false;
if (substituents[3] != -1 &&
_sameside(mol, beg_idx, end_idx, substituents[2], substituents[3]) != -1)
return false;
else if (_sameline(mol, beg_idx, end_idx, substituents[2]))
//.........这里部分代码省略.........