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 2026.1 (GPU default, recommended)
Gromacs version 2026.1 (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) - WILL BE REMOVED
Gromacs version 2023.2 (CPU) - WILL BE REMOVED
Gromacs manual can be downloaded from here: https://manual.gromacs.org/
Loading the GROMACS software
This ‘source’ command is needed once per session:
module load gromacs
This commands is equivalent to:
module load gromacs/2026.1-gnu-gpu
Attention
This is for small preparations! If You want to submit production runs please do it via SLURM and submission scripts on the compute nodes!
Submitting GROMACS jobs to the cluster
Attention
Please consider system size and the custom system preferences (e.g.: using GPU for PME) when choosing the GROMACS build. For smaller systems please use the SMP builds (gmx), and for bigger systems the MPI builds (gmx_mpi). These have separate submit templates in the SUPPORT (/opt/software/packages/gromacs/gnu/cpu/2026.1/SUPPORT/) folder. Also if applicable use the GPU builds for increased simulation performace.
Single-node CPU (SMP) GROMACS job example
#!/bin/bash
#SBATCH -A {ACCOUNT_NAME}
#SBATCH --job-name={JOBNAME}
#SBATCH --time=00:30:00
#SBATCH --ntasks-per-node=128
#SBATCH --cpus-per-task=1
#SBATCH --no-requeue
#SBATCH --partition=cpu
#SBATCH --nodes=1
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
module load PrgEnv-gnu/8.6.0
module load cray-fftw/3.3.10.9
module load cray-python/3.11.7
source /opt/software/packages/gromacs/gnu/cpu/2026.1/bin/GMXRC
echo "Node list: $SLURM_JOB_NODELIST"
echo "Tasks: $SLURM_NTASKS"
echo "GPUs per node: $SLURM_GPUS_ON_NODE"
gmx mdrun -s {simulation_name}.tpr -deffnm md.{SIMULATION_NAME}.$SLURM_NNODES.TasksPerNode.$SLURM_TASKS_PER_NODE.ThreadsPerTask.$OMP_NUM_THREADS.JobID.$SLURM_JOBID -maxh 1.0 -cpt 1000 -nsteps 50000 -ntomp $OMP_NUM_THREADS &> md.log
Note
This is for a CPU SMP (single node) simulation. According to benchmarks using the same number of MPI threads as the number of CPUs in the node gives the best performance.
Multi-node CPU (MPI) GROMACS job example
#!/bin/bash
#SBATCH -A {ACCOUNT_NAME}
#SBATCH --job-name={JOBNAME}
#SBATCH --time=00:30:00
#SBATCH --ntasks-per-node=128
#SBATCH --cpus-per-task=1
#SBATCH --no-requeue
#SBATCH --partition=cpu
#SBATCH --nodes=4
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
module load PrgEnv-gnu/8.6.0
module load cray-fftw/3.3.10.9
module load cray-python/3.11.7
source /opt/software/packages/gromacs/gnu/cpu/2026.1/bin/GMXRC
echo "Node list: $SLURM_JOB_NODELIST"
echo "Tasks: $SLURM_NTASKS"
echo "GPUs per node: $SLURM_GPUS_ON_NODE"
srun gmx_mpi mdrun -s {simulation_name}.tpr -deffnm md.{SIMULATION_NAME}.$SLURM_NNODES.TasksPerNode.$SLURM_TASKS_PER_NODE.ThreadsPerTask.$OMP_NUM_THREADS.JobID.$SLURM_JOBID -maxh 1.0 -cpt 1000 -nsteps 50000 -ntomp $OMP_NUM_THREADS &> md.log
Note
This is for a CPU MPI (multi node) simulation running on 4 nodes. According to benchmarks using the same number of MPI threads as the number of CPUs in the node gives the best performance.
Attention
gmx_mpi is used with srun in case of MPI jobs!
Single node GPU (SMP) GROMACS job example using 4x NVIDIA A100 crads
#!/bin/bash
#SBATCH -A {ACCOUNT_NAME}
#SBATCH --job-name={JOBNAME}
#SBATCH --time=00:30:00
#SBATCH --gres=gpu:4
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=16
#SBATCH --mem-per-cpu=4000MB
#SBATCH --no-requeue
#SBATCH --partition=gpu
#SBATCH --nodes=1
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export GMX_GPU_DD_COMMS=true
export GMX_GPU_PME_PP_COMMS=true
export GMX_FORCE_UPDATE_DEFAULT_GPU=true
export GMX_ENABLE_DIRECT_GPU_COMM=1
export MPICH_GPU_SUPPORT_ENABLED=1
module load PrgEnv-gnu/8.6.0
module load cray-fftw/3.3.10.9
module load cray-python/3.11.7
module load cuda/12.9
module load craype-accel-nvidia80
source /opt/software/packages/gromacs/gnu/gpu/2026.1/bin/GMXRC
echo "Node list: $SLURM_JOB_NODELIST"
echo "Tasks: $SLURM_NTASKS"
echo "GPUs per node: $SLURM_GPUS_ON_NODE"
MPI=$(($SLURM_JOB_NUM_NODES*$SLURM_NTASKS_PER_NODE))
gmx mdrun -s {simulation_name}.tpr -nb gpu -bonded gpu -pin on -pinstride 0 -deffnm md.{SIMULATION_NAME}.$SLURM_NNODES.TasksPerNode.$SLURM_TASKS_PER_NODE.ThreadsPerTask.$OMP_NUM_THREADS.JobID.$SLURM_JOBID -maxh 1.0 -cpt 1000 -nsteps 50000 -ntomp $OMP_NUM_THREADS -ntmpi $MPI &> md.log
Note
Using 1 MPI thread per GPU is considered best practice. You can use a different configuration, but this might lead to performance degradation. 16 CPU cores are (64/4) allocated to one MPI thread and one GPU gives a symmetric configuration. Anything else might result in a performance loss.
Multi node GPU (MPI) GROMACS job example using 16x NVIDIA A100 crads
#!/bin/bash
#SBATCH -A {ACCOUNT_NAME}
#SBATCH --job-name={JOBNAME}
#SBATCH --time=00:30:00
#SBATCH --gres=gpu:4
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=16
#SBATCH --mem-per-cpu=4000MB
#SBATCH --no-requeue
#SBATCH --partition=gpu
#SBATCH --nodes=4
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export GMX_GPU_DD_COMMS=true
export GMX_GPU_PME_PP_COMMS=true
export GMX_FORCE_UPDATE_DEFAULT_GPU=true
export GMX_ENABLE_DIRECT_GPU_COMM=1
export MPICH_GPU_SUPPORT_ENABLED=1
module load PrgEnv-gnu/8.6.0
module load cray-fftw/3.3.10.9
module load cray-python/3.11.7
module load cuda/12.9
module load craype-accel-nvidia80
source /opt/software/packages/gromacs/gnu/gpu/2026.1/bin/GMXRC
echo "Node list: $SLURM_JOB_NODELIST"
echo "Tasks: $SLURM_NTASKS"
echo "GPUs per node: $SLURM_GPUS_ON_NODE"
srun gmx_mpi mdrun -s {simulation_name}.tpr -nb gpu -bonded gpu -pin on -pinstride 0 -deffnm md.{SIMULATION_NAME}.$SLURM_NNODES.TasksPerNode.$SLURM_TASKS_PER_NODE.ThreadsPerTask.$OMP_NUM_THREADS.JobID.$SLURM_JOBID -maxh 1.0 -cpt 1000 -nsteps 50000 -ntomp $OMP_NUM_THREADS &> md.log
Note
Using 1 MPI thread per GPU is considered best practice. You can use a different configuration, but this might lead to performance degradation. 16 CPU cores are (64/4) allocated to one MPI thread and one GPU gives a symmetric configuration. Anything else might result in a performance loss.
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
Recommended hardware allocation
Based on our benchmarking on Komondor, we recommend using the GPU-accelerated version of GROMACS for job submissions, with one GPU and 16 CPUs allocated per job.
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