Hello Egon,
CDKMolecule is just the abstract class that the concrete class BasicCDKMolecule inherits from. So all clients need to create is a single BasicCDKMolecule.
BasicCDKMolecule overrides the addAtom method of org.openscience.cdk.Molecule. In my (really simple) implementation, this override (1) calls super.addAtom(); (2) adds a new net.sourceforge.octet.molecule.Atom to an internal instance of net.sourceforge.octet.molecule.BasicMolecule.
BasicCDKMolecule overrides some of the methods of org.openscience.cdk.Molecule, and passes all requests to its net.sourceforge.octet.molecule.Molecule interface to a private instance of net.sourceforge.octet.molecule.BasicMolecule.
Very little actual code needs to be written - most of it is taken care of with delegation that is invisible to CDK clients. The big challenge will be in reconciling CDK's model of bonding with Octet's model of bonding. In particular CDK fractional bond orders will need to be converted to a bonding model that can be represented as bonding systems (a la Dietz) - but I'm confident this can be done. In Octet, clients can not "set" the bond order of any bond - they can only connect atoms, and add/remove electrons from atoms and bonding systems. Bond order/formal charge naturally follows from where the electrons end up and atom connectivity (see net.sourceforge.octet.util.MoleculeKit.getFormalBondOrder).

Egon Willighagen <egonw@sci.kun.nl> wrote:
On Wednesday 05 May 2004 04:35, rich apodaca wrote:
> One of the problems I came up against in using option (2) was that the CDK
> IO classes create their own instance of org.openscience.cdk.Molecule,
> rather than allow for one to be passed in and operated on. If this could be
> enabled, then clients could go:
> BasicCDKMolecule cyclohexane = new BasicCDKMolecule();
> SMILESReader reader = new SMILESReader(new StringReader("C1CCCCC1"));
> reader.read(cyclohexane); // or possibly reader.read(chemobject,
> cyclohexane);
> // now do something with cyclohexane

Yes, that should be changed. One complicating problem is that we also need the
BasicCDKMolecule *and* the CDK Molecule to create Atom's !

Or does the BasicCDKMolecule except CDK Atom, and convert that internally?

> // we now have cyclohexane that can be used in either Octet or CDK - and
> the beauty is that CDK knew nothing about what just happened!
> Of course, there are other strategies for CDK-Octet interoperability that
> could be followed, and variants on the above two, but I think this give a
> feel for what might be possible.

No, this looks fine.


This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
Cdk-devel mailing list

Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs