PLUMED
In this section:
Description
According to the documentation of PLUMED, PLUMED is an open-source library for enhanced sampling in molecular dynamics simulations. It allows calculating and acting on collective variables, performing metadynamics, umbrella sampling, and other advanced techniques.
Available Versions
plumed/2.7.1 (default)
Loading the Module
# Load PLUMED
module load plumed/2.7.1
# Verify installation
plumed --version
plumed info --configuration
Job Submission with PLUMED + GROMACS
submit_plumed_gromacs.sh
#!/bin/bash
#SBATCH -J plumed_gmx
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 72:00:00
#SBATCH --mem-per-cpu=2G
export INPUT="topol.tpr plumed.dat"
export OUTPUT="metadynamics/"
module load plumed/2.7.1
module load gromacs/2025.2
# PLUMED with GROMACS (patched version)
job-nanny mpirun -np $SLURM_NTASKS gmx_mpi mdrun -s topol.tpr \
-plumed plumed.dat -o metadynamics.trr \
-e metadynamics.edr -c after.gro -g metadynamics.log
Job Submission with PLUMED + NAMD
submit_plumed_namd.sh
#!/bin/bash
#SBATCH -J plumed_namd
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 72:00:00
#SBATCH --mem-per-cpu=2G
export INPUT="simulation.namd plumed.dat"
export OUTPUT="plumed_results/"
module load plumed/2.7.1
module load namd/2.13-tcp
# Configure PLUMED for NAMD
export PLUMED_KERNEL=$PLUMED_ROOT/lib/libplumedKernel.so
job-nanny namd_mpi.sh simulation.namd
Example PLUMED File
plumed.dat
# Metadynamics for dihedral angle
dihedral: TORSION ATOMS=5,7,9,15
dihedral2: TORSION ATOMS=7,9,15,17
# Metadynamics with two CVs
METAD ...
LABEL=metad
ARG=dihedral,dihedral2
PACE=500
HEIGHT=1.2
SIGMA=0.35,0.35
FILE=HILLS
GRID_MIN=-pi,-pi
GRID_MAX=pi,pi
GRID_BIN=100,100
TEMP=300.0
... METAD
# Print CVs
PRINT ARG=dihedral,dihedral2,metad.* FILE=COLVAR STRIDE=10
Metadynamics with Free Energy Reconstruction
submit_metadynamics.sh
#!/bin/bash
#SBATCH -J metadynamics
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 168:00:00
#SBATCH --mem-per-cpu=2G
export INPUT="topol.tpr plumed_metad.dat"
export OUTPUT="metad_results/"
module load plumed/2.7.1
module load gromacs/2025.2
job-nanny mpirun -np $SLURM_NTASKS gmx_mpi mdrun -s topol.tpr \
-plumed plumed_metad.dat -o metad.trr \
-e metad.edr -c after.gro -g metad.log
plumed_metad.dat
# Collective variables
phi: TORSION ATOMS=5,7,9,15
psi: TORSION ATOMS=7,9,15,17
# Well-tempered metadynamics
METAD ...
ARG=phi,psi
PACE=500
HEIGHT=1.0
SIGMA=0.35,0.35
TEMP=300.0
BIASFACTOR=10
GRID_MIN=-pi,-pi
GRID_MAX=pi,pi
GRID_BIN=200,200
FILE=HILLS
LABEL=metad
... METAD
# Real-time analysis
PRINT ARG=phi,psi,metad.bias FILE=COLVAR STRIDE=100
Umbrella Sampling
submit_umbrella.sh
#!/bin/bash
#SBATCH -J umbrella
#SBATCH --array=1-20
#SBATCH -N 1
#SBATCH -c 28
#SBATCH -t 48:00:00
#SBATCH --mem=32G
CENTERS=$(seq -5.0 0.5 5.0)
CENTER_ARRAY=($CENTERS)
CENTER=${CENTER_ARRAY[$SLURM_ARRAY_TASK_ID-1]}
export INPUT="topol.tpr plumed_template.dat"
export OUTPUT="umbrella_${CENTER}/"
module load plumed/2.7.1
module load gromacs/2025.2
mkdir -p umbrella_${CENTER}
cd umbrella_${CENTER}
# Configure PLUMED for umbrella sampling
cat > plumed.dat << EOF
# Distance as collective variable
distance: DISTANCE ATOMS=10,15
# Harmonic restraint
RESTRAINT ARG=distance AT=$CENTER KAPPA=1000.0
# Output
PRINT ARG=distance,restraint.bias FILE=COLVAR STRIDE=10
EOF
job-nanny gmx_mpi mdrun -s ../topol.tpr -plumed plumed.dat \
-o umbrella.trr -e umbrella.edr -c after.gro
WHAM Analysis
analyze_wham.sh
#!/bin/bash
#SBATCH -J wham_analysis
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 04:00:00
#SBATCH --mem=8G
module load plumed/2.7.1
# Prepare files for WHAM
for dir in umbrella_*/; do
center=$(basename $dir | sed 's/umbrella_//')
echo "$dir/COLVAR $center 1000.0" >> wham_input.txt
done
# Run WHAM
plumed wham --temp 300.0 --outfile free_energy.dat \
--histfile histo.dat --min -5.0 --max 5.0 \
--bins 100 --tol 1e-6 < wham_input.txt
# Plot free energy
cat > plot_fe.py << 'EOF'
import numpy as np
import matplotlib.pyplot as plt
data = np.loadtxt('free_energy.dat')
cv = data[:,0]
fe = data[:,1]
plt.figure()
plt.plot(cv, fe, 'b-', linewidth=2)
plt.xlabel('Distance (nm)')
plt.ylabel('Free energy (kJ/mol)')
plt.title('Free energy profile')
plt.grid(True)
plt.savefig('free_energy.png', dpi=150)
EOF
python plot_fe.py
References
Documentation: https://www.plumed.org/doc
Tutorials: https://www.plumed.org/tutorials
Mailing list: https://groups.google.com/g/plumed-users
See also
GROMACS - Molecular dynamics
NAMD - Molecular dynamics
Running Simulations - How to submit jobs