NERSCPowering Scientific Discovery Since 1974



GROMACS is a versatile package to perform molecular dynamics, i.e. to 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  nonbonded interactions (that usually dominate simulations) many groups are also using it for research on non-biological systems, e.g. polymers.  (From

How to Access GROMACS

NERSC uses modules to manage access to software. To use the default version of GROMACS, type:

% module load gromacs

Using GROMACS on Hopper

There are two ways of running gromacs on Hopper: submitting a batch job, or running interactively in an interactive batch session.

Sample Batch Script for GROMACS on Hopper

#PBS -N myjob
#PBS -q debug
#PBS -l mppwidth=24
#PBS -l walltime=00:30:00
#PBS -j oe

module load gromacs

aprun -n 24 mdrun_mpi >& test.log

Then submit the job script using the qsub command, e.g., assuming the job script name is test_gromacs.pbs:

% qsub test_gromacs.pbs 

Sample Interactive Batch Script for GROMACS on Hopper

To request an interactive batch session, issue the command (e.g., requesting 8 PEs):

% qsub -I -V -q interactive -l mppwidth=8 

When the batch session is returned to you, issue the following commands:

% module load gromacs
% aprun -n 8 mdrun_mpi >& test.log

Using GROMACS on Carver

A sample batch script for Carver:

#PBS -l nodes=2:ppn=8,walltime=0:30:00
#PBS -N test
#PBS -j oe
#PBS -q debug
module load gromacs
mpirun -np 16 mdrun_mpi >& test.log


Gromacs Documentaion

Compilation Instructions

Some advanced users may be interested in tweaking the GROMACS build parameters and building GROMACS themselves in their own directory. In order to aid in this process, and to provide a greater degree of transparency, the build instructions for the GROMACS module are listed below. The following procedure was used to build GROMACS on Hopper.

% module swap PrgEnv-pgi PrgEnv-gnu
% module swap gcc gcc/4.5.2
% ./configure --prefix=`pwd`/.. CC=cc CPP=cpp CXXCPP=cpp CXX=CC CPPFLAGS="-I/opt/fftw/" CFLAGS="-fomit-frame-pointer -finline-functions -funroll-all-loops -O3" --program-suffix=_mpi LIBS="-L/opt/fftw/ -lfftw3f -lm -lsci_gnu_mp" --enable-all-static --enable-mpi --without-x --without-xml --with-external-blas=yes --with-external-lapack=yes
% make
% make install


PackagePlatformCategoryVersionModuleInstall DateDate Made Default
Gromacs edison applications/ material sciences 4.6.5-dp gromacs/4.6.5-dp 2014-03-10 2014-03-10
Gromacs edison applications/ material sciences 5.0.4 gromacs/5.0.4 2015-05-29