Hi,
I'm working with molecules containing ketones and unsaturated bonds.
When using OpenBabel with Python to add hydrogens with pH correction, the code generates
carbons with 5 bonds.
Attached there is an example with a small fragment that triggers it.
The procedure to protonate structures (unset flags, set charges, etc...) comes from
Avogadro, and I've used it a lot in the past with no major issues.
If mol.SetAutomaticFormalCharge(True) is disabled, the problem does not appear, but the pH
correction is not applied.
Is this a bug? It looks so to me.
Thanks,
S
--
Stefano Forli, PhD
Assistant Professor of ISCB
Molecular Graphics Laboratory
Dept. of Integrative Structural
and Computational Biology, MB-112A
The Scripps Research Institute
10550 North Torrey Pines Road
La Jolla, CA 92037-1000, USA.
tel: +1 (858)784-2055
fax: +1 (858)784-2860
email: fo...@scripps.edu
http://www.scripps.edu/~forli/
import openbabel as ob
smi='O=C(CC(N)CC/1=O)C1=C(CC)/O'
conv = ob.OBConversion()
conv.SetInAndOutFormats('smi', 'smi')
mol = ob.OBMol()
conv.ReadString(mol, smi)
builder = ob.OBBuilder()
print "INPUT ", conv.WriteString(mol).strip()
builder.Build(mol)
conv.WriteString(mol).strip()
mol.UnsetFlag(ob.OB_PH_CORRECTED_MOL)
print "UNSETFLAG ", conv.WriteString(mol).strip()
for a in ob.OBMolAtomIter(mol):
a.SetFormalCharge(0)
print "ATOM FORMAL " , conv.WriteString(mol).strip()
mol.SetAutomaticFormalCharge(True)
print "AUTOFORMAL ", conv.WriteString(mol).strip()
mol.AddHydrogens(False, True, 7.4)
print "ADDHYDRO (pH) ", conv.WriteString(mol).strip()
------------------------------------------------------------------------------
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel