Hi Mark,

further to Fio's reply, I think the confusion stems from the fact that when
you call AddHs() after MolFromSmiles() no coordinates are actually
generated; these are only generated on the fly for visualization, and hence
are correct before and after AddHs(), as the layout is always generated
on-the-fly from scratch, rather than incrementally.
Instead, when you explicitly call rdCoordGen.AddCoords() (or
rdDepictor.Compute2DCoords()) a conformation is actually added, thus
allowing incremental addition of coordinates when you call AddHs().

I hope this gist clarifies the above:
https://gist.github.com/ptosco/1c7c83017cd1a3d8aa64fe336ae3c1f8

Cheers,
p.

On Thu, Aug 27, 2020 at 8:25 PM Mark Mackey <m...@cresset-group.com> wrote:

> Hi all,
>
>
>
> I’m trying to generate a 2D layout with sensible locations for hydrogens,
> and am struggling a bit. If I start from SMILES:
>
>
>
> m=Chem.MolFromSmiles('Nc1nnc2n1CCS2')
>
> m2=rdmolops.AddHs(m, False, True);
>
>
>
> Then m2 has perfectly sensible 2D cords for the hydrogens. If I use
> addCoords=False here then the hydrogens are all at the origin, which is
> more-or-less expected.
>
>
>
> If, however, I generate new 2D coords for the heavy atoms with CoordGen:
>
>
>
> m=Chem.MolFromSmiles('Nc1nnc2n1CCS2')
>
> Chem.rdCoordGen.AddCoords(m)
>
> m2=rdmolops.AddHs(m, False, True);
>
>
>
> then the 2D coords for the hydrogens are poor on the 5-membered ring, and
> the two hydrogens on the NH2 are superimposed.
>
>
>
> (In practise I’m starting from a 3D SDF and trying to generate 2D coords
> for it, hence the need for CoordGen).
>
>
>
> What am I doing wrong?
>
>
>
> Regards,
>
> Mark
>
>
>
> *-- *
>
> *Mark Mackey*
>
> *Chief Scientific Officer*
>
> *Cresset*
>
> New Cambridge House, Bassingbourn Road, Litlington, Cambridgeshire, SG8
> 0SS, UK
>
> tel: +44 (0)1223 858890    mobile: +44 (0)7595 099165    fax: +44 (0)1223
> 853667
>
> email: *m...@cresset-group.com <m...@cresset-group.com>*    web:
> www.cresset-group.com    skype: mark_cresset
>
>
> _______________________________________________
> 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