TinkerTools / poltype2

Poltype 2: Automated Parameterization and Free Energy Prediction for AMOEBA
Other
41 stars 11 forks source link

H atoms are added to _-poleditin.txt despite "addhydrogentocharged=False" #32

Closed jacekkozuch closed 1 year ago

jacekkozuch commented 1 year ago

Hi,

I'm having issues right before the ESP calculation when the -poleditin.txt is used in poledit. Despite using "addhydrogentocharged=False", -poleditin.txt contains 4 more atoms (I suppose H atoms for charged atoms), which makes poltype crash. I'm not sure if this has anything to do with the "userconformation=True" and "generateextendedconf=False". I'm using both because I do not want poltype to change the dihedral around the amide bond and the oxime double bond. Attached find a zip with the SDF and poltype.in.

Thanks in advance for looking into this one!

Best, Jacek

CTX.zip

jacekkozuch commented 1 year ago

Dear Chengwen,

I got your email, but can find your message here, not sure what is going on.

Anyways, regarding your question:

Hi Jacek, before we look at into the potential issue, can you resolve the inconsistency of total charge between your sdf file and >poltype.ini file? in sdf: M CHG 2 42 1 7 -1 in poltype.ini totalcharge=0

So, I ran the calculation several times without specifying "M CHG ...". However, when the MOL file is created a "M CHG ..." appears. In this particular case, it even was M CHG 4 ..., since this molecules is a zwitter ion. Since 4 additional H atoms were added to the poleditin.txt, I played around with the initial "M CHG ...".

Long story short: I have the same problem, when setting "totalcharge = 0" and not adding any "M CHG ...".

Also to stress this once more: This molecule is a zwitter ion with "-1" on the COO group and "+1" around atom 42.

Thx!

leucinw commented 1 year ago

Hi Jacek, the message I sent previously was not intended since the total charge was actually correct in both files. Never mind, I have pushed a fix for this issue you encountered. Simply, the pybel module poltype used in the previous version is not robust and it was trying to add two hydrogens on your zwitter-ion molecule. In the latest commit, I replaced pybel with rdkit, and I can see it behaves as expected. Thank you for identifying these rare cases so we can improve poltype.

jacekkozuch commented 1 year ago

Thx for the quick fix. A new issue appears: the file poleditin.txt is empty except for specifying A for AMOEBA:

A

The error in poltype.log is:

Tue Jul 11 17:53:38 2023 Gaussian Distributed Multipole Analysis (GDMA) Tue Jul 11 17:53:39 2023 Submitting: /home/jkozuch/gdma/bin/gdma < CTX.gdmain > CTX.gdmaout path = >/scratch/jkozuch/Param/CTX/Temp Tue Jul 11 17:53:40 2023 Local Frame Symmetry Detection Tue Jul 11 17:53:41 2023 Define Polarization Groups and Polarization Parameters Tue Jul 11 17:53:41 2023 Traceback (most recent call last): File "/home/jkozuch/poltype2_bugfix/PoltypeModules/poltype.py", line 8038, in RunPoltype poltype.main() File "/home/jkozuch/poltype2_bugfix/PoltypeModules/poltype.py", line 3610, in main params= self.GenerateParameters() File "/home/jkozuch/poltype2_bugfix/PoltypeModules/poltype.py", line 4788, in GenerateParameters lfzerox=mpole.gen_peditinfile(self,mol,polarindextopolarizeprm) File "/home/jkozuch/poltype2_bugfix/PoltypeModules/multipole.py", line 527, in gen_peditinfile atoms = range(1, len(mol.GetAtoms()) + 1) AttributeError: 'NoneType' object has no attribute 'GetAtoms'

leucinw commented 1 year ago

This looks strange to me because my test run finishes correctly. The error simply means rdkit could not read your sdf file. I have no idea why that happens but I pushed an improvement to rename mol to rdkitmol to avoid confusion in multipole.py.

jacekkozuch commented 1 year ago

Now it works, thanks a lot. However, I had to specify

M CHG 4 5 1 6 -1 7 -1 42 1

in my initial SDF file. However, I must say that this might be a special case together with the keywords below, since I thought that poltype should find itself where to put charges, right?

addhydrogentocharged=False generateextendedconf=False userconformation=True

Thx!