Hi,

I've been using RDkit to draw png files successfully until recently I found some molecules that it seems to struggle with. I was hoping you could shed some light on this:

import Chem
from Chem import Draw
mol = Chem.MolFromSmiles(r'O=C/C=C/c1ccccc1')
Draw.MolToImageFile(mol, 'test.png')

Traceback (most recent call last):
 File "<pyshell#9>", line 1, in <module>
   Draw.MolToImageFile(mol, 'test.png')
 File "C:\rdkit\Python\Chem\Draw\__init__.py", line 48, in MolToImageFile
   img = MolToImage(mol,size=size,kekulize=kekulize,wedgeBonds=wedgeBonds)
 File "C:\rdkit\Python\Chem\Draw\__init__.py", line 39, in MolToImage
   AllChem.Compute2DCoords(mol)
RuntimeError: Pre-condition Violation

Draw.MolToImageFile(mol, 'test.png', kekulize=False)

It appears that its the kekulizing that causes it to fail, but I can't really see why. Maybe this should be filed as a bug?

Thanks,

Peter

Reply via email to