Hello,
Please tell me if you understand why the code below
is not working and if you know how to change it so that it does.
Thanks a lot! :)
F.
---
#!/usr/bin/env python3
# try to construct a molecule with a Z stereo double bond using RWMol
import rdkit
from rdkit import Chem
wanted_smi = 'C/N=C\\S'
rwmol = Chem.RWMol()
# create the atoms
a0 = Chem.Atom(6)
a1 = Chem.Atom(7)
a2 = Chem.Atom(6)
a3 = Chem.Atom(16)
# add the atoms
rwmol.AddAtom(a0)
rwmol.AddAtom(a1)
rwmol.AddAtom(a2)
rwmol.AddAtom(a3)
# add the bonds
rwmol.AddBond(0, 1, rdkit.Chem.rdchem.BondType.SINGLE)
rwmol.AddBond(1, 2, rdkit.Chem.rdchem.BondType.DOUBLE)
rwmol.AddBond(2, 3, rdkit.Chem.rdchem.BondType.SINGLE)
# let's see what we have so far
print(Chem.MolToSmiles(rwmol)) # --> 'CN=CS'; so far so good
# try to specify a Z stereo bond
db = rwmol.GetBondWithIdx(1)
assert(db.GetBondType() == rdkit.Chem.rdchem.BondType.DOUBLE) # just
checking
db.SetStereo(rdkit.Chem.rdchem.BondStereo.STEREOZ)
db.SetStereoAtoms(0, 3)
# let's see what we have now
print(Chem.MolToSmiles(rwmol)) # --> 'CN=CS'; not good enough
Chem.SanitizeMol(rwmol) # just checking
print(Chem.MolToSmiles(rwmol)) # --> 'CN=CS'; not getting better
---
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss