Skip to content

Commit 49c6d61

Browse files
authored
Test: add ut of input (#1683)
* Test: add ut of input * update annotationns * restore features of inpt-main.md * restore input-main.md
1 parent e0230bf commit 49c6d61

File tree

13 files changed

+998
-19
lines changed

13 files changed

+998
-19
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ These variables are used to control parameters related to input files.
315315

316316
- **Type**: String
317317
- **Description**: Relevant when using ABACUS with wannier90. Tells the name of the input file related to wannier90.
318-
- **Default**: ""
318+
- **Default**: "none"
319319

320320
[back to top](#full-list-of-input-keywords)
321321

@@ -357,7 +357,7 @@ These variables are used to control the plane wave related parameters.
357357

358358
- **Type**: Integer
359359
- **Description**: Only useful when you use `ks_solver = dav`. It indicates the maximal dimension for the Davidson method.
360-
- **Default**: 10
360+
- **Default**: 4
361361

362362
[back to top](#full-list-of-input-keywords)
363363

source/input.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void Input::Default(void)
129129
orbital_dir = ""; // liuyu add 2021-08-14
130130
read_file_dir = "auto";
131131
// pseudo_type = "auto"; // mohan add 2013-05-20 (xiaohui add 2013-06-23)
132-
wannier_card = "";
132+
wannier_card = "none";
133133
latname = "none";
134134
// xiaohui modify 2015-09-15, relax -> scf
135135
// calculation = "relax";
@@ -142,6 +142,8 @@ void Input::Default(void)
142142
nbands_sto = 256;
143143
nbands_istate = 5;
144144
pw_seed = 1;
145+
emin_sto = 0.0;
146+
emax_sto = 0.0;
145147
nche_sto = 100;
146148
seed_sto = 0;
147149
bndpar = 1;
@@ -160,7 +162,7 @@ void Input::Default(void)
160162
berry_phase = false;
161163
gdir = 3;
162164
towannier90 = false;
163-
NNKP = "seedname.nnkp";
165+
nnkpfile = "seedname.nnkp";
164166
wannier_spin = "up";
165167
kspacing = 0.0;
166168
min_dist_coef = 0.2;
@@ -293,14 +295,15 @@ void Input::Default(void)
293295
out_proj_band = 0;
294296
out_mat_hs = 0;
295297
out_mat_hs2 = 0; // LiuXh add 2019-07-15
298+
out_hs2_interval = 1;
296299
out_mat_r = 0; // jingan add 2019-8-14
297300
out_wfc_lcao = false;
298301
out_alllog = false;
299302
dos_emin_ev = -15; //(ev)
300303
dos_emax_ev = 15; //(ev)
301304
dos_edelta_ev = 0.01; //(ev)
302305
dos_scale = 0.01;
303-
b_coef = 0.07;
306+
dos_sigma = 0.07;
304307
out_element_info = false;
305308
//----------------------------------------------------------
306309
// LCAO
@@ -696,7 +699,7 @@ bool Input::Read(const std::string &fn)
696699
}
697700
else if (strcmp("nnkpfile", word) == 0) // add by jingan for wannier90
698701
{
699-
read_value(ifs, NNKP);
702+
read_value(ifs, nnkpfile);
700703
}
701704
else if (strcmp("wannier_spin", word) == 0) // add by jingan for wannier90
702705
{
@@ -1182,7 +1185,7 @@ bool Input::Read(const std::string &fn)
11821185
}
11831186
else if (strcmp("dos_sigma", word) == 0)
11841187
{
1185-
read_value(ifs, b_coef);
1188+
read_value(ifs, dos_sigma);
11861189
}
11871190
else if (strcmp("dos_nche", word) == 0)
11881191
{
@@ -2238,7 +2241,7 @@ void Input::Bcast()
22382241
Parallel_Common::bcast_bool(berry_phase);
22392242
Parallel_Common::bcast_int(gdir);
22402243
Parallel_Common::bcast_bool(towannier90);
2241-
Parallel_Common::bcast_string(NNKP);
2244+
Parallel_Common::bcast_string(nnkpfile);
22422245
Parallel_Common::bcast_string(wannier_spin);
22432246

22442247
Parallel_Common::bcast_string(dft_functional);
@@ -2368,7 +2371,7 @@ void Input::Bcast()
23682371
Parallel_Common::bcast_bool(dos_setemin);
23692372
Parallel_Common::bcast_bool(dos_setemax);
23702373
Parallel_Common::bcast_int(dos_nche);
2371-
Parallel_Common::bcast_double(b_coef);
2374+
Parallel_Common::bcast_double(dos_sigma);
23722375

23732376
// mohan add 2009-11-11
23742377
Parallel_Common::bcast_double(lcao_ecut);

source/input.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Input
6363
// Wannier functions
6464
//==========================================================
6565
bool towannier90; // add by jingan for wannier90
66-
std::string NNKP; // add by jingan for wannier90
66+
std::string nnkpfile; // add by jingan for wannier90
6767
std::string wannier_spin; // add by jingan for wannier90
6868

6969
//==========================================================
@@ -251,7 +251,7 @@ class Input
251251
bool dos_setemin = false; //true: emin is set
252252
bool dos_setemax = false; //true: emax is set
253253

254-
double b_coef; // pengfei 2014-10-13
254+
double dos_sigma; // pengfei 2014-10-13
255255

256256
//==========================================================
257257
// two center integrals in LCAO

source/input_conv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ void Input_Conv::Convert(void)
517517
GlobalC::en.dos_emax_ev = INPUT.dos_emax_ev;
518518
GlobalC::en.dos_edelta_ev = INPUT.dos_edelta_ev;
519519
GlobalC::en.dos_scale = INPUT.dos_scale;
520-
GlobalC::en.bcoeff = INPUT.b_coef;
520+
GlobalC::en.bcoeff = INPUT.dos_sigma;
521521

522522
//----------------------------------------------------------
523523
// About LCAO

source/module_esolver/esolver_sdft_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void ESolver_SDFT_PW::postprocess()
205205
emax=emax+delta/2.0;
206206
emin=emin-delta/2.0;
207207
}
208-
this->caldos(INPUT.dos_nche, INPUT.b_coef, emin, emax, INPUT.dos_edelta_ev, INPUT.npart_sto );
208+
this->caldos(INPUT.dos_nche, INPUT.dos_sigma, emin, emax, INPUT.dos_edelta_ev, INPUT.npart_sto );
209209
}
210210
}
211211

source/src_io/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ add_library(
4646
if(ENABLE_COVERAGE)
4747
add_coverage(io)
4848
endif()
49+
50+
if(BUILD_TESTING)
51+
add_subdirectory(test)
52+
endif()

source/src_io/dos.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ bool Dos::calculate_dos
115115
{
116116
dos_smearing.resize(dos.size()-1);
117117

118-
//double b = INPUT.b_coef;
118+
//double b = INPUT.dos_sigma;
119119
double b = sqrt(2.0)*GlobalC::en.bcoeff;
120120
for(int i=0;i<dos.size()-1;i++)
121121
{

source/src_io/test/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
remove_definitions(-D__LCAO)
2+
remove_definitions(-D__DEEPKS)
3+
remove_definitions(-D__CUDA)
4+
remove_definitions(-D__ROCM)
5+
6+
AddTest(
7+
TARGET input_test
8+
LIBS ${math_libs} base device
9+
SOURCES input_test.cpp ../../input.cpp ../../src_parallel/parallel_reduce.cpp ../../src_parallel/parallel_global.cpp ../../src_parallel/parallel_common.cpp
10+
)
11+
12+
install(FILES INPUT STRU DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

0 commit comments

Comments
 (0)