Published August 6, 2006 | https://doi.org/10.59350/m0wwb-ty759

new Atom(Elements.CARBON);

Creators & Contributors

  • 1. ROR icon University of Cologne

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);

Additional details

Description

Something I have not completely comfortable with about the CDK in the past, is the way Atom's are constructed:

Identifiers

Dates

Issued
2006-08-06T02:00:00
Updated
2025-02-15T01:00:00