Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #361 from cdk/patch/isofix
Looks fine.
  • Loading branch information
egonw committed Aug 26, 2017
2 parents eb22423 + d98a113 commit a914a10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Expand Up @@ -906,8 +906,11 @@ void readPropertiesFast(final BufferedReader input, final IAtomContainer contain
for (int i = 0, st = 10; i < count && st + 7 <= length; i++, st += 8) {
index = readMolfileInt(line, st) - 1;
int mass = readMolfileInt(line, st + 4);
container.getAtom(offset + index).setMassNumber(mass);
}
if (mass < 0)
handleError("Absolute mass number should be >= 0, " + line);
else
container.getAtom(offset + index).setMassNumber(mass);
}
break;

// M RADnn8 aaa vvv ...
Expand Down Expand Up @@ -1194,8 +1197,10 @@ void readPropertiesFast(final BufferedReader input, final IAtomContainer contain

// check of ill specified atomic mass
for (IAtom atom : container.atoms()) {
if (atom.getMassNumber() != null && atom.getMassNumber() < 0)
throw new CDKException("Unstable use of mass delta on " + atom.getSymbol() + " please use M ISO");
if (atom.getMassNumber() != null && atom.getMassNumber() < 0) {
handleError("Unstable use of mass delta on " + atom.getSymbol() + " please use M ISO");
atom.setMassNumber(null);
}
}


Expand Down
Expand Up @@ -1701,15 +1701,15 @@ public void testSgroupBracketStyle() throws Exception {
@Test(expected = CDKException.class)
public void seaborgiumMassDelta() throws Exception {
try (InputStream in = getClass().getResourceAsStream("seaborgium.mol");
MDLV2000Reader mdlr = new MDLV2000Reader(in)) {
MDLV2000Reader mdlr = new MDLV2000Reader(in, Mode.STRICT)) {
IAtomContainer mol = mdlr.read(new AtomContainer());
}
}

@Test
public void seaborgiumAbsMass() throws Exception {
try (InputStream in = getClass().getResourceAsStream("seaborgium_abs.mol");
MDLV2000Reader mdlr = new MDLV2000Reader(in)) {
MDLV2000Reader mdlr = new MDLV2000Reader(in, Mode.STRICT)) {
IAtomContainer mol = mdlr.read(new AtomContainer());
assertThat(mol.getAtom(0).getMassNumber(), is(261));
}
Expand Down

0 comments on commit a914a10

Please sign in to comment.