I noticed that the BODRIsotope class returns null from its getBuilder() method:
@Override @TestMethod("untested") public IChemObjectBuilder getBuilder() { return null; }
This causes a NullPointerException in MolecularFormulaManipulator.getNaturalExactMass() if the formula contains such isotopes.
Sample code (throws NullPointerException at the last line):
Isotopes is = Isotopes.getInstance(); IIsotope carbon = is.getMajorIsotope("C"); MolecularFormula mf = new MolecularFormula(); mf.addIsotope(carbon, 10); double mass = MolecularFormulaManipulator.getNaturalExactMass(mf);
Confirmed. Submitting a patch.
Patch: https://github.com/cdk/cdk/pull/101
Applied and pushed
Diff: