Pages

Wednesday, October 27, 2010

CDK 1.2 to 1.4 API changes #2: implicit hydrogens

A second API change lies deep in the IAtom interface. To reflect more accurately the meaning of the method, the IAtomType.getHydrogenCount() has been renamed to IAtomType.getImplicitHydrogenCount(), and likewise the setter methods.

CDK 1.2 code
carbon.setHydrogenCount(4);
CDK 1.4 code
carbon.setImplicitHydrogenCount(4);
Yeah, that's a simple one. Just to make clear, in both versions the count reflected the number of implicit hydrogens. The getHydrogenCount() suggested, however, to return the number of all hydrogens attached to that atom, that is, the sum of implicit and explicit hydrogens.