michellab / BioSimSpace

Code and resources for the EPSRC BioSimSpace project.
https://biosimspace.org
GNU General Public License v3.0
77 stars 19 forks source link

Help with running a minimisation #323

Closed xiki-tempula closed 2 years ago

xiki-tempula commented 2 years ago

Prerequisites

I tried to run an energy minimisation with the dev branch and gmx 2022.1 but I got the issue of Killing job /Users/zwu/build/gromacs/2022.1/bin/gmx mdrun -v -deffnm gromacs

If I go to the work_dir, I could excute the command /Users/zwu/build/gromacs/2022.1/bin/gmx mdrun -v -deffnm gromacs and the energy minimisation would finish normally.

Steps to Reproduce

import BioSimSpace as BSS
from BioSimSpace.Protocol import Minimisation
from BioSimSpace import Process
m = BSS.Parameters.openff_unconstrained_2_0_0("c1ccccc1").getMolecule()
solvated = BSS.Solvent.tip3p(molecule=m,
                             box=3 * [3 * BSS.Units.Length.nanometer])
protocol = Minimisation()
process = Process.Gromacs(solvated, protocol)
process.run()

Failure logs

param_eror.zip.zip

Context

lohedges commented 2 years ago

You've not added process.wait() after process.run(). If you don't have this in your script, then it will just exit the script and terminate the process, hence the error that you are seeing. You need to add .wait() when you aren't working interactively. If you are in a notebook, it is fine to just use .run(), after which you can monitor the progress of the process.

Cheers.

xiki-tempula commented 2 years ago

@lohedges It would still fail with the same error even if I have process.wait() at the end.

lohedges commented 2 years ago

Sorry, also realised that you need to use process.start(), not process.run(). If you look at the docs, e.g. here, you'll see that process.run() is a convenience function to create an run a new process, i.e. you can use it to re-run an existing process, or pass in a completely new system and protocol. Importantly, it returns a new process object, so you would need to capture this object, which you are not doing. (This exists for consistency with the BioSimSpace.MD.run interface, i.e. an engine specific version of the engine agnostic MD interface.)

Replacing process.run() with process.start() and adding process.wait() works for me.

xiki-tempula commented 2 years ago

@lohedges Thank you.