#!/bin/bash
run_gromacs_dir_name=$1

if [ -z "$run_gromacs_dir_name" ]
then
echo "run_gromacs_dir_name missing"
echo "example : ./validate.sh run_01-13-20-17-10-24_compile_01-13-20-16-20-05"
exit 1
fi

cd $run_gromacs_dir_name
perf=`grep Performance results | awk '{ print $2 }'`
end_sim=`grep "Statistics over 20001 steps using 2001 frames" small_ion_channel.log`

mkdir results-gromacs-ion_channel_small
cp small_ion_channel* results-gromacs-ion_channel_small/.
cp slurm* results-gromacs-ion_channel_small/.
cp results results-gromacs-ion_channel_small/.
cd results-gromacs-ion_channel_small

if [ -z "$perf" ] || [ -z "$end_sim" ]
then
    echo "bench is not validated"
else
    echo bench is validated
    echo end = $end_sim
    echo perf = $perf ns/day
fi
