michellab / Sire

Sire Molecular Simulations Framework
http://siremol.org
GNU General Public License v3.0
95 stars 26 forks source link

Support for PME in SOMD FEP #412

Closed lohedges closed 2 years ago

lohedges commented 2 years ago

This PR adds the work of @halx, which adds support for PME in SOMD FEP simulations.

lohedges commented 2 years ago

Not quite sure how to review this, since there aren't any associated tests. It looks like it is self-contained, though, so it shouldn't break any existing functionality.

Is there a simple test I could run via BioSImSpace to activate the new configuration options? I currently have a very minimal test case for the existing FEP functionality in SOMD to make sure that I can set up and run a basic simulation. Perhaps I could extend this to use PME too.

jmichel80 commented 2 years ago

Good idea, we haven’t done anything with BioSimSpace to support PME runs with SOMD. Moving on we will have to think about several different protocols with this engine. Also note that Finlay’s protocol for ABFE restraints is not yet supported. There are also two flavours of PME FEP (with or without simulateneous perturbation of a water molecule which will require updating the pert file code generation). I can prepare and share a few examples setups.

lohedges commented 2 years ago

Sorry, I am going to have to revert this PR since it breaks SOMD. Depending on the configuration options used it will automatically use the CUDA platform, even when the CPU platform is chosen. For example, here is a simple minimisation input file from BioSImSpace:

minimise = True
minimise maximum iterations = 100
minimise tolerance = 1
ncycles = 1
nmoves = 1
save coordinates = True
cutoff type = cutoffperiodic
cutoff distance = 10 angstrom

Here is another with from the Exscientia sandpit:

save coordinates = True
minimise = True
minimise maximum iterations = 100
minimise tolerance = 1
ncycles = 1
nmoves = 1
reaction field dielectric = 78.3
cutoff type = cutoffperiodic
cutoff distance = 8 angstrom
barostat = False

Both are run using:

somd -c test.rst7 -t test.prm7 -C test.cfg -p CPU  

Our configuration works as expected, but the Exscientia one fails with:

Traceback (most recent call last):
  File "/home/lester/.conda/envs/sire-dev/share/Sire/scripts/somd.py", line 131, in <module>
    OpenMMMD.run(params)
  File "/home/lester/.conda/envs/sire-dev/lib/python3.9/site-packages/sire/legacy/Tools/__init__.py", line 175, in inner
    retval = func()
  File "/home/lester/.conda/envs/sire-dev/lib/python3.9/site-packages/sire/legacy/Tools/OpenMMMD.py", line 2160, in run
    energy = computeOpenMMEnergy(topfile.val, crdfile.val, cutoff_dist.val)
  File "/home/lester/.conda/envs/sire-dev/lib/python3.9/site-packages/sire/legacy/Tools/OpenMMMD.py", line 1890, in computeOpenMMEnergy
    simulation = app.Simulation(prmtop.topology, system, integrator)
  File "/home/lester/.conda/envs/sire-dev/lib/python3.9/site-packages/openmm/app/simulation.py", line 99, in __init__
    self.context = mm.Context(self.system, self.integrator)
  File "/home/lester/.conda/envs/sire-dev/lib/python3.9/site-packages/openmm/openmm.py", line 12378, in __init__
    _openmm.Context_swiginit(self, _openmm.new_Context(*args))
openmm.OpenMMException: Error launching CUDA compiler: 32512
sh: line 1: /usr/local/cuda/bin/nvcc: No such file or directory

As you can see, it is trying to use CUDA, even when this platform isn't selected.

Input files are here: somd_bug.tar.gz

We really need some tests for SOMD within Sire, since we are currently relying entirely on BioSimSpace to catch breakages.