Skip to main content
Texas Tech University

NAMD

Introduction

NAMD (Nanoscale Molecular Dynamics) is a high-performance, parallel software package used to simulate the physical movements of large biomolecular systems such as proteins, nucleic acids, and lipid bilayers.

Running NAMD in HPCC

Submitting a NAMD job to Nocona

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

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

#!/bin/bash  
#SBATCH --job-name=namd_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 namd/3.0.1

# Capture the system settings and set MPI and OMP options
CORES_PER_L3CACHE=4
NUM_CORES=$SLURM_NTASKS 

# 4 threads per MPI rank
export OMP_NUM_THREADS=${CORES_PER_L3CACHE}
MPI_RANKS=$(( NUM_CORES / OMP_NUM_THREADS )) 

# NAMD process layout: map each MPI rank to an l3cache, where each rank uses
# 4 threads (1 communication thread and 3 worker threads).

NAMD_layout=" +ppn $(expr ${OMP_NUM_THREADS} - 1) \
      +commap 0-${NUM_CORES}:${OMP_NUM_THREADS} \
      +pemap 1-$(expr ${NUM_CORES} - 1):${OMP_NUM_THREADS}.$(expr ${OMP_NUM_THREADS} - 1)" 

# Run the calculation in parallel
mpirun -np $MPI_RANKS --bind-to core namd3 $NAMD_layout stmv.namd
#!/bin/bash  
#SBATCH --job-name=namd_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 aocc/4.2.0 openmpi/5.0.5 namd/3.0.1

# Capture the system settings and set MPI and OMP options
CORES_PER_L3CACHE=4
NUM_CORES=$SLURM_NTASKS 

# 4 threads per MPI rank
export OMP_NUM_THREADS=${CORES_PER_L3CACHE}
MPI_RANKS=$(( NUM_CORES / OMP_NUM_THREADS )) 

# NAMD process layout: map each MPI rank to an l3cache, where each rank uses
# 4 threads (1 communication thread and 3 worker threads).

NAMD_layout=" +ppn $(expr ${OMP_NUM_THREADS} - 1) \
      +commap 0-${NUM_CORES}:${OMP_NUM_THREADS} \
      +pemap 1-$(expr ${NUM_CORES} - 1):${OMP_NUM_THREADS}.$(expr ${OMP_NUM_THREADS} - 1)" 

# Run the calculation in parallel
mpirun -np $MPI_RANKS --bind-to core namd3 $NAMD_layout stmv.namd

Submitting a NAMD job to Quanah

There are two NAMD modules in Quanah: NAMD built against Intel OneAPI and NAMD built against GCC 14.2.0.

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

#!/bin/bash
#SBATCH --job-name=namd_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 namd/3.0.1-mkl

# Run command with NAMD
mpirun -np $SLURM_NTASKS namd3 simulation.namd
#!/bin/bash
#SBATCH --job-name=namd_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 namd/3.0.1

# Run command with NAMD
mpirun -np $SLURM_NTASKS namd3 simulation.namd

Submitting a GPU NAMD job to Matador or Toreador

#!/bin/bash  
#SBATCH --job-name=namd_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 namd/3.0.1-gpu

# Run command with NAMD
namd3 +p${SLURM_NTASKS} +devices ${CUDA_VISIBLE_DEVICES} \
               +setcpuaffinity +idlepoll simulation.namd

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.