Skip to content

Commit d5bb0c7

Browse files
committed
test(integrate): istate calculation in lcao
1 parent fdd0709 commit d5bb0c7

File tree

11 files changed

+232
-7
lines changed

11 files changed

+232
-7
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 (System)
3+
suffix autotest
4+
ntype 1
5+
nbands 4
6+
stru_file STRU
7+
kpoint_file KPT
8+
pseudo_dir ../tools/PP_ORB/
9+
orbital_dir ../tools/PP_ORB/
10+
latname sc
11+
#Parameters (PW)
12+
ecutwfc 25.0 # Rydberg
13+
#Parameters (electronic)
14+
basis_type lcao
15+
scf_thr 1e-10
16+
17+
calculation istate
18+
gamma_only 1
19+
read_file_dir ./
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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
4 (number of bands)
2+
10 (number of orbitals)
3+
1 (band)
4+
-7.57096415e-01 (Ry)
5+
2.00000000e+00 (Occupations)
6+
-5.37362289e-01 -3.68451648e-02 -1.55131570e-02 -2.64865890e-16 1.05515886e-16
7+
-5.37362289e-01 -3.68451648e-02 1.55131570e-02 2.31512618e-16 -9.17998044e-17
8+
2 (band)
9+
3.05607270e-01 (Ry)
10+
0.00000000e+00 (Occupations)
11+
1.86655079e+00 -5.99493369e-01 6.23278504e-02 -6.10257790e-16 -1.07130366e-15
12+
-1.86655079e+00 5.99493369e-01 6.23278504e-02 -9.70034830e-16 3.67511274e-16
13+
3 (band)
14+
7.03394915e-01 (Ry)
15+
0.00000000e+00 (Occupations)
16+
3.77198799e-02 5.60791988e-01 2.09803877e-02 4.76540590e-17 -1.21321449e-16
17+
3.77198799e-02 5.60791988e-01 -2.09803877e-02 -8.28199028e-16 8.17735629e-17
18+
4 (band)
19+
1.63463390e+00 (Ry)
20+
0.00000000e+00 (Occupations)
21+
1.12080703e+00 -7.94507151e-01 6.75140264e-01 -8.64606026e-16 -1.08079951e-15
22+
-1.12080703e+00 7.94507151e-01 6.75140264e-01 -2.39467947e-15 1.47720374e-16
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#This is the atom file containing all the information
2+
#about the lattice structure.
3+
4+
ATOMIC_SPECIES
5+
H 1.0008 H_ONCV_PBE-1.0.upf
6+
7+
NUMERICAL_ORBITAL
8+
H_gga_6au_60Ry_2s1p.orb
9+
10+
LATTICE_CONSTANT
11+
10.0 #Lattice constant
12+
13+
ATOMIC_POSITIONS
14+
Cartesian #Cartesian(Unit is LATTICE_CONSTANT)
15+
H #Name of element
16+
0.0 #Magnetic for this element.
17+
2 #Number of atoms
18+
0.00 0.00 -0.0661400 0 0 0 #x,y,z, move_x, move_y, move_z
19+
0.00 0.00 0.0661400 0 0 0 #x,y,z, move_x, move_y, move_z
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
istate calculation for lcao gamma_only
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
BAND1_CHG 2.00064
2+
BAND2_CHG 2.00508
3+
BAND3_CHG 2.0031
4+
BAND4_CHG 2.01085
5+
BAND1_SPIN0_CHG.cube 2.06078
6+
BAND2_SPIN0_CHG.cube 2.07625
7+
BAND3_SPIN0_CHG.cube 2.07026
8+
BAND4_SPIN0_CHG.cube 2.0698
9+
totaltimeref 0.39732

tests/integrate/CASES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
311_NO_GO_S2_elec_minus
134134
312_NO_GO_wfc_out
135135
312_NO_GO_wfc_ienvelope
136+
312_NO_GO_wfc_istate
136137
320_NO_GO_MD_FIRE
137138
320_NO_GO_MD_NVE
138139
320_NO_GO_MD_NVT

tests/integrate/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ else()
1414
)
1515
add_executable(sum_ENV_H2 ${ABACUS_TEST_DIR}/integrate/tools/sum_ENV_H2.cpp)
1616
install(TARGETS sum_ENV_H2 DESTINATION ${ABACUS_TEST_DIR}/integrate/tools/)
17+
add_executable(sum_BAND_CHG_H2 ${ABACUS_TEST_DIR}/integrate/tools/sum_BAND_CHG_H2.cpp)
18+
install(TARGETS sum_BAND_CHG_H2 DESTINATION ${ABACUS_TEST_DIR}/integrate/tools/)
19+
add_executable(sum_BAND_CHG_H2_cube ${ABACUS_TEST_DIR}/integrate/tools/sum_BAND_CHG_H2_cube.cpp)
20+
install(TARGETS sum_BAND_CHG_H2_cube DESTINATION ${ABACUS_TEST_DIR}/integrate/tools/)
1721
endif()

tests/integrate/tools/catch_properties.sh

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ test -e $1 && rm $1
4848
#--------------------------------------------
4949
# if NOT non-self-consistent calculations
5050
#--------------------------------------------
51-
if [ $calculation != "nscf" ] && [ $calculation != "ienvelope" ]; then
51+
if [ $calculation != "nscf" ] && [ $calculation != "ienvelope" ]\
52+
&& [ $calculation != "istate" ] ; then
5253
etot=`grep ETOT_ $running_path | awk '{print $2}'`
5354
etotperatom=`awk 'BEGIN {x='$etot';y='$natom';printf "%.10f\n",x/y}'`
5455
echo "etotref $etot" >>$1
@@ -142,12 +143,42 @@ fi
142143
if [ $calculation == "ienvelope" ]; then
143144
nfile=0
144145
envfiles=`ls OUT.autotest/ | grep ENV`
145-
for env in $envfiles;
146-
do
147-
nelec=`../tools/sum_ENV_H2 OUT.autotest/$env`
148-
nfile=$(($nfile+1))
149-
echo "nelec$nfile $nelec" >>$1
150-
done
146+
if test -z "$envfiles"; then
147+
echo "Can't find ENV(-elope) files"
148+
exit 1
149+
else
150+
for env in $envfiles;
151+
do
152+
nelec=`../tools/sum_ENV_H2 OUT.autotest/$env`
153+
nfile=$(($nfile+1))
154+
echo "nelec$nfile $nelec" >>$1
155+
done
156+
fi
157+
fi
158+
159+
if [ $calculation == "istate" ]; then
160+
chgfiles=`ls OUT.autotest/ | grep -E '_CHG$'`
161+
if test -z "$chgfiles"; then
162+
echo "Can't find BAND_CHG files"
163+
exit 1
164+
else
165+
for chg in $chgfiles;
166+
do
167+
total_chg=`../tools/sum_BAND_CHG_H2 OUT.autotest/$chg`
168+
echo "$chg $total_chg" >>$1
169+
done
170+
fi
171+
cubefiles=`ls OUT.autotest/ | grep -E '.cube$'`
172+
if test -z "$cubefiles"; then
173+
echo "Can't find BAND_CHG files"
174+
exit 1
175+
else
176+
for cube in $cubefiles;
177+
do
178+
total_chg=`../tools/sum_BAND_CHG_H2_cube OUT.autotest/$cube`
179+
echo "$cube $total_chg" >>$1
180+
done
181+
fi
151182
fi
152183

153184
#echo $total_band
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include <string>
2+
#include <iostream>
3+
#include <sstream>
4+
#include <fstream>
5+
#include <iomanip>
6+
#include <cmath>
7+
8+
using namespace std;
9+
10+
int main(int argc, char **argv)
11+
{
12+
string input_file = argv[1];
13+
14+
ifstream inp(input_file.c_str(), ios::in);
15+
16+
if (!inp)
17+
{
18+
cout << "\e[1;31m [ FAILED ] \e[0m";
19+
cout << "Can't find " << input_file << " !" << endl;
20+
return 1;
21+
}
22+
23+
int nx = 0;
24+
int ny = 0;
25+
int nz = 0;
26+
int nr = 0;
27+
double a0 = 0.0;
28+
std::string tmpstring;
29+
getline(inp, tmpstring);
30+
inp >> a0;
31+
//std::cout<< "a0 "<< a0<<std::endl;
32+
for (int i = 0; i < 9; i++) getline(inp, tmpstring);
33+
inp >> nx >> ny >> nz;
34+
35+
nr = nx*ny*nz;
36+
37+
double sum = 0.0;
38+
double env = 0.0;
39+
for (int i=0; i< nr; i++)
40+
{
41+
inp >> env;
42+
sum += env;
43+
}
44+
45+
double ne = 0.0;
46+
47+
a0 /= 0.529177;
48+
ne = sum * a0 * a0 * a0 / nr;
49+
//std::cout<<nx<<"--"<<ny<<"--"<<nz<<std::endl;
50+
//std::cout<<" sum = "<<sum<< " ne = "<<ne<<std::endl;
51+
std::cout<<ne<<std::endl;
52+
53+
54+
return 0;
55+
}

0 commit comments

Comments
 (0)