Skip to content

Commit

Permalink
test: modify the script to read energy from running_wcf_xx.log in exa…
Browse files Browse the repository at this point in the history
…mple/bsse
  • Loading branch information
pxlxingliang committed May 29, 2024
1 parent aec6760 commit 3ad133a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
6 changes: 5 additions & 1 deletion examples/bsse/water/result.ref
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
-13.3178
-13.31774791420906
E_H2O: -466.1219344619547
E_O: -427.6267373722137
E_H1: -12.58872471938786
E_H2: -12.58872445614408
18 changes: 11 additions & 7 deletions examples/bsse/water/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ mv OUT.ABACUS/running_scf.log OUT.ABACUS/running_scf_H2.log

rm STRU

E_H2O=`grep GE H2O_scf.output | tail -n 1 | awk '{printf $2}'`
E_O=`grep GE O_scf.output | tail -n 1 | awk '{printf $2}'`
E_H1=`grep GE H1_scf.output | tail -n 1 | awk '{printf $2}'`
E_H2=`grep GE H2_scf.output | tail -n 1 | awk '{printf $2}'`
result=$(awk 'BEGIN{print "'$E_H2O'" - "'$E_O'" - "'$E_H1'" - "'$E_H2'"}')
E_H2O=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_H2O.log | awk '{printf $2}')
E_O=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_O.log | awk '{printf $2}')
E_H1=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_H1.log | awk '{printf $2}')
E_H2=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_H2.log | awk '{printf $2}')
result=$(echo "scale=12; ${E_H2O} - ${E_O} - ${E_H1} - ${E_H2}" | bc -l)
echo $result > result.out
result_ref=$(cat result.ref)
difference=$(awk 'BEGIN{print "'$result'" - "'$result_ref'"}')
echo "E_H2O: $E_H2O" >> result.out
echo "E_O: $E_O" >> result.out
echo "E_H1: $E_H1" >> result.out
echo "E_H2: $E_H2" >> result.out
result_ref=$(cat result.ref | head -1)
difference=$(echo "scale=12; $result - $result_ref" | bc -l)
difference=$(awk -v a=$difference 'BEGIN{if(a<0) print -1*a; else print a}')

if [[ ! -f H2O_scf.output ]] ||
Expand Down

0 comments on commit 3ad133a

Please sign in to comment.