3 # Writen by Dawid Jagieła and Adam Sieradzan
6 #----------------------------------------
9 extremediff="10000.0" # extreme energy difference, comething went terribly wrong
10 expectenergy="-56066670.000000" # expected total energy
11 cutoffdiff="0.1" # energy cutoff variation - more then this rises warning
12 file=$1 # Output file to search energy value from
15 echo $1 | sed -e 's/[eE]+/*10^/'
18 #---------------------------------------------------------------------------
20 #---------------------------------------------------------------------------
23 if [ ! -f $file ]; then
24 echo "CRITICAL: out file do not exist"
28 # Check if energy value is not a number
29 grepene=`grep ETOT $file| awk '{print $2}'`
30 if [[ $grepene == "NaN" ]]; then
31 echo "CRITICAL: energy is NaN"
35 # Check if energy value is extremely different from expected
36 blaene=`floating $grepene`
37 myene=`echo $blaene |bc`
38 diff=`echo $myene"+("$expectenergy")"|bc`
39 absdiff=`echo $diff| sed 's/-//'`
41 true1=`echo "$absdiff >= $extremediff"|bc`
42 if [ $true1 -eq 1 ]; then
43 echo "CRITICAL: energy is loo large $absdiff, ene= $myene"
47 # Check if Energy value is as expected
48 true2=`echo "$absdiff<=$cutoffdiff"|bc`
49 if [ $true2 -eq 1 ]; then
50 echo "OK: absdiff= $absdiff, ene= $myene"
53 echo "WARNING: energy is somewhat different $absdiff, ene= $myene"