Hi Zhang,

this looks like a bug triggered by molecules whose Y size is very small, such as all molecules which are constituted by a single, horizontal bond:

https://github.com/rdkit/rdkit/issues/2762

Cheers,
p.


On 11/04/19 07:14, Shengde wrote:
Hi,

    I try to draw molecules in a grid and use the  following code.
    Usually it works good. Howerver, when I try to draw some molecules
    with single atom like "Cl", I got a *blank figure* with nothing on
    it. As long as I add a more complex molecule to the smi_list like
    ["*Cl","*CC"], I got what I want again. Why can't I draw only
    single atom molecules in a figure ? My rdkit version is *2019.03.2.*


from rdkit import Chem
from rdkit.Chem import Draw
import math
from IPython.display import SVG

smi_list = ["*Cl"]
mols = [Chem.MolFromSmiles(smi) for smi in smi_list]
sub_size = [250,250]
mols_num = len(mols)
columns_num = 5
rows_num = math.ceil(mols_num/5)
grid = [columns_num,rows_num]
d = Draw.rdMolDraw2D.MolDraw2DSVG(grid[0]*sub_size[0],grid[1]*sub_size[1], sub_size[0],sub_size[1])
opt = d.drawOptions()
opt.legendFontSize=20
d.SetFontSize(1.3*d.FontSize())
d.SetLineWidth(1)
d.DrawMolecules(mols,
                highlightAtoms=None,
                highlightBonds=None,
                highlightAtomColors=None,
                highlightBondColors=None,
                legends=None)
d.FinishDrawing()
SVG(d.GetDrawingText())


Thank you for your help!

Best regards,
Shengde, Zhang




_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to