Skip to content

Commit 39549c0

Browse files
committed
Match the semantic of the bond expressions. Unless someone asks for IS_IN_CHAIN don't add it in, hexane (acyclic) is a subsgraph of cyclohexane (cyclic).
1 parent bd19601 commit 39549c0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/QueryAtomContainer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,9 +1776,10 @@ public static QueryAtomContainer create(IAtomContainer mol, Expr.Type... opts) {
17761776
if (optset.contains(TOTAL_DEGREE))
17771777
expr.and(new Expr(DEGREE,
17781778
atom.getBondCount() + atom.getImplicitHydrogenCount()));
1779-
if (optset.contains(IS_IN_RING) ||
1780-
optset.contains(IS_IN_CHAIN))
1781-
expr.and(new Expr(atom.isInRing() ? IS_IN_RING : IS_IN_CHAIN));
1779+
if (optset.contains(IS_IN_RING) && atom.isInRing())
1780+
expr.and(new Expr(IS_IN_RING));
1781+
if (optset.contains(IS_IN_CHAIN) && !atom.isInRing())
1782+
expr.and(new Expr(IS_IN_CHAIN));
17821783
if (optset.contains(IMPL_H_COUNT))
17831784
expr.and(new Expr(IMPL_H_COUNT));
17841785
if (optset.contains(RING_BOND_COUNT)) {

0 commit comments

Comments
 (0)