Saturday, May 03, 2014

Changes in CDK 1.6 #4: IsotopeFactory and Isotopes

A major CDK API change happened around the IsotopeFactory. Previously, this class was used to get isotope information, which it gets from an configurable XML file. This functionality is now available from the XMLIsotopeFactory class. However, to improve the speed of getting basic isotope information as well as to reduce the size of the core modules, CDK 1.6 introduces a Isotopes class, which contains information extracted from the XML file, but is available as a pure Java class. The APIs for getting isotope information is mostly the same, but the instantiation is much simpler, and also no longer requires an IChemObjectBuilder (in Groovy):
    import org.openscience.cdk.config.*;

    isofac = Isotopes.getInstance();
    uranium = 92;
    for (atomicNumber in 1..uranium) {
      element = isofac.getElement(atomicNumber)
Previous posts:

No comments:

Post a Comment