Hi, I found a pretty annoying behavior with the protonation, which uncovers an underlying issue with the chemical perception.
The easiest way to reproduce this is to add hydrogens to the ammonium molecule
in XYZ format:
obabel ammonium.xyz -ph 7 -O ammonium_xyz.mol2
In the generated file, the nitrogen will have 4 hydrogens, 5 total bonds, and atom type
"N.3" (wrong).
If the molecule is converted to Mol2 first, then protons added:
obabel ammonium.xyz -O ammonium_xyz_step1.mol2
obabel ammonium_xyz_step1.mol2 -ph 7 -O ammonium_xyz_step2.mol2
the nitrogen will have 3 hydrogens, 4 bonds, and atom type "N.4" in both Mol2
files (correct). Also, in the second file the charge is correctly set to +1. Identical
behavior is found when doing the same through Python.
This totally unexpected because the valence is properly perceived every single
function I've tried (GetExplicitValence(), ExplicitDegree(), GetTotalDegree(),
GetTotalValence()), which return the correct value (4).
The expected behavior would be either to remove the extra proton, or to update
the atom and molecule formal charge, but definitely not to generate a nitrogen
with 5 connections.
Interestingly, when parsing the OB atom type of the nitrogen is set to "N3+",
so at some point in the chemical perception, this is detected correctly. Yet, if there's
an easy way to fix this I couldn't find it.
This seems like a bug to me.
Any advice?
Thanks,
S
--
Stefano Forli, PhD
Associate Professor
Dept. of Integrative Structural
and Computational Biology, MB-112A
Scripps Research
10550 North Torrey Pines Road
La Jolla, CA 92037-1000, USA.
tel: +1 (858)784-2055
email: fo...@scripps.edu
https://forlilab.org
ammonium.xyz
Description: Xmol XYZ data
_______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
