insilichem / ommprotocol

A command line application to launch molecular dynamics simulations with OpenMM
http://ommprotocol.readthedocs.io
GNU Lesser General Public License v3.0
39 stars 8 forks source link

ValueError: Illegal value for nonbonded method #18

Closed thewhovianwho closed 3 years ago

thewhovianwho commented 3 years ago

Hello!

I am trying to run a simulation of a protein-membrane system in explicit solvent, but when the first minimization step starts, it crashes because of the following error:

#1/1: eq1_protein [restrained protein]
Traceback (most recent call last):
  File "/home/laura/miniconda3/envs/ommprotocol/bin/ommprotocol", line 10, in <module>
    sys.exit(run_protocol())
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/ommprotocol/__init__.py", line 63, in run_protocol
    protocol(handler, cfg)
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/ommprotocol/md.py", line 91, in protocol
    pos, vel, box = stage.run()
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/ommprotocol/md.py", line 304, in run
    self.apply_restraints()
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/ommprotocol/md.py", line 487, in apply_restraints
    r_force = self.restraint_force(indices, self.restraint_strength)
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/ommprotocol/md.py", line 521, in restraint_force
    if self.system.usesPeriodicBoundaryConditions():
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/ommprotocol/md.py", line 379, in system
    self._system = self.handler.create_system(**self.system_options)
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/ommprotocol/io.py", line 424, in create_system
    system = self.master.createSystem(**system_options)
  File "/home/laura/miniconda3/envs/ommprotocol/lib/python3.6/site-packages/simtk/openmm/app/amberprmtopfile.py", line 235, in createSystem
    raise ValueError('Illegal nonbonded method for a non-periodic system')
ValueError: Illegal nonbonded method for a non-periodic system

I used .prmtop and .inpcrd files and the _standardjinja.yaml input file (changed only the timestep) and instead of constrained_atoms, I used restrained_atoms with the protein selection.

Thanks!

jaimergp commented 3 years ago

Hi!

This error is saying that the nonbonded method you chose (available options here) is not compatible with the system you specified. This can happen for example if you try to use PME, which requires periodic boundary conditions, with a system with no periodic boundary conditions. There's a change your prmtop/inpcrd does not specify the box vectors or something similar that has to do with the system preparation routines in AmberTools.

Feel free to attach the yaml, prmtop and inpcrd files in a zipped folder and I will take look.

thewhovianwho commented 3 years ago

Thank you for your quick response! Please find attached the requested files.

md.zip

jaimergp commented 3 years ago
In [1]: import parmed as pmd

In [2]: top = pmd.load_file("/home/jaime/win/Downloads/md/step5assembly_tleap.prmtop")

In [3]: top.box
# empty

In [5]: crd = pmd.load_file("/home/jaime/win/Downloads/md/step5assembly_tleap.inpcrd")

In [6]: crd.box
#empty 

Your files do not define box vectors, but you are using nonbondedMethod: PME, which requires them. If you change it to nonbondedMethod: CutoffNonPeriodic it will work, but I don't think you want to run this system without periodic boundary conditions.

While preparing your prmtop and inpcrd in tleap/xleap, make sure to enable this option. Check the Amber tutorials for more info.

Also, if you have computed the box vectors via other means, you can still pass them to ommprotocol via the box_vectors key:


# input
topology: step5assembly_tleap.prmtop
positions: step5assembly_tleap.inpcrd
box_vectors: some_custom_vectors.csv

The simplest option might be a .csv file. Check here for details.

thewhovianwho commented 3 years ago

Solved it!

Thank you for your help!