Skip to main content
Texas Tech University

GROMACS

Introduction

GROMACS (GROningen MAchine for Chemical Simulations) is a free, open-source software package used to perform molecular dynamics (MD) simulations. It models the physical movements of atoms and molecules by solving Newton’s equations of motion over time. 

Running GROMACS in HPCC 

Submitting a GROMACS job to Nocona 

There are two MPI GROMACS modules in Nocona: GROMACS built against GCC 14.2.0 and GROMACS built against AOCC 4.2.0.

Create a job submission script with the following content as a reference: 

#!/bin/bash  
#SBATCH --job-name=gromacs_gcc
#SBATCH --output=%x.o%j
#SBATCB --error=%x.e%j 
#SBATCH --partition=nocona 
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=128
#SBATCH --time=10:00:00

module load gcc/14.2.0 openmpi/5.0.5 gromacs/2024.3-mpi-omp

# Generate the .tpr input file using gmx_mpi
gmx_mpi grompp -f test.mdp -c test.gro -p test.top -o test.tpr 

# Run the calculation
mpirun gmx_mpi mdrun -s test.tpr
#!/bin/bash  
#SBATCH --job-name=gromacs_aocc
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=nocona 
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=128
#SBATCH --time=10:00:00 

module load aocc/4.2.0 openmpi/5.0.5 gromacs/2024.3-mpi-omp

# Generate the .tpr input file using gmx_mpi
gmx_mpi grompp -f test.mdp -c test.gro -p test.top -o test.tpr

# Run the calculation
mpirun gmx_mpi mdrun -s test.tpr

Submitting a GROMACS job to Quanah

There are two MPI GROMACS modules in Nocona: GROMACS built against Intel OneAPI and GROMACS built against GCC 14.2.0.

Create a job submission script with the following content as a reference:

#!/bin/bash  
#SBATCH --job-name=gromacs_oneapi
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=quanah
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=36
#SBATCH --time=10:00:00

module load intel-oneapi/2024.2.1 oneapi-mpi/2021.13.1 gromacs/2024.3-mkl-mpi-omp

# Generate the .tpr input file using gmx_mpi
gmx_mpi grompp -f test.mdp -c test.gro -p test.top -o test.tpr

# Run the calculation
mpirun gmx_mpi mdrun -s test.tpr
#!/bin/bash  
#SBATCH --job-name=gromacs_oneapi
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=quanah
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=36
#SBATCH --time=10:00:00

module load gcc/14.2.0 openmpi/4.1.6 gromacs/2024.3-mpi-omp

# Generate the .tpr input file using gmx_mpi
gmx_mpi grompp -f test.mdp -c test.gro -p test.top -o test.tpr

# Run the calculation
mpirun gmx_mpi mdrun -s test.tpr

Submitting a GPU GROMACS job to Matador

The available LAMMPS instances on GPU partitions come from the official Nvidia NGC GROMACS container. 

#!/bin/bash  
#SBATCH --job-name=gromacs_gpus
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=matador
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=40
#SBATCH --gpus-per-node=2
#SBATCH --time=10:00:00 

module load gromacs/v2025.1-gpu

gmx grompp -f test.mdp -c test.gro -p test.top -o test.tpr

# Run GROMACS using 2 GPUs, with 2 thread-MPI tasks per GPU (-ntmpi 4). 
# We set 10 OpenMP threads per thread-MPI task (-ntomp 10) given there are 40 total CPUs. 
# This may be adjusted according to the amount of resources requested.

gmx mdrun -s test.tpr -ntmpi 4 -ntomp 10 -nb gpu -pme gpu -update gpu -bonded gpu

Then submit this job using the sbatch command. Please make sure to edit the following Slurm parameters as needed:

Number of nodes (--nodes): If you want to scale out your job to run across multiple worker nodes.

Number of MPI tasks (--ntasks-per-node): We recommend setting this parameter to the maximum number of available CPU cores per node on each partition.

Wall time (--time): If your job won’t take longer than 10 hours, leave it as it is. Adjust the wall time based on how long you estimate your job will take.


Please contact HPCC support at hpccsupport@ttu.edu if you have any questions.