Skip to content

GROMACS

GROMACS

GROMACS is a versatile package to perform molecular dynamics, i.e. simulate the Newtonian equations of motion for systems with hundreds to millions of particles.

It is primarily designed for biochemical molecules like proteins, lipids and nucleic acids that have a lot of complicated bonded interactions, but since GROMACS is extremely fast at calculating the nonbonded interactions (that usually dominate simulations) many groups are also using it for research on non-biological systems, e.g. polymers.i

GROMACS Module

GROMACS has to be loaded using Lmod prior to running it.

$ module load GROMACS

Once the module has been loaded you will need to set some enviroment variables:

You can also list all available versions using Lmod's spider command:

$ module spider GROMACS

----------------------------------------------------------------
  GROMACS:
----------------------------------------------------------------
    Description:
      GROMACS is a versatile package to perform molecular dynamics, i.e. 
      simulate the Newtonian equations of motion for systems with 
      hundreds to million of particles.

     Versions:
        GROMACS/4.0.5-mod
        GROMACS/4.0.5-mod2
        GROMACS/5.0.7-intel-2017b-hybrid
        GROMACS/5.1.2-intel-2017a-hybrid
        GROMACS/2016.4-intel-2017a
        GROMACS/2018-foss-2018a
        GROMACS/2019-foss-2018b-Gold
        GROMACS/2019-foss-2018b
        GROMACS/2019.2-intel-2019a
        GROMACS/2019.4-foss-2019b

----------------------------------------------------------------
  For detailed information about a specific "GROMACS" module 
  (including how to load the modules) use the module's full name.
  For example:

     $ module spider GROMACS/5.1.2-intel-2017a-hybrid
----------------------------------------------------------------

Running GROMACS jobs on different HPC systems

Batch script for parallel execution of GROMACS compiled with the foss toolchain:

#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=GROMACS_job
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=6
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=8
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load GROMACS/2022.4-foss-2021a

mpirun -np ${SLURM_NTASKS} gmx_mpi mdrun -ntomp ${SLURM_CPUS_PER_TASK} -s input.tpr

Batch script for parallel execution of GROMACS compiled with the intel toolchain:

#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=GROMACS_job
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=6
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=8
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load GROMACS/2022.4-foss-2021a

srun  gmx_mpi mdrun -ntomp ${SLURM_CPUS_PER_TASK} -s input.tpr
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=GROMACS_job
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=6
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=8
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load GROMACS/2022.4-foss-2021a

srun  gmx_mpi mdrun -ntomp ${SLURM_CPUS_PER_TASK} -s input.tpr

GPU jobs:

#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=GROMACS_job
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=1
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=48
#SBATCH --gres=gpu:p40:2
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load GROMACS/2020-fosscuda-2019b

srun gmx_mpi mdrun -ntomp $SLURM_CPUS_PER_TASK -nb auto -bonded auto -pme auto -gpu_id 01 -s input.tpr
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=GROMACS_job
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=6
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=8
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load GROMACS/2022.4-foss-2021a

srun  gmx_mpi mdrun -ntomp ${SLURM_CPUS_PER_TASK} -s input.tpr

GPU jobs:

#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=GROMACS_job
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=1
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=48
#SBATCH --gres=gpu:rtx:2
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load GROMACS/2023.1-foss-2022a-CUDA-11.7.0

srun gmx_mpi mdrun -ntomp $SLURM_CPUS_PER_TASK -nb auto -bonded auto -pme auto -gpu_id 01 -s input.tpr