Gromacs¶
Support tier: 3
Read information about support tiers.
Installed versions¶
| Resource | Version |
|---|---|
| Arrhenius-GPU/cpe25.09 | 2026.3 |
| Arrhenius/cpe25.09 | 2025.3-EasyBuild_5.2.1 |
| Dardel/cpe26.03 | 2026.1 |
Read information about how to load this software in your environment by searching for Lmod module.
General information¶
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 provides extremely high performance through custom algorithmic optimisations. More information on the GROMACS homepage. Several versions of GROMACS are installed at PDC. Generally, it is recommended to use the most recent version since it can be expected to be faster, more stable and less memory demanding. Information on how to run GROMACS on AMD GPU nodes of an HPE Cray EX cluster can be found in How to run GROMACS efficiently on the LUMI supercomputer.
How to use¶
GROMACS is highly tuned for quite efficient use of HPC resources. Special assembly kernels make its core compute engine one of the fastest MD simulation programs.
How to user¶
You can check for available GROMACS modules with
For example, to load the module for GROMACS 2024.2/
To see what environment variables are set when loading the module Preprocessing input files (molecular topology, initial coordinates and mdrun parameters) to create a portable run input (.tpr) file can be run in a batch job by Gromacs also contains a large number of other pre- and post-processing tools. A list of available commands can be seen by The GROMACS module provide up to four main versions of the GROMACS suite¶
- gmx : The MD engine binary without MPI, but with openMP threading. Useful if GROMACS is executed for preprocessing or running analysis tools on a compute node.
- gmx_mpi : The MD engine binary with MPI support. This is the one that researchers would use most of the time.
- gmx_d : Same as gmx above but in double precision.
- gmx_mpi_d : Same as gmx_mpi above but in double precision.
All tools from the GROMACS suite can be launched using any of the above versions. Please note that they should be launched on the compute node(s). Remember to always use in your scripts srun in front of the actual GROMACS command! Here is an example script that requests 2 nodes:
#!/bin/bash
#SBATCH -J my_gmx_job
#SBATCH -A naissYYYY-X-XX
#SBATCH -p main
#SBATCH -t 01:00:00
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=128
ml PDC/<version>
ml gromacs/2025.1-cpeGNU-24.11
export OMP_NUM_THREADS=1
srun -n 1 gmx_mpi grompp -c conf.gro -p topol.top -f grompp.mdp
srun gmx_mpi mdrun -s topol.tpr -deffnm gmx_md
The executables for Dardel GROMACS GPU nodes have been built with the AdaptiveCPP backend for AMD GPUs
To load the GROMACS module for AMD GPUs
Below follows an example job script for GROMACS, for running on one Dardel GPU node using 8 MPI tasks per node (corresponding to one MPI task per GPU) and 8 OpenMP threads. You need to replace pdc.staff with an active project that you belong to. Note: This script is a simple template. For efficient calculation the script needs to be augmented with settings to pin appropriately the computation threads to the CCDs and GCD.
#!/bin/bash
#SBATCH -J my_gmx_job
#SBATCH -A pdc.staff
#SBATCH -p gpu
#SBATCH -t 24:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --gpus-per-node=8
ml PDC/24.11
ml gromacs/2025.2-gpu
export OMP_NUM_THREADS=1
export MPICH_GPU_SUPPORT_ENABLED=1
echo "Script initiated at `date` on `hostname`"
srun gmx_mpi mdrun -s topol.tpr -deffnm gmx_md
echo "Script finished at `date` on `hostname`"
How to build GROMACS¶
The builds of GROMACS for AMD CPU nodes are mainly done with EasyBuild using cpeGNU and cpeCray toolchains. A build in your local file space can be done with
See also Installing software using EasyBuild.
The builds for AMD GPU nodes are done with the PrgEnv-amd toolchain.
#!/bin/bash
# Build instructions for GROMACS 2025.2 on Dardel
# Load the environment
ml PDC/24.11
ml craype-accel-amd-gfx90a
ml swap PrgEnv-cray/8.6.0 PrgEnv-amd/8.6.0
ml swap amd/6.0.0 amd/6.3.3
ml cray-mpich/8.1.31
ml cray-fftw/3.3.10.9
ml cray-libsci/24.11.0
ml cmake/4.0.1
ml rocm/6.3.3
ml boost/1.79.0-nompi
# GROMACS 2025.2
# Download and untar the source code
wget https://gitlab.com/gromacs/gromacs/-/archive/v2025.2/gromacs-v2025.2.tar.gz
tar xvf gromacs-v2025.2.tar.gz
cd gromacs-v2025.2/
# Set AdaptiveCpp environment variables
export PATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/bin:$PATH
export LIBRARY_PATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/lib:$LIBRARY_PATH
export CPATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/include:$CPATH
# Configure
mkdir build
cd build
cmake ../ \
-DCMAKE_C_COMPILER=amdclang \
-DCMAKE_CXX_COMPILER=amdclang++ \
-Dadaptivecpp_DIR=/pdc/software/24.11/other/adaptivecpp/25.02.0/lib/cmake/AdaptiveCpp \
-DCMAKE_BUILD_TYPE=Release \
-DGMX_BUILD_OWN_FFTW=OFF \
-DGMX_SIMD=AVX2_256 \
-DGMX_OPENMP=ON \
-DGMXAPI=OFF \
-DGMX_GPU=SYCL \
-DGMX_SYCL=ACPP \
-DACPP_TARGETS='hip:gfx90a' \
-DGMX_GPU_FFT_LIBRARY=vkfft \
-DGMX_CYCLE_SUBCOUNTERS=ON \
-DGMX_MPI=ON \
-DMPI_CXX_SKIP_MPICXX=ON \
-DMPI_CXX_COMPILER=CC -DGMX_BLAS_USER=${CRAY_LIBSCI_PREFIX_DIR}/lib/libsci_amd.so \
-DGMX_LAPACK_USER=${CRAY_LIBSCI_PREFIX_DIR}/lib/libsci_amd.so \
-DCMAKE_{EXE,SHARED}_LINKER_FLAGS=-fuse-ld=ld \
-DCMAKE_INSTALL_PREFIX=/pdc/software/24.11/other/gromacs/2025.2-gpu > BuildGROMACS_CMakeLog.txt 2>&1
# Build and install
make -j 64 > BuildGROMACS_make.txt 2>&1
make install
# Set runtime environment
export LD_LIBRARY_PATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/pdc/software/24.11/other/gromacs/2025.2-gpu/lib:$LD_LIBRARY_PATH
export PATH=/pdc/software/24.11/other/gromacs/2025.2-gpu/bin:$PATH
¶
#!/bin/bash
# Build instructions for GROMACS 2025.2 on Dardel
# Load the environment
ml PDC/24.11
ml craype-accel-amd-gfx90a
ml swap PrgEnv-cray/8.6.0 PrgEnv-amd/8.6.0
ml swap amd/6.0.0 amd/6.3.3
ml cray-mpich/8.1.31
ml cray-fftw/3.3.10.9
ml cray-libsci/24.11.0
ml cmake/4.0.1
ml rocm/6.3.3
ml boost/1.79.0-nompi
# GROMACS 2025.2
# Download and untar the source code
wget https://gitlab.com/gromacs/gromacs/-/archive/v2025.2/gromacs-v2025.2.tar.gz
tar xvf gromacs-v2025.2.tar.gz
cd gromacs-v2025.2/
# Set AdaptiveCpp environment variables
export PATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/bin:$PATH
export LIBRARY_PATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/lib:$LIBRARY_PATH
export CPATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/include:$CPATH
# Configure
mkdir build
cd build
cmake ../ \
-DCMAKE_C_COMPILER=amdclang \
-DCMAKE_CXX_COMPILER=amdclang++ \
-Dadaptivecpp_DIR=/pdc/software/24.11/other/adaptivecpp/25.02.0/lib/cmake/AdaptiveCpp \
-DCMAKE_BUILD_TYPE=Release \
-DGMX_BUILD_OWN_FFTW=OFF \
-DGMX_SIMD=AVX2_256 \
-DGMX_OPENMP=ON \
-DGMXAPI=OFF \
-DGMX_GPU=SYCL \
-DGMX_SYCL=ACPP \
-DACPP_TARGETS='hip:gfx90a' \
-DGMX_GPU_FFT_LIBRARY=vkfft \
-DGMX_CYCLE_SUBCOUNTERS=ON \
-DGMX_MPI=ON \
-DMPI_CXX_SKIP_MPICXX=ON \
-DMPI_CXX_COMPILER=CC -DGMX_BLAS_USER=${CRAY_LIBSCI_PREFIX_DIR}/lib/libsci_amd.so \
-DGMX_LAPACK_USER=${CRAY_LIBSCI_PREFIX_DIR}/lib/libsci_amd.so \
-DCMAKE_{EXE,SHARED}_LINKER_FLAGS=-fuse-ld=ld \
-DCMAKE_INSTALL_PREFIX=/pdc/software/24.11/other/gromacs/2025.2-gpu > BuildGROMACS_CMakeLog.txt 2>&1
# Build and install
make -j 64 > BuildGROMACS_make.txt 2>&1
make install
# Set runtime environment
export LD_LIBRARY_PATH=/pdc/software/24.11/other/adaptivecpp/25.02.0/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/pdc/software/24.11/other/gromacs/2025.2-gpu/lib:$LD_LIBRARY_PATH
export PATH=/pdc/software/24.11/other/gromacs/2025.2-gpu/bin:$PATH
Arrhenius¶
How to use¶
Example job script for CPU job:
#!/bin/bash
#SBATCH -A XXXX-XX-XX # Project ID
#SBATCH -J gromacs-job # Job name
#SBATCH -t 02:50:00 # Wall time
#SBATCH -p cpu # CPU partition
#SBATCH -n 4 # 4 MPI ranks
#SBATCH -c 7 # 7 OpenMP threads
# load the Gromacs module
ml purge > /dev/null 2>&1
ml buildtool-easybuild/5.2.1-hpca3ef7d197 GCC/14.3.0 OpenMPI/5.0.8
ml GROMACS/2025.3
export MDRUN='gmx_mpi mdrun'
gmx grompp -o gromacs_input.tpr ...
srun $MDRUN -v -deffnm gromacs_input
Example job script for GPU job:
#!/bin/bash
#SBATCH -A XXXX-XX-XX # Project ID
#SBATCH -J gromacs-job # Job name
#SBATCH -t 02:50:00 # Wall time
#SBATCH -p gpu # GPU partition
#SBATCH --gpus=1 # Nr. of GPU cards
#SBATCH -n 1 # 1 MPI ranks should match the nr. of GPU cards
#SBATCH -c 7 # 7 OpenMP threads
# load the Gromacs module
ml purge > /dev/null 2>&1
ml GPU/GROMACS/2026.3-gcccuda-2026.03-cu13.0-es
export MDRUN='gmx_mpi mdrun'
gmx_mpi grompp -o gromacs_input.tpr ...
srun $MDRUN -v -deffnm gromacs_input
In these templates, 4 MPI ranks and 7 OpenMP threads are used. However, depending on the
simulation, a different combination of MPI ranks and OpenMP threads may provide better
performance. Therefore, it is highly recommended to run short test simulations using
different combinations and evaluate the scaling behavior before starting long production
runs. During the benchmarking, the option -resethway is recommended. It will reset
the performance counters halfway during the simulation.
Source repository