#!/bin/bash
compile_gromacs_dir_name=$1

if [ -z "$compile_gromacs_dir_name" ]
then
echo "compile_gromacs_dir_name missing"
echo "example : ./prepare.sh compile_01-13-20-16-20-05"
exit 1
fi

run_date=`date +"%m-%d-%y-%H-%M-%S"`
run_dir=run_${run_date}_${compile_gromacs_dir_name}
mkdir $run_dir
cd $run_dir
cp ../ion_channel.tpr .
cp ../../machines/${GROMACS_MACHINE}/batch_large_ion_channel.slurm batch_large_ion_channel.slurm.tmp.tmp
awk '$1=$1' FS="GROMACS_HOME" OFS="../../${compile_gromacs_dir_name}/gromacs/2019.4" batch_large_ion_channel.slurm.tmp.tmp > batch_large_ion_channel.slurm.tmp
awk '$1=$1' FS="GROMACS_HOME" OFS="../../${compile_gromacs_dir_name}/gromacs/2019.4"  batch_large_ion_channel.slurm.tmp >  batch_large_ion_channel.slurm
rm -f  batch_large_ion_channel.slurm.tmp.tmp batch_large_ion_channel.slurm.tmp
