Skip to content

Commit 47867ec

Browse files
authored
Test: add more ut for UnitCell class (#2035)
* Test: add more ut for UnitCell class * more unit tests * fix bug * add annotations --------- Co-authored-by: root <hongriTianqi>
1 parent fd3d355 commit 47867ec

30 files changed

+1760
-8
lines changed

source/module_cell/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ endif()
2626

2727
if(BUILD_TESTING)
2828
add_subdirectory(test)
29+
add_subdirectory(test_pw)
2930
endif()
3031

source/module_cell/test/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ install(FILES bcast_atom_pseudo_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
88
install(FILES bcast_atom_spec_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
99
install(FILES parallel_kpoints_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
1010
install(FILES klist_test_para.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
11+
install(FILES unitcell_test_parallel.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
1112

1213
AddTest(
1314
TARGET cell_read_pp
1415
LIBS ${math_libs} base device
1516
SOURCES read_pp_test.cpp ../read_pp.cpp ../read_pp_upf201.cpp ../read_pp_upf100.cpp ../read_pp_vwr.cpp ../read_pp_blps.cpp
16-
../../module_io/output.cpp
17+
../../module_io/output.cpp
1718
)
1819

1920
AddTest(
@@ -104,3 +105,15 @@ AddTest(
104105
../read_pp_vwr.cpp ../read_pp_blps.cpp ../../module_io/output.cpp
105106
)
106107

108+
AddTest(
109+
TARGET cell_unitcell_test_setupcell
110+
LIBS ${math_libs} base device
111+
SOURCES unitcell_test_setupcell.cpp ../unitcell.cpp ../read_atoms.cpp ../read_cell_pseudopots.cpp ../atom_spec.cpp
112+
../atom_pseudo.cpp ../pseudo_nc.cpp ../read_pp.cpp ../read_pp_upf201.cpp ../read_pp_upf100.cpp
113+
../read_pp_vwr.cpp ../read_pp_blps.cpp ../../module_io/output.cpp
114+
)
115+
116+
add_test(NAME cell_unitcell_test_parallel
117+
COMMAND ${BASH} unitcell_test_parallel.sh
118+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
119+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---------------------------------------------------------------------------
2+
Element Mg
3+
Energy Cutoff(Ry) 100
4+
Radius Cutoff(a.u.) 8
5+
Lmax 2
6+
Number of Sorbital--> 4
7+
Number of Porbital--> 2
8+
Number of Dorbital--> 1
9+
---------------------------------------------------------------------------
10+
SUMMARY END
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---------------------------------------------------------------------------
2+
Element O
3+
Energy Cutoff(Ry) 100
4+
Radius Cutoff(a.u.) 8
5+
Lmax 2
6+
Number of Sorbital--> 2
7+
Number of Porbital--> 2
8+
Number of Dorbital--> 1
9+
---------------------------------------------------------------------------
10+
SUMMARY END
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
ATOMIC_SPECIES
2+
Mg 24.305 Mg_ONCV_PBE-1.0.upf upf201 #lable name pp_file pp_type
3+
O 15.999 O_ONCV_PBE-1.0.upf upf201
4+
5+
NUMERICAL_ORBITAL
6+
./support/Mg_gga_8au_100Ry_4s2p1d.orb
7+
./support/O_gga_8au_100Ry_2s2p1d.orb
8+
9+
NUMERICAL_DESCRIPTOR
10+
jle.orb
11+
12+
LATTICE_CONSTANT
13+
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
14+
15+
LATTICE_VECTORS
16+
4.27957 0.00000 0.00000
17+
0.00000 4.27957 0.00000
18+
0.00000 0.00000 4.27957
19+
20+
ATOMIC_POSITIONS
21+
Direct
22+
Mg
23+
0.0
24+
4
25+
0.0 0.0 0.0 m 0 0 0
26+
0.0 0.5 0.5 v 0 0 0
27+
0.5 0.0 0.5 mag 0 0 0
28+
0.5 0.5 0.0 angle1 0
29+
30+
O
31+
0.0
32+
4
33+
0.5 0.0 0.0 angle2 0
34+
0.5 0.5 0.5 mag 0 #we can add comments here
35+
0.0 0.0 0.5 0 0 0
36+
0.0 0.5 0.0 0 0 0
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ATOMIC_SPECIES
2+
Mg 24.305 Mg_ONCV_PBE-1.0.upf upf201 #lable name pp_file pp_type
3+
O 15.999 O_ONCV_PBE-1.0.upf upf201
4+
5+
NUMERICAL_ORBITAL
6+
Mg_gga_8au_100Ry_4s2p1d.orb
7+
O_gga_8au_100Ry_2s2p1d.orb
8+
9+
NUMERICAL_DESCRIPTOR
10+
jle.orb
11+
12+
LATTICE_CONSTANT
13+
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
14+
15+
LATTICE_PARAMETERS
16+
0.5
17+
0.5
18+
0.5
19+
0.5
20+
0.5
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ATOMIC_SPECIES
2+
Mg 24.305 Mg_ONCV_PBE-1.0.upf #comment for test
3+
O 15.999 O_ONCV_PBE-1.0.upf arbitrary #arbitray pp_type for test
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ATOMIC_SPECIES
2+
Mg 24.305 Mg_ONCV_PBE-1.0.upf upf201 #lable name pp_file pp_type
3+
O 15.999 O_ONCV_PBE-1.0.upf upf201
4+
5+
NUMERICAL_ORBITAL
6+
Mg_gga_8au_100Ry_4s2p1d.orb
7+
O_gga_8au_100Ry_2s2p1d.orb
8+
9+
LATTICE_CONSTANT
10+
-1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ATOMIC_SPECIES
2+
Mg 24.305 Mg_ONCV_PBE-1.0.upf upf201 #lable name pp_file pp_type
3+
O 15.999 O_ONCV_PBE-1.0.upf upf201
4+
5+
NUMERICAL_ORBITAL
6+
Mg_gga_8au_100Ry_4s2p1d.orb
7+
O_gga_8au_100Ry_2s2p1d.orb
8+
9+
LATTICE_CONSTANT
10+
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
11+
12+
LATTICE_PARAMETERS
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ATOMIC_SPECIES
2+
Mg 24.305 Mg_ONCV_PBE-1.0.upf upf201 #lable name pp_file pp_type
3+
O 15.999 O_ONCV_PBE-1.0.upf upf201
4+
5+
NUMERICAL_ORBITAL
6+
Mg_gga_8au_100Ry_4s2p1d.orb
7+
O_gga_8au_100Ry_2s2p1d.orb
8+
9+
LATTICE_CONSTANT
10+
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
11+
12+
LATTICE_VECTORS

0 commit comments

Comments
 (0)