Skip to content

Commit 4657402

Browse files
committed
bugfix for InchiToStructure with isotopes
1 parent cc5cccb commit 4657402

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIToStructure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ protected void generateAtomContainerFromInchi(IChemObjectBuilder builder) throws
181181
int isotopicMass = iAt.getIsotopicMass();
182182

183183
if (isotopicMass != 0) {
184-
if (ISOTOPIC_SHIFT_FLAG == (isotopicMass & ISOTOPIC_SHIFT_FLAG)) {
184+
if (0 != (isotopicMass & ISOTOPIC_SHIFT_FLAG)) {
185185
try {
186186
int massNumber = Isotopes.getInstance().getMajorIsotope(cAt.getAtomicNumber()).getMassNumber();
187187
cAt.setMassNumber(massNumber + (isotopicMass - ISOTOPIC_SHIFT_FLAG));

storage/inchi/src/test/java/org/openscience/cdk/inchi/InChIToStructureTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,13 @@ public void readImplicitDeuteriums() throws Exception {
256256
}
257257
assertThat(dCount, is(5));
258258
}
259+
260+
@Test
261+
public void isotope() throws Exception{
262+
InChIToStructure parse = new InChIToStructure("InChI=1S/HI/h1H/p-1/i1-6",
263+
SilentChemObjectBuilder.getInstance());
264+
IAtomContainer mol = parse.getAtomContainer();
265+
assertThat(mol.getAtomCount(), is(1));
266+
assertThat(mol.getAtom(0).getMassNumber(), is(121));
267+
}
259268
}

0 commit comments

Comments
 (0)