Updated init.sh to be consistent with gmx tutorial
#!/bin/bash
+#
+# init.sh
+#
+# Initialize the WESTPA simulation, creating initial states (istates) and the
+# main WESTPA data file, west.h5.
+#
+# If you run this script after starting the simulation, the data you generated
+# will be erased!
+#
+
source env.sh
-ps aux | grep w_run | grep -v grep
+
+# Make sure that WESTPA is not already running. Running two instances of
+# WESTPA on a single node/machine can cause problems.
+# The following line will kill any WESTPA process that is currently running.
pkill -9 -f w_run
-SFX=.d$$
-mv traj_segs{,$SFX}
-mv seg_logs{,$SFX}
-mv istates{,$SFX}
-rm -Rf traj_segs$SFX seg_logs$SFX istates$SFX & disown %1
-rm -f system.h5 west.h5 seg_logs.tar
+# Make sure that seg_logs (log files for each westpa segment), traj_segs (data
+# from each trajectory segment), and istates (initial states for starting new
+# trajectories) directories exist and are empty.
+rm -rf traj_segs seg_logs istates west.h5
mkdir seg_logs traj_segs istates
-cp prep/1_leap/nacl.parm7 amber_config/
-cp prep/4_eq2/4_eq2.rst bstates/nacl_init.rst
+# Define the arguments for the basis states (used for generating initial
+# states; in this case we only have one), and target states (used for
+# knowing when to recycle trajectories). In this example, we recycle
+# trajectories as they reach the bound state; we focus on sampling
+# the binding process (and not the unbinding process).
BSTATE_ARGS="--bstate-file bstates/bstates.txt"
TSTATE_ARGS="--tstate bound,1.8"
-$WEST_ROOT/bin/w_init $BSTATE_ARGS $TSTATE_ARGS --segs-per-state 24 \
+# Initialize the simulation, creating the main WESTPA data file (west.h5)
+# The "$@" lets us take any arguments that were passed to init.sh at the
+# command line and pass them along to w_init.
+$WEST_ROOT/bin/w_init \
+ $BSTATE_ARGS $TSTATE_ARGS \
+ --segs-per-state 5 \
--work-manager=threads "$@"
