GROMACS is a versatile package for molecular dynamics simulations, primarily designed for simulations of proteins, lipids, and nucleic acids. It is free, open-source software licensed under the GNU Lesser General Public License.
GROMACS provides extremely high performance compared to other molecular dynamics software. It supports GPU acceleration and scales efficiently to hundreds of processors.
Key Features:
version: '3.8'
services:
gromacs:
image: gromacs/gromacs:2023
container_name: dxflow-gromacs
# Working directory
working_dir: /workspace
# Mount volumes
volumes:
- ./input:/workspace/input:ro
- ./output:/workspace/output
- ./mdp:/workspace/mdp:ro
# GPU support (optional)
deploy:
resources:
limits:
cpus: '16'
memory: 32G
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
# Keep container running for interactive use
command: tail -f /dev/null
Upload your input files:
# Create directories
mkdir -p input output mdp
# Upload protein structure
dxflow fs upload protein.pdb input/
# Upload topology files
dxflow fs upload topol.top input/
dxflow fs upload posre.itp input/
# Upload MDP parameter files
dxflow fs upload em.mdp mdp/ # Energy minimization
dxflow fs upload nvt.mdp mdp/ # NVT equilibration
dxflow fs upload npt.mdp mdp/ # NPT equilibration
dxflow fs upload md.mdp mdp/ # Production MD
# Deploy GROMACS container
dxflow compose create --identity gromacs-sim gromacs.yml
dxflow compose start gromacs-sim
Execute GROMACS commands in the container:
# Generate topology
dxflow compose execute gromacs-sim -- \
gmx pdb2gmx -f input/protein.pdb -o output/processed.gro -water spce
# Define simulation box
dxflow compose execute gromacs-sim -- \
gmx editconf -f output/processed.gro -o output/newbox.gro -c -d 1.0 -bt cubic
# Solvate system
dxflow compose execute gromacs-sim -- \
gmx solvate -cp output/newbox.gro -cs spc216.gro -o output/solv.gro -p topol.top
# Add ions
dxflow compose execute gromacs-sim -- \
gmx grompp -f mdp/ions.mdp -c output/solv.gro -p topol.top -o output/ions.tpr
dxflow compose execute gromacs-sim -- \
gmx genion -s output/ions.tpr -o output/solv_ions.gro -p topol.top -pname NA -nname CL -neutral
# Energy minimization
dxflow compose execute gromacs-sim -- \
gmx grompp -f mdp/em.mdp -c output/solv_ions.gro -p topol.top -o output/em.tpr
dxflow compose execute gromacs-sim -- \
gmx mdrun -v -deffnm output/em
# NVT equilibration
dxflow compose execute gromacs-sim -- \
gmx grompp -f mdp/nvt.mdp -c output/em.gro -r output/em.gro -p topol.top -o output/nvt.tpr
dxflow compose execute gromacs-sim -- \
gmx mdrun -v -deffnm output/nvt
# NPT equilibration
dxflow compose execute gromacs-sim -- \
gmx grompp -f mdp/npt.mdp -c output/nvt.gro -r output/nvt.gro -t output/nvt.cpt -p topol.top -o output/npt.tpr
dxflow compose execute gromacs-sim -- \
gmx mdrun -v -deffnm output/npt
# Production MD
dxflow compose execute gromacs-sim -- \
gmx grompp -f mdp/md.mdp -c output/npt.gro -t output/npt.cpt -p topol.top -o output/md.tpr
dxflow compose execute gromacs-sim -- \
gmx mdrun -v -deffnm output/md -nb gpu
# RMSD analysis
dxflow compose execute gromacs-sim -- \
gmx rms -s output/md.tpr -f output/md.xtc -o output/rmsd.xvg -tu ns
# RMSF analysis
dxflow compose execute gromacs-sim -- \
gmx rmsf -s output/md.tpr -f output/md.xtc -o output/rmsf.xvg -res
# Radius of gyration
dxflow compose execute gromacs-sim -- \
gmx gyrate -s output/md.tpr -f output/md.xtc -o output/gyrate.xvg
# Download all output files
dxflow fs download output/ /local/results/
; em.mdp - Energy minimization
integrator = steep
emtol = 1000.0
emstep = 0.01
nsteps = 50000
nstlist = 10
cutoff-scheme = Verlet
ns_type = grid
coulombtype = PME
rcoulomb = 1.0
rvdw = 1.0
pbc = xyz
; nvt.mdp - NVT equilibration
define = -DPOSRES
integrator = md
nsteps = 50000
dt = 0.002
nstenergy = 500
nstlog = 500
nstxout-compressed = 500
continuation = no
constraint_algorithm = lincs
constraints = h-bonds
cutoff-scheme = Verlet
ns_type = grid
nstlist = 10
rcoulomb = 1.0
rvdw = 1.0
coulombtype = PME
pme_order = 4
fourierspacing = 0.16
tcoupl = V-rescale
tc-grps = Protein Non-Protein
tau_t = 0.1 0.1
ref_t = 300 300
pcoupl = no
pbc = xyz
gen_vel = yes
gen_temp = 300
gen_seed = -1
; npt.mdp - NPT equilibration
define = -DPOSRES
integrator = md
nsteps = 50000
dt = 0.002
nstenergy = 500
nstlog = 500
nstxout-compressed = 500
continuation = yes
constraint_algorithm = lincs
constraints = h-bonds
cutoff-scheme = Verlet
ns_type = grid
nstlist = 10
rcoulomb = 1.0
rvdw = 1.0
coulombtype = PME
pme_order = 4
fourierspacing = 0.16
tcoupl = V-rescale
tc-grps = Protein Non-Protein
tau_t = 0.1 0.1
ref_t = 300 300
pcoupl = Parrinello-Rahman
pcoupltype = isotropic
tau_p = 2.0
ref_p = 1.0
compressibility = 4.5e-5
pbc = xyz
gen_vel = no
; md.mdp - Production MD
integrator = md
nsteps = 50000000 ; 100 ns
dt = 0.002
nstenergy = 5000
nstlog = 5000
nstxout-compressed = 5000
compressed-x-grps = System
continuation = yes
constraint_algorithm = lincs
constraints = h-bonds
cutoff-scheme = Verlet
ns_type = grid
nstlist = 10
rcoulomb = 1.0
rvdw = 1.0
coulombtype = PME
pme_order = 4
fourierspacing = 0.16
tcoupl = V-rescale
tc-grps = Protein Non-Protein
tau_t = 0.1 0.1
ref_t = 300 300
pcoupl = Parrinello-Rahman
pcoupltype = isotropic
tau_p = 2.0
ref_p = 1.0
compressibility = 4.5e-5
refcoord_scaling = com
pbc = xyz
gen_vel = no
CPU-Only:
GPU-Accelerated (Recommended):
HPC Cluster:
GPU Acceleration:
-nb gpu flag for neighbor list on GPU-pme gpu for PME calculations on GPU-bonded gpu for bonded interactions on GPUnvidia-smiParallel Execution:
# MPI parallelization
mpirun -np 16 gmx_mpi mdrun -v -deffnm md
# Thread-MPI (automatic)
gmx mdrun -v -deffnm md -ntmpi 4 -ntomp 4
Optimization:
-tunepme yes for automatic PME tuning-nstlist for optimal neighbor list updatesSimulation crashes:
Poor performance:
Memory errors:
GROMACS provides comprehensive analysis tools:
# Energy analysis
gmx energy -f md.edr -o energy.xvg
# Hydrogen bonds
gmx hbond -f md.xtc -s md.tpr -num hbond.xvg
# Secondary structure (DSSP required)
gmx do_dssp -f md.xtc -s md.tpr -o ss.xpm
# Distance analysis
gmx distance -f md.xtc -s md.tpr -select 'resname LYS and name CA' -oall dist.xvg
# Cluster analysis
gmx cluster -f md.xtc -s md.tpr -method gromos -cutoff 0.2
Abraham, M.J., Murtola, T., Schulz, R., Páll, S., Smith, J.C., Hess, B., Lindahl, E. (2015).
GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers.
SoftwareX, 1-2, 19-25.
Need help? Check the GROMACS manual or community forums for detailed guidance.