GROMACS Tutorial

Step Three: Running the Calculations

The job.sh script I provide for running these calculations will create the following directory hierarchy:

Lambda_0/
Lambda_0/EM/
Lambda_0/NVT/
Lambda_0/NPT/
Lambda_0/Production_MD/

This way, all steps in the workflow are executed within a single directory for each value of init_lambda_state. I find this to be a convenient way to organize the jobs and their output. The script also assumes that the .mdp files are also organized in some directory $MDP, which is set as an environment variable in the script.

As described before, energy minimization will be conducted using the steepest descent method. Note that the output coordinates of each λ state are used as the input to the next, which improves convergence. The sequence of jobs is executed by the following job.sh Bash script:

#!/bin/bash

FREE_ENERGY=`pwd`
MDP=$FREE_ENERGY/MDP

for (( i=0; i<31; i++ ))
do
    lambda=$i
    prevlambda="$(($i - 1))"

    mkdir Lambda_$lambda
    cd Lambda_$lambda

    coorfile=$FREE_ENERGY/etoh_solv.gro
    if [[ $i -gt 1 ]]; then
        coorfile=$FREE_ENERGY/Lambda_$prevlambda/Production_MD/md$prevlambda.gro
    fi

    #################################
    # ENERGY MINIMIZATION 1: STEEP  #
    #################################
    echo "Starting minimization for lambda = $LAMBDA..."

    mkdir EM
    cd EM

    # Iterative calls to grompp and mdrun to run the simulations
    gmx grompp -f $MDP/em_steep_$LAMBDA.mdp -c $coorfile  -p $FREE_ENERGY/topol.top -o min$LAMBDA.tpr
    gmx mdrun -deffnm min$LAMBDA
    echo "Minimization complete."

    #####################
    # NVT EQUILIBRATION #
    #####################
    echo "Starting constant volume equilibration..."

    cd ../
    mkdir NVT
    cd NVT

    gmx grompp -f $MDP/nvt_$LAMBDA.mdp -c ../EM/min$LAMBDA.gro -p $FREE_ENERGY/topol.top -o nvt$LAMBDA.tpr
    gmx mdrun -deffnm nvt$LAMBDA
    echo "Constant volume equilibration complete."

    #####################
    # NPT EQUILIBRATION #
    #####################
    echo "Starting constant pressure equilibration..."

    cd ../
    mkdir NPT
    cd NPT

    gmx grompp -f $MDP/npt_$LAMBDA.mdp -c ../NVT/nvt$LAMBDA.gro -p $FREE_ENERGY/topol.top -t ../NVT/nvt$LAMBDA.cpt -o npt$LAMBDA.tpr
    gmx mdrun -deffnm npt$LAMBDA
    echo "Constant pressure equilibration complete."

    #################
    # PRODUCTION MD #
    #################
    echo "Starting production MD simulation..."

    cd ../
    mkdir Production_MD
    cd Production_MD

    gmx grompp -f $MDP/md_$LAMBDA.mdp -c ../NPT/npt$LAMBDA.gro -p $FREE_ENERGY/topol.top -t ../NPT/npt$LAMBDA.cpt -o md$LAMBDA.tpr
    gmx mdrun -deffnm md$LAMBDA
    echo "Production MD complete."

    echo "Ending. Job completed for lambda = $lambda"

    cd $FREE_ENERGY
done

exit;
Back: The Workflow Next: Analysis

Site design and content copyright Justin Lemkul
Problems with the site? Send them to the Webmaster