The 3D structure of the first molecule looks fine to me:
https://colab.research.google.com/drive/1V-KkS4tMfbD5UNIs5tyQewZnYtq7yQ7i?usp=sharing

What version of RDKit are you using?

On 12 Jul 2020, at 07.00, Wojtek Plonka 
<plon...@plonkaw.com<mailto:plon...@plonkaw.com>> wrote:

Dear Greg, All,

(I tried sending the message some time ago, but I think it did not go through)

I'm trying to convert some molecules which I have as SMILES strings only to 3D.
I use a methodology similar to the below script, except this example saves to 
SDF at different stages of conversion for test purposes.

What happens is that I get very bad 3D structures, CH3 groups with insane 
geometry, crazy bond lengths between heavy atoms for some molecules, even as 
the EmbedMolecule and MMFFOptimizeMolecule report success. The problems seem to 
be gone when I remove the chirality data from SMILES (as far as little I 
understand and like SMILES at all:) ) The script has 3 molecules to process, 
I'd greatly appreciate it if any of you could take a look at the SDF with any 
3D molecule viewer file it produces. The first and second one are processed, 
the third fails, but this is OK. The problem is the geometry I get for the 
first molecule.

Any suggestions what I might be doing wrong?

I tried playing with parameters of EmbedMolecule and MMFFOptimizeMolecule, also 
using UFF optimization, no success. I can fix my molecules by running MM3 
calculations in external software, but I'd love to avoid that.

Here is the code:

from rdkit import Chem
from rdkit.Chem import AllChem


myuglymols = [
            
'C[C@@]12OC(=O)[C@]3(O)CC[C@H]4[C@@H](C[C@@H](O)[C@@]5(O)CC=CC(=O)[C@]45C)[C@@]45O[C@@]13[C@@H](C4=O)[C@]1(C)C[C@H]2OC(=O)[C@@H]1CO5',
            
'C[C]12OC(=O)[C]3(O)CC[CH]4[CH](C[CH](O)[C]5(O)CC=CC(=O)[C]45C)[C]45O[C]13[CH](C4=O)[C]1(C)C[CH]2OC(=O)[CH]1CO5',
            
'CC1=CC(=O)[C@@H](O)[C@]2(C)[C@H]3[C@]4(O)OC[C@@]33[C@@H](C[C@@H]12)OC(=O)C[C@H]3C(=C)[C@H]4O'
            ]

w = Chem.SDWriter('uglymols.sdf')

for smiles in myuglymols:
    m = Chem.MolFromSmiles(smiles)
    if (m):
        mold = m
        m.SetProp('State','MolFromSmiles')
        w.write(m)
        Chem.SanitizeMol(m)
        m.SetProp('State','SanitizeMol')
        w.write(m)
        try:
            print (smiles)
            m= Chem.AddHs(m)
            # 
print(AllChem.EmbedMolecule(m,randomSeed=42,useRandomCoords=True,useSmallRingTorsions=True,
 useMacrocycleTorsions=True))
            print(AllChem.EmbedMolecule(m))
            m.SetProp('State','SanitizeMol')
            w.write(m)
            opt = 
AllChem.MMFFOptimizeMolecule(m,maxIters=10000,ignoreInterfragInteractions=False,mmffVariant='MMFF94')
            m.SetProp('State','MMFFOptimizeMolecule')
            m.SetProp('Optimized',str(1-opt))
            w.write(m)
            print(opt)
        except Exception as e:
            print ('Failed')
            m = mold
            m.SetProp('Optimized','Error')
            w.write(m)
w.flush()
w.close()

Thank you very much!

Wojtek Plonka
+48885756652
wojtekplonka.com<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.wojtekplonka.com%2F&data=02%7C01%7Cjhjensen%40chem.ku.dk%7Cc9707731a2bb4cbe0cb908d826288afa%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637301302871312100&sdata=wqIefe2q8aJZjp4DHjHwAxgVPZuJT%2F9C275sYbdvOJU%3D&reserved=0>
fb.com/wojtek.plonka<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffb.com%2Fwojtek.plonka&data=02%7C01%7Cjhjensen%40chem.ku.dk%7Cc9707731a2bb4cbe0cb908d826288afa%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637301302871312100&sdata=0JJKbq4i%2FytGSx%2Bui6aUfdrheILCwJKOSPxTLRGXat4%3D&reserved=0>

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Frdkit-discuss&amp;data=02%7C01%7Cjhjensen%40chem.ku.dk%7Cc9707731a2bb4cbe0cb908d826288afa%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637301302871342085&amp;sdata=blIHAuotiLkpcDk8h6kZGCA%2B78ffGzPOfobpZ%2BQXtPQ%3D&amp;reserved=0

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

Reply via email to