type to search

Detect aromatic rings (using bond order = 4) in a SDF file with CDK

Asked by , Edited by oscar mora


I am using CDK. I have some molecules in a SDF with aromatic rings which (mis)use bond order = 4 to represent aromaticity.
I would like to “fix” or transform the bonds with order = 4 (CDK represents them as SINGLE bond order and ISAROMATIC flag enabled) to bond order = SINGLE or DOUBLE.

Reading several resources:

I guessed that I had to use tools like:

dbst = new DeduceBondSystemTool();


fbot = new FixBondOrdersTool();

I have tried with the attached SDF (where the first molecule contains bond order = 4) but when I serialize the IAtomContainer object to MDL format using MDLV2000Writer, the bond block of the output still contains bond order = 4. (MDLV2000Writer is configured with default options-> WriteAromaticBondTypes:false)

Maybe I am misunderstanding something? Is it possible to rewrite an input molecule where bond block contains several bond orders = 4 to bond orders = 2 or 1.

thanks in advance!


Attached files:
or Cancel

2 answers


johnwilkinsonmay from Craven, United Kingdom

Argh the site ate my first response!

– DeduceBondOrdersTool only handles 5,6,7 member rings and will likely be retired in future
– AtomTypeAwareSaturationChecker is another tool – you can compare the three (here). Put in a SMILES string with aromatic atoms and see what each tool would do.
– Two things to watch out for 
  1. atom typing is required (not sure why)
  2. kekulizeAromaticRings() returns the structure and the input is not modified.
– If you’re using 1.4 instead of 1.5 IteratingSDFReader is named IteratingMDLReader

String input = “/Users/johnmay/Desktop/bo.sdf”;
String output = “/Users/johnmay/Desktop/bo-kekule.sdf”; 
IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
IteratingSDFReader sdfr = new IteratingSDFReader(new FileReader(input),
SDFWriter sdfw = new SDFWriter(new FileWriter(output)); 
FixBondOrdersTool fbot = new FixBondOrdersTool();
while (sdfr.hasNext()) {
IAtomContainer container =;
container = fbot.kekuliseAromaticRings(container);
or Cancel

Your answer

You need to join Blue Obelisk eXchange to complete this action, click here to do so.