Hi all,

I am trying to convert ionic salts into their covalent forms. I devised a
reaction transformation to do this, but am running into problems getting to
work correctly.
e.g.   C([O-])([O-])=O.[Na+].[Na+]   -->  C([O][Na])([O][Na])=O
         [Cl-].[Li+].C(C)(C)[Mg]Cl    -->    [Cl][Li].C(C)(C)[Mg]Cl

If I feed the disconnected form of NaHCO3 into the code below, it works
okay. However once I go to a salt with more than two disconnected
components (like Na2CO3), only the first bond is formed and the other
sodium ion vanishes.
Similarly if there are other neutral fragments in the input (see mol2 in
the code), those fragments also vaish when I run the reaction.

I think I must be missing something in my reaction SMARTS. Anyone have some
pointers for me?

Many thanks!


from rdkit import Chem
from rdkit.Chem import AllChem

mol1 = Chem.MolFromSmiles("C([O-])([O-])=O.[Na+].[Na+]")
mol2 = Chem.MolFromSmiles("[Cl-].[Li+].C(C)(C)[Mg]Cl")
rxn =
AllChem.ReactionFromSmarts('([N,Na,K,Li,Cs,Mg;+,++:1].[H,F,Cl,Br,I,B,C,c,O,N,n;-:2])>>[*+0:1]-[*+0:2]')

prods = rxn.RunReactants((mol1,))
for prod in prods:
print(Chem.MolToSmiles(prod[0]))

prods = rxn.RunReactants((mol2,))
for prod in prods:
print(Chem.MolToSmiles(prod[0]))

Output:
O=C([O-])O[Na]
O=C([O-])O[Na]
O=C([O-])O[Na]
O=C([O-])O[Na]
[Li]Cl
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to