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 <http://www.wojtekplonka.com>
fb.com/wojtek.plonka
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to