Skip to content

Commit 4fd6c02

Browse files
committed
test(integrate): add the test of out_wfc_r
1 parent fdd0709 commit 4fd6c02

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
INPUT_PARAMETERS
2+
#Parameters (1.General)
3+
suffix autotest
4+
calculation scf
5+
ntype 1
6+
nbands 6
7+
symmetry 1
8+
pseudo_dir ../tools/PP_ORB/
9+
pseudo_type upf201
10+
11+
#Parameters (2.Iteration)
12+
ecutwfc 20
13+
scf_thr 1e-9
14+
scf_nmax 100
15+
16+
#Parameters (3.Basis)
17+
basis_type pw
18+
19+
out_wfc_r 1

tests/integrate/107_PW_outWfcR/KPT

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
1 1 1 0 0 0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ATOMIC_SPECIES
2+
Si 14 Si_ONCV_PBE-1.0.upf
3+
4+
LATTICE_CONSTANT
5+
10.2 // add lattice constant
6+
7+
LATTICE_VECTORS
8+
0.5 0.5 0.0
9+
0.5 0.0 0.5
10+
0.0 0.5 0.5
11+
12+
ATOMIC_POSITIONS
13+
Direct
14+
15+
Si // Element type
16+
0.0 // magnetism
17+
2
18+
0.00 0.00 0.00 1 1 1
19+
0.25 0.25 0.25 1 1 1

tests/integrate/107_PW_outWfcR/jd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test the output of wfc_r, and compare the variance
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
etotref -197.1405644352783
2+
etotperatomref -98.5702822176
3+
variance_wfc_r_0_0 0.31340
4+
variance_wfc_r_0_1 2.68637
5+
variance_wfc_r_0_2 1.89907
6+
variance_wfc_r_0_3 1.96089
7+
variance_wfc_r_0_4 1.26491
8+
variance_wfc_r_0_5 0.84051
9+
totaltimeref 0.20294

tests/integrate/CASES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
106_PW_PU_chargemixing
3030
107_PW_OB_outputbands
3131
107_PW_OD_outputdos
32+
107_PW_outWfcR
3233
108_PW_RE
3334
108_PW_RE_MB
3435
108_PW_RE_MG

tests/integrate/tools/catch_properties.sh

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

0 commit comments

Comments
 (0)