Tuesday, December 09, 2008

Adding explicit Hydrogens with CDK 1.1.2.

In my previous post, I created the 3D model of decalin, an organic molecule which is the building block of the steroid framework, using the Chemistry Development Toolkit. You might notice that the final structure shows only the Carbon atoms, all Hydrogens are 'implicit', that is, they are taken into account by the ModelBuilder3D, but not written out into the PDB file.

I had a hard time until I finally managed to add explicit hydrogens. It seems that in earlier versions of CDK, the HydrogenAdder class had a method 'addExplicitHydrogens()', but this class is now replaced with CDKHydrogenAdder, which handles only implicit hydrogens. After lots of experimenting, I wrote a function that basically copies a molecule and turns all implicit hydrogens into explicit:



Then I used the ModelBuilder3D class, as before, to create a 3D model:

Decalin with explicit hydrogens - 3D model

I have no idea why the feature to add explicit hydrogens were removed from CDK. It is necessary eg. for proper docking, detecting hydrogen bonds, and so on. Maybe in later releases they will add it back; if not, you can use my snippet above as a substitute.

1 comment:

baoilleach said...

cdk.tools.manipulator.AtomContainerManipulator.convertImplicitToExplicitHydrogens
is your friend...