Skip to content

Commit

Permalink
Fix potential problem with stereo-matching - the end points of the ta…
Browse files Browse the repository at this point in the history
…rget double bond must be in the same stereo element.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Jan 19, 2014
1 parent 1a2dc9f commit 0d66616
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Expand Up @@ -212,6 +212,12 @@ private boolean checkGeometric(int u1, int u2, int[] mapping) {

IDoubleBondStereochemistry targetElement = (IDoubleBondStereochemistry) targetElements[v1];

// although the atoms were mapped and 'v1' and 'v2' are bond in double-bond
// elements they are not in the same element
if (targetElement.getStereoBond().getAtom(0) != target.getAtom(v1)
|| targetElement.getStereoBond().getAtom(1) != target.getAtom(v2))
return false;

// bond is undirected so we need to ensure v1 is the first atom in the bond
// we also need to to swap the substituents later
boolean swap = false;
Expand Down
6 changes: 6 additions & 0 deletions src/main/org/openscience/cdk/isomorphism/StereoMatch.java
Expand Up @@ -202,6 +202,12 @@ private boolean checkGeometric(int u1, int u2, int[] mapping) {
IDoubleBondStereochemistry queryElement = (IDoubleBondStereochemistry) queryElements[u1];
IDoubleBondStereochemistry targetElement = (IDoubleBondStereochemistry) targetElements[v1];

// although the atoms were mapped and 'v1' and 'v2' are bond in double-bond
// elements they are not in the same element
if (targetElement.getStereoBond().getAtom(0) != target.getAtom(v1)
|| targetElement.getStereoBond().getAtom(1) != target.getAtom(v2))
return false;

// bond is undirected so we need to ensure v1 is the first atom in the bond
// we also need to to swap the substituents later
boolean swap = false;
Expand Down

0 comments on commit 0d66616

Please sign in to comment.