diff --git a/scripts/gromacs/gromacs.py b/scripts/gromacs/gromacs.py index 82ed1fb..c548296 100644 --- a/scripts/gromacs/gromacs.py +++ b/scripts/gromacs/gromacs.py @@ -18,6 +18,7 @@ import logging import shlex import subprocess import shutil +import multiprocessing as mp GRO_FILE_DIR = "/home/wukevin/software/md_template/mdp/" @@ -85,7 +86,7 @@ def run_gromacs( # come to "room temperature" grompp_cmd = f"{gmx} grompp -f {gro_file_dir}nvt.mdp -c em.gro -r em.gro -p topol.top -o nvt.tpr" subprocess.call(shlex.split(grompp_cmd)) - nvt_cmd = f"{gmx} mdrun -deffnm nvt" + nvt_cmd = f"{gmx} mdrun -ntmpi 1 -ntomp {mp.cpu_count()} -nb gpu -pin on -deffnm nvt" subprocess.call(shlex.split(nvt_cmd)) # NPT @@ -93,13 +94,17 @@ def run_gromacs( f"{gmx} grompp -f {gro_file_dir}npt.mdp -c nvt.gro -o npt.tpr -p topol.top" ) subprocess.call(shlex.split(grompp_cmd)) - npt_cmd = f"{gmx} mdrun -ntmpi 1 -ntomp 32 -pin on -deffnm npt" + npt_cmd = ( + f"{gmx} mdrun -ntmpi 1 -ntomp {mp.cpu_count()} -nb gpu -pin on -deffnm npt" + ) subprocess.call(shlex.split(npt_cmd)) # Production run grompp_cmd = f"{gmx} grompp -f {gro_file_dir}md.mdp -c npt.gro -t npt.cpt -p topol.top -o prod.tpr" subprocess.call(shlex.split(grompp_cmd)) - prod_cmd = f"{gmx} mdrun -ntmpi 1 -ntomp 32 -pin on -deffnm prod" + prod_cmd = ( + f"{gmx} mdrun -ntmpi 1 -ntomp {mp.cpu_count()} -nb gpu -pin on -deffnm prod" + ) subprocess.call(shlex.split(prod_cmd)) # Produce a PDB of final structure