I have the following molecule in SMILE format (saved as my_molecule.smi):


I created an image using ChemAxon Marvin's molconvert command:

MarvinSuite/bin/molconvert "jpeg:w800:h800" my_molecule.smi -o mol.jpg

It produces the following image:

enter image description here

Then I use RDKit, with the following code:

from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
m = Chem.MolFromSmiles('[H]N[C@@H](CCCCN)C(=O)N[C@@H](CCCCN)C(=O)N[C@@H](C)C(=O)N[C@@H](CC1=CNC2=C1C=CC=C2)C(O)=O')

I get this image:

enter image description here

Notice that it is circular, and missing an H3C. With RDKit, how can I create the identical image with the one made by molconvert? i.e. straight format and H3C included.

Python code can be tried in my Google Colab.

  • 1
    $\begingroup$ I'm not sure why you care about a linear format. Is there actually a reason you want that? $\endgroup$ Commented Oct 28, 2021 at 4:05
  • 1
    $\begingroup$ If you happen to speak JavaScript, SmilesDrawer might be an option for you, too. $\endgroup$
    – Buttonwood
    Commented Oct 31, 2021 at 15:45

1 Answer 1


You're not going to get something identical. Different toolkits use different code to do 2D molecule layout. Generally the current RDKit code (which uses the CoordGen library) tends to prefer geometries closer to square, which is useful when drawing a bunch of molecules in a grid.

In short, I don't think there's anything you can do if you prefer an extended form and want RDKit to generate that.

Adding explicit methyl groups is pretty easy with recent RDKit (2020.03 and later), which adds new drawing options, e.g.

from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit.Chem import rdDepictor
from rdkit.Chem.Draw import IPythonConsole
from IPython.display import SVG

m = Chem.MolFromSmiles('[H]N[C@@H](CCCCN)C(=O)N[C@@H](CCCCN)C(=O)N[C@@H](C)C(=O)N[C@@H](CC1=CNC2=C1C=CC=C2)C(O)=O')

d2d = rdMolDraw2D.MolDraw2DSVG(350,300)
d2d.drawOptions().explicitMethyl =True

The options are documented for the rdMolDraw2D module


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .