@@ -36,6 +36,7 @@ has_r=`grep -En '(^|[[:space:]])out_mat_r($|[[:space:]])' INPUT | awk '{print $2
3636deepks_out_labels=` grep deepks_out_labels INPUT | awk ' {print $2}' | sed s/[[:space:]]//g`
3737deepks_bandgap=` grep deepks_bandgap INPUT | awk ' {print $2}' | sed s/[[:space:]]//g`
3838has_lowf=` grep out_wfc_lcao INPUT | awk ' {print $2}' | sed s/[[:space:]]//g`
39+ has_wfc_r=` grep out_wfc_r INPUT | awk ' {print $2}' | sed s/[[:space:]]//g`
3940gamma_only=` grep gamma_only INPUT | awk ' {print $2}' | sed s/[[:space:]]//g`
4041# echo $running_path
4142base=` grep -En ' (^|[[:space:]])basis_type($|[[:space:]])' INPUT | awk ' {print $2}' | sed s/[[:space:]]//g`
@@ -110,6 +111,28 @@ if ! test -z "$has_hs" && [ $has_hs -eq 1 ]; then
110111 total_s=` sum_file OUT.autotest/data-0-S`
111112 echo " totalSmatrix $total_s " >> $1
112113fi
114+
115+ # echo "$has_wfc_r" ## test out_wfc_r > 0
116+ if ! test -z " $has_wfc_r " && [ $has_wfc_r -eq 1 ]; then
117+ if [[ ! -f OUT.autotest/running_scf.log ]]; then
118+ echo " Can't find file OUT.autotest/running_scf.log"
119+ exit 1
120+ fi
121+ nband=$( grep NBANDS OUT.autotest/running_scf.log| awk ' {print $3}' )
122+ allgrid=$( grep " fft grid for wave functions" OUT.autotest/running_scf.log| awk -F " [=,]" ' {print $2*$3*$4}' )
123+ for(( band= 0 ;band< $nband ;band++ )) ; do
124+ if [[ -f " OUT.autotest/wfc_realspace/wfc_realspace_0_$band " ]]; then
125+ variance_wfc_r=` sed -n " 13,$" p OUT.autotest/wfc_realspace/wfc_realspace_0_$band | \
126+ awk -v all=$allgrid ' BEGIN {sumall=0} {for(i=1;i<=NF;i++) {sumall+=($i-1)*($i-1)}}\
127+ END {printf"%.5f",(sumall/all)}' `
128+ echo " variance_wfc_r_0_$band $variance_wfc_r " >> $1
129+ else
130+ echo " Can't find file OUT.autotest/wfc_realspace/wfc_realspace_0_$band "
131+ exit 1
132+ fi
133+ done
134+ fi
135+
113136# echo "$has_lowf" ## test out_wfc_lcao > 0
114137if ! test -z " $has_lowf " && [ $has_lowf -eq 1 ]; then
115138 if ! test -z " $gamma_only " && [ $gamma_only -eq 1 ]; then
0 commit comments