When running the code below the following error is thrown:
"Only supported is writing of ChemFile, MoleculeSet, AtomContainer and Molecule objects."
mwrings = new MDLWriter(new FileWriter(this.outputDir + File.separatorChar + "allRingSystems.sdf"));
List <IRingSet> rings = gf.getRingFragments();
for (int i =0;i<rings.size();i++){
IAtomContainer ringw = RingPartitioner.convertToAtomContainer(rings.get(i));
mwrings.write(ringw);
}
Two patches attached. One adding a general unit test that tests that accepted IChemObjects indeed can be written by write(). The second patch fixes the SDFWriter to also allow writing IAtomContainer and IAtomContainerSet as accepts() actually promises.
Unit test for accepts()/write() consistency. To be applied to cdk-1.2.x with 'git am'.
Patch fixing the accepts()/write() inconsistency.
One senior reviewer needed.
Applied to cdk-1.2.x on github