#!/bin/bash

# Submit a serial pmemd job

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


#
# Minimization
#
/programs/gpu/amber12/bin/pmemd \
 -p ../input/22_SolCl.parm7 \
 -c ../input/22_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/gpu/amber12/bin/pmemd \
 -p ../input/22_SolCl.parm7 \
 -c min.rst7 \
 -i ../../heat1.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/gpu/amber12/bin/pmemd \
 -p ../input/22_SolCl.parm7 \
 -c heat.rst7 \
 -i ../../equil1.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/gpu/amber12/bin/pmemd \
 -p ../input/22_SolCl.parm7 \
 -c equil.rst7 \
 -i ../../prod_protein.in \
 -o prod.o \
 -r prod.rst7 \
 -x prod.nc \
 -inf prod.info \
 -l prod.log 
#


fi 
