This commit is contained in:
Greg Landrum
2015-12-11 10:09:53 +01:00
parent 27e5dc435f
commit 8b65790fde
2 changed files with 18 additions and 8 deletions

View File

@@ -74,14 +74,15 @@ class MolMatchFinalCheckFunctor {
// check chiral atoms:
for (unsigned int i = 0; i < d_query.getNumAtoms(); ++i) {
const Atom *qAt = d_query.getAtomWithIdx(c1[i]);
if (qAt->getChiralTag() != Atom::CHI_TETRAHEDRAL_CW &&
qAt->getChiralTag() != Atom::CHI_TETRAHEDRAL_CCW)
if (qAt->getDegree()<3 || // FIX: doesn't deal with "explicit" Hs properly
(qAt->getChiralTag() != Atom::CHI_TETRAHEDRAL_CW &&
qAt->getChiralTag() != Atom::CHI_TETRAHEDRAL_CCW))
continue;
const Atom *mAt = d_mol.getAtomWithIdx(c2[i]);
if (mAt->getChiralTag() != Atom::CHI_TETRAHEDRAL_CW &&
mAt->getChiralTag() != Atom::CHI_TETRAHEDRAL_CCW)
return false;
if (qAt->getDegree() != mAt->getDegree()) return false;
if (qAt->getDegree() > mAt->getDegree()) return false;
INT_LIST qOrder;
for (unsigned int j = 0; j < d_query.getNumAtoms(); ++j) {
const Bond *qB = d_query.getBondBetweenAtoms(c1[i], c1[j]);
@@ -100,7 +101,16 @@ class MolMatchFinalCheckFunctor {
if (mOrder.size() == mAt->getDegree()) break;
}
}
int mPermCount = mAt->getPerturbationOrder(mOrder);
INT_LIST moOrder;
ROMol::OEDGE_ITER dbeg, dend;
boost::tie(dbeg, dend) = d_mol.getAtomBonds(mAt);
while (dbeg != dend) {
int dbidx=d_mol[*dbeg]->getIdx();
if(std::find(mOrder.begin(),mOrder.end(),dbidx)!=mOrder.end())
moOrder.push_back(dbidx);
++dbeg;
}
int mPermCount = static_cast<int>(countSwapsToInterconvert(moOrder,mOrder));
if ((qPermCount % 2 == mPermCount % 2 &&
qAt->getChiralTag() != mAt->getChiralTag()) ||