new Atom(Elements.CARBON);
Something I have not completely comfortable with about the CDK in the past, is the way Atom’s are constructed:
IAtom carbon = new Atom("C");
Not that it is horrible code, but the CDK has an Element too. Why not reuse that? However, until revision 6755 there were not constructors that allowed something like the following:
IAtom carbon = new Atom(new Element("C"));
This afternoon I have hacked in constructors for ChemObject, Element, Isotope, AtomType, Atom and PseudoAtom that allow to be constructed from its interface, or the interface of one of its superclasses.
Additionally, in revision 6753, I added cdk.config.Elements with static IElements for all elements up to atomic number 116, taken from the Blue Obelisk Data Repository. Therefore, I can now also write:
IAtom carbon = new Atom(Elements.CARBON);