Updated env.sh to be consistent with Gromacs tutorial
-# This file defines where WEST and Amber can be found.
-# Modify to taste
+#!/bin/sh
+#
+# env.sh
+#
+# This script defines environment variables that are used by other shell
+# scripts, both when setting up the simulation and when running the simulation.
+#
-# Inform WEST where to find Amber.
-# If AMBERHOME isn't set, it's unlikely that the libraries can be found, regardless of whether cpptraj/pmemd exist in the path.
+################################ AMBER #######################################
+
+# First we'll make sure AMBERHOME is set. If AMBERHOME isn't set, it's unlikely
+# that the libraries can be found, regardless of whether cpptraj/pmemd exist
+# in the path.
if [[ -z "$AMBERHOME" ]]; then
- echo "AMBERHOME environ variable not set. Source amber.sh, or modify env.sh such that WESTPA knows where AMBER is."
+ echo "AMBERHOME environment variable is not set."
+ echo "Source amber.sh, or modify env.sh so that WESTPA knows where AMBER is."
exit
fi
-export PATH=$AMBERHOME/bin:$PATH
-
-# Set environment variables for Amber for convenience
+# Next, set environment variables for pmemd and cpptraj. This is good practice
+# for running WESTPA simulations on clusters, as repeatedly calling "pmemd" or
+# "cpptraj" rather than the absolute path to these binaries (e.g.,
+# "/usr/local/amber/bin/pmemd") can take a long time and be harder on the
+# filesystem. For this tutorial, this step is not necessary but nonetheless
+# demonstrates good practice.
export PMEMD=$(which pmemd)
export CPPTRAJ=$(which cpptraj)
-# Inform WEST where to find Python and our other scripts where to find WEST
+############################## Python and WESTPA ###############################
+# Next inform WESTPA what python it should use.
export WEST_PYTHON=$(which python2.7)
-if [[ -z "$WEST_ROOT" ]]; then
- echo "Please set the environment variable WEST_ROOT"
- exit
+# Check to make sure that the environment variable WEST_ROOT is set.
+# Here, the code '[ -z "$WEST_ROOT"]' will return TRUE if WEST_ROOT is not set,
+# causing us to enter the if-statement, print an error message, and exit.
+if [ -z "$WEST_ROOT" ]; then
+ echo "The environment variable WEST_ROOT is not set."
+ echo "Try running 'source westpa.sh' from the WESTPA installation directory"
+ exit 1
fi
-# Explicitly name our simulation root directory
-if [[ -z "$WEST_SIM_ROOT" ]]; then
+# Explicitly name our simulation root directory. Similar to the statement
+# above, we check if the variable is not set. If the variable is not set,
+# the we set it
+if [ -z "$WEST_SIM_ROOT" ]; then
export WEST_SIM_ROOT="$PWD"
fi
-# Set simulation name
+# Set the simulation name. Whereas "WEST_SIM_ROOT" gives us the entire
+# absolute path to the simulation directory, running the "basename" command
+# will give us only the last part of that path (the directory name).
export SIM_NAME=$(basename $WEST_SIM_ROOT)
-echo "simulation $SIM_NAME root is $WEST_SIM_ROOT"
