openmm / pdbfixer

PDBFixer fixes problems in PDB files
Other
461 stars 115 forks source link

Wrong placement of added hydrogens. #179

Open niko97320 opened 5 years ago

niko97320 commented 5 years ago

Dear all,

I have noticed a problem when adding hydrogens to a structure resolved in Xray and pre-processed with Maestro. Sadly I cannot share the details of the structure but here is a snapshot of one of the many misplaced hydrogen atoms.

pb_h_pdbfixer

The code which leads to the aforementioned artefact is as follows :

from pdbfixer import PDBFixer
from simtk.openmm.app import PDBFile
from simtk.unit import *
from simtk.openmm.vec3 import Vec3

inpPdb = 'XXX.pdb'

fileName  = inpPdb.split('.')[0]
extension = inpPdb.split('.')[-1]

fixer = PDBFixer(filename=inpPdb)
fixer.findMissingResidues()
fixer.findNonstandardResidues()
fixer.replaceNonstandardResidues()
fixer.findMissingAtoms()
fixer.addMissingAtoms()
fixer.addMissingHydrogens(7.4)
PDBFile.writeFile(fixer.topology, fixer.positions, open(str(fileName)+"_vac."+str(extension), 'w'))

Hope this helps, cheers NM

nitroamos commented 5 years ago

A user of my tool reported this problem to me, too, in his case from Arginine, which I haven't bothered trying to resolve with PDBFixer.

peastman commented 5 years ago

Adding hydrogens is done in two steps. First, it just sticks the hydrogens at mostly random positions, not worrying about whether they're realistic. Then it runs a local energy minimization to move them into more reasonable positions. In your case, it looks like the local energy minimization is failing. I can't tell why without access to your file. Usually it means there's some piece of the system that's producing huge forces, a severe clash between atoms or something like that, that causes the minimizer to give up without doing anything.

peastman commented 5 years ago

If you're using OpenMM 7.2.2, you might try installing the beta of 7.3. It includes a change to make the minimizer a bit more robust in the presence of very large forces.

nitroamos commented 5 years ago

In my case, I think I'm using post-7.2.2, although I haven't updated since July I think. According to conda list, I'm using

openmm                    7.3.2                    py36_0    omnia/label/dev

However, if I dig into site-packages, my version.py says full_version = '7.2.1.dev-f9106dd' so unless version.py is only regenerated for official releases maybe I'm not sure what I've got.

peastman commented 5 years ago

If you updated in July you have the changes to LocalEnergyMinimizer. They were made longer ago than that.

niko97320 commented 5 years ago

Hi all !

Thank you for you answers. I will try to install the beta version. Is it the one on the GitHub? I couldn't find the version.

I should also report that the hydrogens already present in my input PDB files are either removed and added back by openMM or are somehow minimized since they have moved. It is particularly harmful in my case where I have crystallographic water that I wish to keep still.

Nevertheless, I don't know if similarly to what opennMM.Modeller it should keep the already described hydrogens.

peastman commented 5 years ago

You can install the beta with

conda install -c omnia/label/beta openmm

Give that a try.

niko97320 commented 5 years ago

It seems that the 7.3 solves most of the problems indeed ! However the hydrogens of several water molecules have moved compared to the input PDB, probably because of the minimization steps. Would it be feasible to keep them restrained? It would be nice to have an output somewhere mentioning the minimization of the hydrogens crashed though.

peastman commented 5 years ago

It seems that the 7.3 solves most of the problems indeed !

Great!

However the hydrogens of several water molecules have moved compared to the input PDB, probably because of the minimization steps. Would it be feasible to keep them restrained?

Good idea. Currently it performs minimization of all hydrogens. It would be better to only minimize the ones that have just been added. I'll mark this issue as a feature request to track that.