protocaller / ProtoCaller

Full automation of relative protein-ligand binding free energy calculations in GROMACS
http://protocaller.readthedocs.io
GNU General Public License v3.0
42 stars 15 forks source link

Explicit valence for atom # 37 C greater than permitted #35

Closed kexul closed 3 years ago

kexul commented 3 years ago

Hi, I'm parametrising CHEMBL3127463 by ProtoCaller with the following code:

lig = Ligand('CC(C)CC(=O)Nc1cc(-c2ccc(C(N)=O)cc2C(=O)O)cc(C2CC(C)(c3ccccc3)c3cc(C(=N)N)ccc3N2)c1', protonated=False, minimise=True)
lig.protonate()
lig.parametrise()

which threw an error:

  File "/data/FEP/prepare/ProtoCaller/Ensemble/Ligand.py", line 183, in protonate
    molecule = _rdkit.AssignBondOrdersFromTemplate(self.molecule, molecule, assign_charge=False)
  File "/data/FEP/prepare/ProtoCaller/Wrappers/rdkitwrapper.py", line 296, in AssignBondOrdersFromTemplate
    _Chem.SanitizeMol(mol)
rdkit.Chem.rdchem.AtomValenceException: Explicit valence for atom # 37 C greater than permitte
kexul commented 3 years ago

After protonated by openbabel, the C turned to C+, which might not be correct. Before: 企业微信截图_16178533771303 After: 企业微信截图_1617853400946

kexul commented 3 years ago

After some digging, I found that Dimorphite-DL may be a good alternative to openbabel , which provide a reasonable protonated result.
image

msuruzhon commented 3 years ago

It does seem that this issue is related to Open Babel, it would be worth reproducing it outside of ProtoCaller in the newest Open Babel version and if the problem still persists, you should probably submit an issue there.

In any case, I added some basic (experimental!) checks to spot unphysical charges and fix them, so your example should work now. I pushed the update to the development branch, so you can get the update when the conda package is built.

Edit: Dimorphite-DL seems interesting, I will consider adding it to ProtoCaller.

kexul commented 3 years ago

Reproduced with the newest version of openbabel, I'll file an issue there.

As always, thanks for your work!

kexul commented 3 years ago

Hi @msuruzhon , use latest version of openbabel from conda should fix this, see https://github.com/openbabel/openbabel/issues/2353