I think the problem here is in the ph model since the problem doesn't
happen if you omit the ph specification. Passing a pH causes
AddHydrogens to be called with correctForPH set to true, which is not
the default. That is, it's not that there is a default pH that is used,
but the default is to not try to account for pH at all.
The line in phmodel.txt that is applying the charge to the nitrogen is
this one:
TRANSFORM [N^3;!$(N~[!#6;!#1]):1] >> [N+:1] 10.0 # pKa from
conjugated acid (BH+)
The ^3 is requiring the N have hybridization 3. Probably this rule is
overly broad, but I lack the expertise to correct it.
David Koes
Associate Professor
Computational & Systems Biology
University of Pittsburgh
On 5/14/21 5:44 PM, Stefano Forli wrote:
Hi all,
I agree about the impractical task of fixing the task in more than a
handful of files.
Besides, there's an intrinsic problem with fully supported file formats
that do not have such information.
@David Koes: A week ago I posted about this issue: if you try reading a
perfectly valid XYZ file (which has no charges) of ammonium with this
command, you end up with a nitrogen with 5 bonds:
obabel ammonium.xyz -ph 7 -O ammonium_xyz.mol2
@David van der Spoel: one thing I've noticed is that charged systems get
properly recognized if you perform an intermediate conversion before
manipulating the molecule. For the above issue, for example, it
generates the proper protonated nitrogen:
obabel ammonium.xyz -O ammonium_xyz_step1.mol2
obabel ammonium_xyz_step1.mol2 -ph 7 -O ammonium_xyz_step2.mol2
I've tried to figure out where the formal charge perception happens, but
without success. Possibly doing so before the bond perception might help
fixing your problem without having to extend the bondtyp.txt file? (but
definitely not if the SMARTS pattern is missing).
S
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel