#!/bin/bash

# Submit a serial pmemd job

export AMBERHOME=/programs/amber12
export PATH=/programs/local/bin:/programs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/programs/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/torque/bin
export LD_LIBRARY_PATH=/programs/local/lib:/programs/lib:/usr/local/lib:::/programs/lib:/usr/local/lib


#
# Minimization
#
/programs/amber12/bin/pmemd \
 -p ../input/4_SolCl.parm7 \
 -c ../input/4_SolCl.rst7 \
 -i ../../min.in \
 -o min.o \
 -r min.rst7 \
 -x min.nc \
 -inf min.info \
 -l min.log 
#


if grep -q "Total wall time" min.o  ; then
#
# Heating
#
/programs/amber12/bin/pmemd \
 -p ../input/4_SolCl.parm7 \
 -c min.rst7 \
 -i ../../heat2.in \
 -o heat.o \
 -r heat.rst7 \
 -x heat.nc \
 -inf heat.info \
 -l heat.log 
#


fi 

if grep -q "Total wall time" heat.o  ; then
#
# Equilibration
#
/programs/amber12/bin/pmemd \
 -p ../input/4_SolCl.parm7 \
 -c heat.rst7 \
 -i ../../equil2.in \
 -o equil.o \
 -r equil.rst7 \
 -x equil.nc \
 -inf equil.info \
 -l equil.log 
#


fi 

if grep -q "Total wall time" equil.o  ; then
#
# Production
#
/programs/amber12/bin/pmemd \
 -p ../input/4_SolCl.parm7 \
 -c equil.rst7 \
 -i ../../prod2.in \
 -o prod.o \
 -r prod.rst7 \
 -x prod.nc \
 -inf prod.info \
 -l prod.log 
#


fi 
