openmm / pdbfixer

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

ZeroDivisionError: float division by zero #161

Closed nitroamos closed 6 years ago

nitroamos commented 6 years ago

I grabbed 1oyt and tried it with "random parameters" in the webapp and it failed after just a few seconds. I was running on a current git clone. When I visited the page later, it did have a pdb for me to download:

output (1).pdb.txt

Here's the stacktrace I saw in the console:

  File "/Users/andera52/anaconda/lib/python3.6/site-packages/pdbfixer-1.5-py3.6.egg/pdbfixer/ui.py", line 137, in addHydrogensPageCallback
    fixer.addMembrane(lipidType, 0*unit.nanometer, padding, positiveIon, negativeIon, ionicStrength)
  File "/Users/andera52/anaconda/lib/python3.6/site-packages/pdbfixer-1.5-py3.6.egg/pdbfixer/pdbfixer.py", line 1089, in addMembrane
    modeller.addMembrane(forcefield, lipidType=lipidType, minimumPadding=minimumPadding, positiveIon=positiveIon, negativeIon=negativeIon, ionicStrength=ionicStrength)
  File "/Users/andera52/anaconda/lib/python3.6/site-packages/simtk/openmm/app/modeller.py", line 1269, in addMembrane
    proteinCells = _CellList(proteinPos, overlapCutoff, vectors, False)
  File "/Users/andera52/anaconda/lib/python3.6/site-packages/simtk/openmm/app/modeller.py", line 1447, in __init__
    invBox = Vec3(1.0/vectors[0][0], 1.0/vectors[1][1], 1.0/vectors[2][2])
ZeroDivisionError: float division by zero

I don't know how to interpret the stacktrace, but Modeller is not installed on my laptop unless it came along when I installed using:

conda install -c conda-forge -c omnia openmm

peastman commented 6 years ago

What sort of "random parameters" did you use? Can you provide instructions on how to reproduce this?

nitroamos commented 6 years ago

I tried a couple things but haven't been able to reproduce that exception. I'm pretty sure I used default values everywhere except chain selection and that I checked "add membrane and water". I'll try a couple more things.

I did find a different exception, so I'll report that here: 1oyt from RCSB Kept first L, and last H, I from chains: L, H, I, H, L, H, I Keep all heterogens

Add hydrogens: yes, ph 7 (default values) Add membrane and water: yes (default values)

  File "/Users/andera52/anaconda/lib/python3.6/site-packages/pdbfixer-1.5-py3.6.egg/pdbfixer/ui.py", line 137, in addHydrogensPageCallback
    fixer.addMembrane(lipidType, 0*unit.nanometer, padding, positiveIon, negativeIon, ionicStrength)
  File "/Users/andera52/anaconda/lib/python3.6/site-packages/pdbfixer-1.5-py3.6.egg/pdbfixer/pdbfixer.py", line 1089, in addMembrane
    modeller.addMembrane(forcefield, lipidType=lipidType, minimumPadding=minimumPadding, positiveIon=positiveIon, negativeIon=negativeIon, ionicStrength=ionicStrength)
  File "/Users/andera52/anaconda/lib/python3.6/site-packages/simtk/openmm/app/modeller.py", line 1366, in addMembrane
    integrator.step(20)
  File "/Users/andera52/anaconda/lib/python3.6/site-packages/simtk/openmm/openmm.py", line 14924, in step
    return _openmm.LangevinIntegrator_step(self, steps)
Exception: Particle coordinate is nan
nitroamos commented 6 years ago

Ah, I found the original exception. The first L, and all 3 HOH chains, add water and membrane, everything else used default values.

peastman commented 6 years ago

Thanks, I managed to reproduce it. I'll let you know what I find.

peastman commented 6 years ago

I found the cause of the divide by zero. It's very easy to fix. I'm looking into the nan coordinate now.

peastman commented 6 years ago

I've been spending a lot of time trying to figure out why you're getting the NaN. I've come to the conclusion that it's just from using options that don't make sense. You're applying it in a way that violates the assumptions of the algorithm.

You deleted the main protein (chain H) and kept only a short peptide (chain L). But you also kept about 400 existing water molecules. So the thing you're asking it to embed in the membrane is not at all compact. It mostly consists of water, plus a short peptide, with a big hole in the middle where the main protein would go. If you only include the peptide, no water, it works correctly. If you include the main protein, that also works correctly (including with the water). Either of those is a compact set of atoms. It's the non-compact system with a large hole in the middle that confuses it.

nitroamos commented 6 years ago

I'm not surprised that the options I picked could cause problems, I was just playing around with it. I've been tasked with developing a tool for my end users to clean up their pdbs and I'm sure the way they'll use it will be much more scientifically reasonable. :-)

peastman commented 6 years ago

Ok, I think we're in good shape then. I just posted a pull request with the fix for the division by zero: https://github.com/pandegroup/openmm/pull/2038

peastman commented 6 years ago

The fix is now merged.