#!/bin/sh
#
# Run all ligand simulations.
#

. ./windows

cd ligands

for step in decharge vdw_bonded; do
  cd $step
  echo "simulating $step"
	
  for w in ${strarr[@]}; do
    cd $w
    echo "changing directory to lambda = $w"

echo "sampling"

export CUDA_VISIBLE_DEVICES=1
	
$AMBERHOME/bin/pmemd.cuda -O -i md7.in -c ./eq4.rst7 -p ./ligands_ti.parm7 -o ./md7.out -x ./md7.nc -e ./md7.en -v ./md7vel -r ./md7.rst7

echo "equilibration for 300 ps"

mpirun -np 32 pmemd.MPI -O -i eq3.in -c md7.rst7 -p ./ligands_ti.parm7 -o eq3.out -x ./eq.nc -ref md7.rst7 -r ./eq.rst7

mpirun -np 32 pmemd.MPI -O -i eq4.in -c ./eq.rst7 -p ./ligands_ti.parm7 -o eq4.out -x ./eq.nc -r ./eq.rst7

echo "eq5 writing to eq4.rst7"

mpirun -np 32 pmemd.MPI -O -i eq5.in -c ./eq.rst7 -p ./ligands_ti.parm7 -o eq5.out -x ./eq.nc -r ./eq4.rst7


#echo "md10"

#mpirun -np 32 pmemd.MPI -O -i md10.in -c md9.rst7 -p ti.parm7 -o md10.out -x md10.nc -ref md9.rst7 -r md10.rst7


    cd ..
  done

echo "completed all simulations in $step"

  cd ..
done

