Skip to content

Commit f08c638

Browse files
committed
Test: add test case for nz=3, add parameter test_skip_ewald for this case only
1 parent e5a28d4 commit f08c638

File tree

14 files changed

+81
-4
lines changed

14 files changed

+81
-4
lines changed

source/input.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ void Input::Default(void)
407407
// test only
408408
//==========================================================
409409
test_just_neighbor = false;
410+
test_skip_ewald = false;
410411

411412
//==========================================================
412413
// DFT+U Xin Qu added on 2020-10-29
@@ -1505,6 +1506,10 @@ bool Input::Read(const std::string &fn)
15051506
{
15061507
read_value(ifs, test_just_neighbor);
15071508
}
1509+
else if (strcmp("test_skip_ewald", word) == 0)
1510+
{
1511+
read_value(ifs, test_skip_ewald);
1512+
}
15081513
//--------------
15091514
//----------------------------------------------------------------------------------
15101515
// Xin Qu added on 2020-10-29 for DFT+U
@@ -2203,6 +2208,7 @@ void Input::Bcast()
22032208
Parallel_Common::bcast_int(td_vextout);
22042209
Parallel_Common::bcast_int(td_dipoleout);
22052210
Parallel_Common::bcast_bool(test_just_neighbor);
2211+
Parallel_Common::bcast_bool(test_skip_ewald);
22062212
Parallel_Common::bcast_int(GlobalV::ocp);
22072213
Parallel_Common::bcast_string(GlobalV::ocp_set);
22082214
Parallel_Common::bcast_int(out_mul); // qifeng add 2019/9/10

source/input.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ class Input
421421
//==========================================================
422422
// variables for test only
423423
//==========================================================
424-
bool test_just_neighbor;
424+
bool test_just_neighbor = false;
425+
bool test_skip_ewald = false;
425426

426427
private:
427428
//==========================================================

source/input_conv.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ void Input_Conv::Convert(void)
135135
GlobalV::VION_IN_H = INPUT.vion_in_h;
136136
GlobalV::TEST_FORCE = INPUT.test_force;
137137
GlobalV::TEST_STRESS = INPUT.test_stress;
138+
GlobalV::test_skip_ewald = INPUT.test_skip_ewald;
138139

139140
//----------------------------------------------------------
140141
// iteration (1/3)

source/module_base/global_variable.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ int test_wf = 0;
157157
int test_charge = 0;
158158
int test_potential = 0;
159159
int test_energy = 0;
160+
// for test purpose, skip ewald calculation
161+
bool test_skip_ewald = false;
160162
//----------------------------------------------------------
161163
// src_lcao
162164
//----------------------------------------------------------

source/module_base/global_variable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ extern int test_wf;
180180
extern int test_charge;
181181
extern int test_potential;
182182
extern int test_energy;
183+
extern bool test_skip_ewald;
183184
//==========================================================
184185
// src_onscaling
185186
//==========================================================

source/module_esolver/esolver_ks_lcao_elec.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,10 @@ namespace ModuleESolver
256256
#endif
257257
// 1. calculate ewald energy.
258258
// mohan update 2021-02-25
259-
H_Ewald_pw::compute_ewald(GlobalC::ucell, GlobalC::rhopw);
259+
if(!GlobalV::test_skip_ewald)
260+
{
261+
H_Ewald_pw::compute_ewald(GlobalC::ucell, GlobalC::rhopw);
262+
}
260263

261264
//2. the electron charge density should be symmetrized,
262265
// here is the initialization

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ namespace ModuleESolver
180180
}
181181

182182
//calculate ewald energy
183-
H_Ewald_pw::compute_ewald(GlobalC::ucell, GlobalC::rhopw);
183+
if(!GlobalV::test_skip_ewald)
184+
{
185+
H_Ewald_pw::compute_ewald(GlobalC::ucell, GlobalC::rhopw);
186+
}
184187
//Symmetry_rho should be moved to Init()
185188
Symmetry_rho srho;
186189
for (int is = 0; is < GlobalV::NSPIN; is++)

source/module_hamilt/ks_pw/veff_pw.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void Veff<OperatorPW>::act
5252
// but the 3DFFT can not be skipped, it will cause stuck
5353
if(this->veff->nc != 0)
5454
{
55-
GlobalV::ofs_running<<__FILE__<<__LINE__<<" "<<this->veff->nr<<" "<<this->veff->nc<<std::endl;
5655
const double* current_veff = &(this->veff[0](current_spin, 0));
5756
for (int ir = 0; ir < this->veff->nc; ++ir)
5857
{
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 1
15+
16+
17+
#Parameters (3.Basis)
18+
basis_type pw
19+
20+
#Parameters (4.Smearing)
21+
smearing_method gauss
22+
smearing_sigma 0.002
23+
24+
#Parameters (5.Mixing)
25+
mixing_type pulay
26+
mixing_beta 0.7
27+
28+
nx 24
29+
ny 24
30+
nz 3
31+
pw_seed 1
32+
33+
test_skip_ewald 1

tests/integrate/101_PW_15_lowz/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

0 commit comments

Comments
 (0)