[Rdkit-discuss] changing atomic charges with ReactionFromSmarts
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Jan H. J. <jhj...@ch...> - 2018-01-25 13:51:34
|
The following code changes the bond order correctly but does not change the charges accordingly Any idea what I am doing wrong? Thanks, Jan def clean_charges(mol): rxn_smarts = ['[N+:1]=[*:2]-[O-:3]>>[N:1]-[*:2]=[O:3]'] for smarts in rxn_smarts: rxn = AllChem.ReactionFromSmarts(smarts) ps = rxn.RunReactants((mol,)) for x in ps: mol = x[0] #rdmolops.SanitizeMol(mol) return mol mol = Chem.MolFromSmiles("C[NH+]=C(C)[O-]") mol = clean_charges(mol) print Chem.MolToSmiles(mol) |