#!/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 1200001 steps using 12001 frames" benchBSG.log`

mkdir results-gromacs-BSG_large
cp benchBSG.* results-gromacs-BSG_large/.
cp slurm* results-gromacs-BSG_large/.
cp results results-gromacs-BSG_large/.
cd results-gromacs-BSG_large

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
