GROMACS

Gromacs is a free and open-source software suite for high-performance molecular dynamics and output analysis. The software is designed to run either on CPUs or on NVIDIA CUDA-enabled GPUs under a 64-bit Linux operating system.

Installed versions

Gromacs version 2025.3 (GPU default, recommended)

Gromacs version 2025.3 (CPU)

GROMACS/2024.1, GROMACS/2024.3, GROMACS/2024.4 are also easily available via EESSI. For more information (and easy usage instructions), see: EESSI.

Gromacs version 2023.2 (GPU)

Gromacs version 2023.2 (CPU)

Gromacs manual can be downloaded from here: https://manual.gromacs.org/

Submitting a Gromacs calculation using module

This ‘source’ command is needed once per session:

module load gromacs

This commands is equivalent to:

module load gromacs/2025.3-gnu-gpu

The GROMACS SLURM job (subGROMACS.sh) looks like this:

 #!/bin/bash
#SBATCH --job-name=GROMACS
#SBATCH --time=01:00:00
#SBATCH --nodes=1
#SBATCH --partition=gpu
#SBATCH --gres=gpu:1
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=4
#SBATCH -o slurm-%j.out
#SBATCH -e slurm-%j.err

set -eo pipefail

module purge
module load craype-x86-milan
module load gromacs

export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export OMP_PLACES=cores
export OMP_PROC_BIND=close

gmx mdrun -v -s {input}.tpr -nsteps 50000 \
 -ntmpi ${SLURM_NTASKS} -ntomp ${OMP_NUM_THREADS} \
 -nb gpu \
 &> md.log

This SLURM job script submits a GROMACS run on the GPU partition using one node with a single GPU. It launches 4 thread-MPI ranks, each using 4 OpenMP threads (16 CPU cores total), and executes gmx mdrun for 50,000 steps from the provided input .tpr file. Nonbonded interactions are offloaded to the GPU (-nb gpu), and all runtime output is written into md.log.

Submitting a Gromacs calculation using EESSI

In this case, the GROMACS SLURM job script (subGROMACS.sh) for running GPU-supported Gromacs 2024.4 looks like this:

#!/bin/bash
#SBATCH --job-name=GROMACS_EESSI_GPU
#SBATCH --time=01:00:00
#SBATCH --nodes=1
#SBATCH --partition=gpu
#SBATCH --gres=gpu:1
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=4
#SBATCH -o slurm-%j.out
#SBATCH -e slurm-%j.err

set -eo pipefail

module purge
module use /cvmfs/software.eessi.io/init/modules
module load EESSI/2023.06
module load GROMACS/2024.4-foss-2023b-CUDA-12.4.0

: "${SLURM_CPUS_PER_TASK:=4}"
export OMP_NUM_THREADS="${SLURM_CPUS_PER_TASK}"
export OMP_PLACES=cores
export OMP_PROC_BIND=close

# sanity
gmx --version | egrep -i "GROMACS version|GPU support|CUDA|MPI library|OpenMP support" -n

gmx mdrun -v -s {input}.tpr -nsteps 50000 \
 -ntmpi ${SLURM_NTASKS} -ntomp ${OMP_NUM_THREADS} \
 -nb gpu \
 &> md.log

How to Cite GROMACS

M. J. Abraham, T. Murtola, R. Schulz, S. Páll, J. C. Smith, B. Hess, E. Lindahl GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers https://www.sciencedirect.com/science/article/pii/S2352711015000059

Last update by Milán SZŐRI: 2026-01-27