GROMACS

Guidance last updated: 20 October 2026

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.

Documentation: https://manual.gromacs.org/documentation/

Tutorials: https://www.gromacs.org/Documentation/Tutorials

Usage

After connecting to Stanage (see Establishing a SSH connection), start an interactive session:

salloc

Load one of the available modules:

module load GROMACS/2026.2-foss-2025b-CUDA-12.9.1
module load GROMACS/2025.3-foss-2025b

The examples below use GROMACS/2026.2-foss-2025b-CUDA-12.9.1, which provides both gmx (thread-MPI) and gmx_mpi (external MPI). The module loads its compiler, MPI and CUDA dependencies automatically.

To list the available commands in an interactive session:

module load GROMACS/2026.2-foss-2025b-CUDA-12.9.1
gmx help commands

Batch jobs

The following example batch submission scripts require your own matching grompp.mdp, conf.gro and topol.top input files in the submission directory. grompp prepares the run input; mdrun performs the simulation. Save your chosen script as my_job.sh and submit it with sbatch my_job.sh.

Consult the matching version of the GROMACS performance guide when choosing MPI ranks, OpenMP threads and GPU settings for your system.

Single-node CPU job

This example requests one task with four CPUs and runs one thread-MPI rank with four OpenMP threads. -nb cpu selects CPU nonbonded calculations.

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem-per-cpu=2000
#SBATCH --time=00:30:00

set -e
export SLURM_EXPORT_ENV=ALL
module load GROMACS/2026.2-foss-2025b-CUDA-12.9.1
export OMP_NUM_THREADS="$SLURM_CPUS_PER_TASK"

gmx grompp -f grompp.mdp -c conf.gro -p topol.top -o topol.tpr
srun gmx mdrun -s topol.tpr -ntmpi 1 -ntomp "$OMP_NUM_THREADS" -nb cpu

MPI CPU job

These example batch submission scripts run four MPI ranks, with one OpenMP thread per rank. Slurm launches the ranks through srun; do not use -ntmpi with gmx_mpi. For multiple nodes, the input files must be accessible from every allocated node.

Four ranks on one node.

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks=4
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=2000
#SBATCH --time=00:30:00

set -e
export SLURM_EXPORT_ENV=ALL
module load GROMACS/2026.2-foss-2025b-CUDA-12.9.1
export OMP_NUM_THREADS="$SLURM_CPUS_PER_TASK"

gmx_mpi grompp -f grompp.mdp -c conf.gro -p topol.top -o topol.tpr
srun gmx_mpi mdrun -s topol.tpr -ntomp "$OMP_NUM_THREADS" -nb cpu

GPU job

The CUDA-enabled module supports GPU acceleration. This example requests one A100 GPU and four CPUs, and offloads nonbonded calculations with -nb gpu. Other offloading choices depend on your simulation and GROMACS configuration.

#!/bin/bash
#SBATCH --partition=gpu
#SBATCH --gres=gpu:a100:1
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem-per-cpu=2000
#SBATCH --time=00:30:00

set -e
export SLURM_EXPORT_ENV=ALL
module load GROMACS/2026.2-foss-2025b-CUDA-12.9.1
export OMP_NUM_THREADS="$SLURM_CPUS_PER_TASK"

gmx grompp -f grompp.mdp -c conf.gro -p topol.top -o topol.tpr
srun gmx mdrun -s topol.tpr -ntmpi 1 -ntomp "$OMP_NUM_THREADS" -nb gpu

Installation notes

GROMACS was installed using Easybuild, build details can be found in $EBROOTGROMACS/easybuild with a given module loaded.

Direct dependencies for latest version of GROMACS