Hi,

On Fri, Jan 2, 2015 at 3:07 PM, Laetitia Bomble <[email protected]>
wrote:

>
> I would like to generate conformers from the following smiles: [O-]CC[N+].
> My code is te following:
> >    ROMol *mol=SmilesToMol([O-]CC[N+);
> >    ROMol *mols;
> >    mols=addHs(*mol,false,false);
>
> When I write the conformers generated there are no Hs on the nitrogen
> instead of three. If I write explicitly [O-]CC[NH3+], it is fine. Is this
> normal?
>

Yes, this is the expected behavior. It is part of how SMILES works: when
you provide an atom in square brackets in SMILES, you must explicitly
specify the number of Hs that atom has. So when you provide "[N+]" as a
SMILES, you are saying that the N has zero connected Hs.

If you want to be able to use SMILES to provide charges without providing H
counts, you could try reading the molecule from SMILES without
sanitization, calling atom.setNoImplicit(false) on each atom, and then
sanitizing. This is somewhat fragile, but may provide at least the start of
a workaround.
Here's a little demo of that from python:

# the default behavior
In [21]: m = Chem.MolFromSmiles('[O-]C[N+]')

In [22]: for a in m.GetAtoms():
   ....:         print(a.GetSymbol()," ",a.GetTotalNumHs())
   ....:
O   0
C   2
N   0

# forcing the H calculation:
In [23]: m = Chem.MolFromSmiles('[O-]C[N+]',sanitize=False)

In [24]: for a in m.GetAtoms():
   ....:         a.SetNoImplicit(False)
   ....:

In [25]: Chem.SanitizeMol(m)
Out[25]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE

In [26]: for a in m.GetAtoms():
   ....:         print(a.GetSymbol()," ",a.GetTotalNumHs())
   ....:
O   0
C   2
N   3



-greg
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to