Skip to content

Commit 813c120

Browse files
johnmayegonw
authored andcommitted
Make sure TOTAL_DEGREE works correctly
1 parent c2269af commit 813c120

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ public static void create(IAtomContainer dst,
17871787
expr.and(new Expr(DEGREE,
17881788
atom.getBondCount()));
17891789
if (optset.contains(TOTAL_DEGREE))
1790-
expr.and(new Expr(DEGREE,
1790+
expr.and(new Expr(TOTAL_DEGREE,
17911791
atom.getBondCount() + atom.getImplicitHydrogenCount()));
17921792
if (optset.contains(IS_IN_RING) && atom.isInRing())
17931793
expr.and(new Expr(IS_IN_RING));

tool/smarts/src/test/java/org/openscience/cdk/smarts/MolToQueryTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ public void elementAndDegree() throws InvalidSmilesException {
8888
Expr.Type.ELEMENT, Expr.Type.DEGREE);
8989
}
9090

91+
@Test
92+
public void elementAndConnectivityDegree() throws InvalidSmilesException {
93+
test("[#6X3]1~[#6X3]~[#6X3]~[#6X3]~[#7X2]~[#6X3]~1~[#6X4]", "c1cccnc1C",
94+
Expr.Type.ELEMENT, Expr.Type.TOTAL_DEGREE);
95+
}
96+
9197
@Test
9298
public void complexDocExample() throws InvalidSmilesException {
9399
test("[nx2+0]1:[cx2+0]:[cx2+0]:[cx2+0](=[O&x0+0]):[cx2+0]:[cx2+0]:1",

0 commit comments

Comments
 (0)