simgi-0.3: test/check_irreversible_bimol/run_test.2.sh
#!/bin/bash
#
# short wrapper for runing a number of reversible
# simulations and then checking if we can reproduce
# the correct average product concentration
#
# expected values of molecule counts
a_expect=1000.000000000000000
b_expect=0.000000000000000
c_expect=1000.000000000000000
#
simgi_exe="${1}"
# our global status
status=0
for ((counter=0; counter <= 100; counter++)); do
# provide a little "progressbar"
printf "."
# run and process
${simgi_exe} irreversible_bimol.2.sgl >& /dev/null
a=$(tail -n 1 irreversible_bimol.2.dat | gawk ' { print $3 }')
b=$(tail -n 1 irreversible_bimol.2.dat | gawk ' { print $4 }')
c=$(tail -n 1 irreversible_bimol.2.dat | gawk ' { print $5 }')
result_a=$(echo "${a} == ${a_expect}" | bc)
result_b=$(echo "${b} == ${b_expect}" | bc)
result_c=$(echo "${c} == ${c_expect}" | bc)
if [[ ${result_a} == 0 || ${result_b} == 0 || ${result_c} == 0 ]];
then
status=1
fi
# unlink
rm -f irreversible_bimol.2.dat || return 1
done
# check if all the tests passed
# brief output
if [[ ${status} == 0 ]]; then
echo
echo
echo "Congratulations - the irreversible reaction test 2 passed!"
echo
echo
else
echo
echo
echo "Error - the irreversible reaction test failed. Please check!"
echo
echo
fi
# return status of deviation check
exit ${status}