Skip to content

Commit 01e8920

Browse files
authored
Merge pull request #968 from pxlxingliang/develop
test(integrate): add the test of out_wfc_r
2 parents 3372a54 + e8c4262 commit 01e8920

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`
@@ -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
112113
fi
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
114137
if ! test -z "$has_lowf" && [ $has_lowf -eq 1 ]; then
115138
if ! test -z "$gamma_only" && [ $gamma_only -eq 1 ]; then

0 commit comments

Comments
 (0)