Skip to content

Commit 93ee84f

Browse files
committed
Refactor: rename has_kedf to ked_flag
1 parent 80e3f22 commit 93ee84f

31 files changed

+73
-73
lines changed

source/module_elecstate/elecstate_energy.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const
103103
const double* v_eff = this->pot->get_effective_v(0);
104104
const double* v_fixed = this->pot->get_fixed_v();
105105
const double* v_ofk = nullptr;
106-
const bool v_ofk_flag = (XC_Functional::get_has_kedf());
106+
const bool v_ofk_flag = (XC_Functional::get_ked_flag());
107107
#ifdef USE_PAW
108108
if (PARAM.inp.use_paw)
109109
{
@@ -208,14 +208,14 @@ double ElecState::cal_delta_escf() const
208208
const double* v_fixed = this->pot->get_fixed_v();
209209
const double* v_ofk = nullptr;
210210

211-
if (XC_Functional::get_has_kedf())
211+
if (XC_Functional::get_ked_flag())
212212
{
213213
v_ofk = this->pot->get_effective_vofk(0);
214214
}
215215
for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++)
216216
{
217217
descf -= (this->charge->rho[0][ir] - this->charge->rho_save[0][ir]) * (v_eff[ir] - v_fixed[ir]);
218-
if (XC_Functional::get_has_kedf())
218+
if (XC_Functional::get_ked_flag())
219219
{
220220
// cause in the get_effective_vofk, the func will return nullptr
221221
assert(v_ofk != nullptr);
@@ -226,14 +226,14 @@ double ElecState::cal_delta_escf() const
226226
if (PARAM.inp.nspin == 2)
227227
{
228228
v_eff = this->pot->get_effective_v(1);
229-
if (XC_Functional::get_has_kedf())
229+
if (XC_Functional::get_ked_flag())
230230
{
231231
v_ofk = this->pot->get_effective_vofk(1);
232232
}
233233
for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++)
234234
{
235235
descf -= (this->charge->rho[1][ir] - this->charge->rho_save[1][ir]) * (v_eff[ir] - v_fixed[ir]);
236-
if (XC_Functional::get_has_kedf())
236+
if (XC_Functional::get_ked_flag())
237237
{
238238
descf -= (this->charge->kin_r[1][ir] - this->charge->kin_r_save[1][ir]) * v_ofk[ir];
239239
}

source/module_elecstate/elecstate_lcao.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void ElecStateLCAO<std::complex<double>>::psiToRho(const psi::Psi<std::complex<d
6363
Gint_inout inout(this->charge->rho, Gint_Tools::job_type::rho, PARAM.inp.nspin);
6464
this->gint_k->cal_gint(&inout);
6565

66-
if (XC_Functional::get_has_kedf())
66+
if (XC_Functional::get_ked_flag())
6767
{
6868
elecstate::lcao_cal_tau_k(gint_k, this->charge);
6969
}
@@ -98,7 +98,7 @@ void ElecStateLCAO<double>::psiToRho(const psi::Psi<double>& psi)
9898

9999
this->gint_gamma->cal_gint(&inout);
100100

101-
if (XC_Functional::get_has_kedf())
101+
if (XC_Functional::get_ked_flag())
102102
{
103103
elecstate::lcao_cal_tau_gamma(gint_gamma, this->charge);
104104
}
@@ -161,7 +161,7 @@ void ElecStateLCAO<double>::dmToRho(std::vector<double*> pexsi_DM, std::vector<d
161161
this->gint_gamma->transfer_DM2DtoGrid(this->DM->get_DMR_vector()); // transfer DM2D to DM_grid in gint
162162
Gint_inout inout(this->charge->rho, Gint_Tools::job_type::rho, PARAM.inp.nspin);
163163
this->gint_gamma->cal_gint(&inout);
164-
if (XC_Functional::get_has_kedf())
164+
if (XC_Functional::get_ked_flag())
165165
{
166166
for (int is = 0; is < PARAM.inp.nspin; is++)
167167
{

source/module_elecstate/elecstate_print.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ void ElecState::print_etot(const Magnetism& magnet,
460460
break;
461461
}
462462
std::vector<double> drho = {scf_thr};
463-
if (XC_Functional::get_has_kedf())
463+
if (XC_Functional::get_ked_flag())
464464
{
465465
drho.push_back(scf_thr_kin);
466466
}

source/module_elecstate/module_charge/charge.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void Charge::destroy()
8181
delete[] _space_rhog_save;
8282
delete[] _space_kin_r;
8383
delete[] _space_kin_r_save;
84-
if (XC_Functional::get_has_kedf() || PARAM.inp.out_elf[0] > 0)
84+
if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0)
8585
{
8686
delete[] kin_r;
8787
delete[] kin_r_save;
@@ -122,7 +122,7 @@ void Charge::allocate(const int& nspin_in)
122122
_space_rho_save = new double[nspin * nrxx];
123123
_space_rhog = new std::complex<double>[nspin * ngmc];
124124
_space_rhog_save = new std::complex<double>[nspin * ngmc];
125-
if (XC_Functional::get_has_kedf() || PARAM.inp.out_elf[0] > 0)
125+
if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0)
126126
{
127127
_space_kin_r = new double[nspin * nrxx];
128128
_space_kin_r_save = new double[nspin * nrxx];
@@ -131,7 +131,7 @@ void Charge::allocate(const int& nspin_in)
131131
rhog = new std::complex<double>*[nspin];
132132
rho_save = new double*[nspin];
133133
rhog_save = new std::complex<double>*[nspin];
134-
if (XC_Functional::get_has_kedf() || PARAM.inp.out_elf[0] > 0)
134+
if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0)
135135
{
136136
kin_r = new double*[nspin];
137137
kin_r_save = new double*[nspin];
@@ -152,7 +152,7 @@ void Charge::allocate(const int& nspin_in)
152152
ModuleBase::GlobalFunc::ZEROS(rhog[is], ngmc);
153153
ModuleBase::GlobalFunc::ZEROS(rho_save[is], nrxx);
154154
ModuleBase::GlobalFunc::ZEROS(rhog_save[is], ngmc);
155-
if (XC_Functional::get_has_kedf() || PARAM.inp.out_elf[0] > 0)
155+
if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0)
156156
{
157157
kin_r[is] = _space_kin_r + is * nrxx;
158158
ModuleBase::GlobalFunc::ZEROS(kin_r[is], nrxx);
@@ -172,7 +172,7 @@ void Charge::allocate(const int& nspin_in)
172172
ModuleBase::Memory::record("Chg::rho_save", sizeof(double) * nspin * nrxx);
173173
ModuleBase::Memory::record("Chg::rhog", sizeof(double) * nspin * ngmc);
174174
ModuleBase::Memory::record("Chg::rhog_save", sizeof(double) * nspin * ngmc);
175-
if (XC_Functional::get_has_kedf() || PARAM.inp.out_elf[0] > 0)
175+
if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0)
176176
{
177177
ModuleBase::Memory::record("Chg::kin_r", sizeof(double) * nspin * ngmc);
178178
ModuleBase::Memory::record("Chg::kin_r_save", sizeof(double) * nspin * ngmc);
@@ -702,7 +702,7 @@ void Charge::save_rho_before_sum_band()
702702
for (int is = 0; is < PARAM.inp.nspin; is++)
703703
{
704704
ModuleBase::GlobalFunc::DCOPY(rho[is], rho_save[is], this->rhopw->nrxx);
705-
if (XC_Functional::get_has_kedf())
705+
if (XC_Functional::get_ked_flag())
706706
{
707707
ModuleBase::GlobalFunc::DCOPY(kin_r[is], kin_r_save[is], this->rhopw->nrxx);
708708
}

source/module_elecstate/module_charge/charge_init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
117117
}
118118
}
119119

120-
if (XC_Functional::get_has_kedf())
120+
if (XC_Functional::get_ked_flag())
121121
{
122122
// If the charge density is not read in, then the kinetic energy density is not read in either
123123
if (!read_error)
@@ -188,7 +188,7 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
188188
}
189189

190190
// wenfei 2021-7-29 : initial tau = 3/5 rho^2/3, Thomas-Fermi
191-
if (XC_Functional::get_has_kedf())
191+
if (XC_Functional::get_ked_flag())
192192
{
193193
if (PARAM.inp.init_chg == "atomic" || read_kin_error)
194194
{

source/module_elecstate/module_charge/charge_mixing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void Charge_Mixing::init_mixing()
144144
}
145145

146146
// initailize tau_mdata
147-
if ((XC_Functional::get_has_kedf()) && mixing_tau)
147+
if ((XC_Functional::get_ked_flag()) && mixing_tau)
148148
{
149149
if (PARAM.inp.scf_thr_type == 1)
150150
{
@@ -180,7 +180,7 @@ void Charge_Mixing::mix_reset()
180180
this->mixing->reset();
181181
this->rho_mdata.reset();
182182
// initailize tau_mdata
183-
if ((XC_Functional::get_has_kedf()) && mixing_tau)
183+
if ((XC_Functional::get_ked_flag()) && mixing_tau)
184184
{
185185
this->tau_mdata.reset();
186186
}

source/module_elecstate/module_charge/charge_mixing_residual.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ double Charge_Mixing::get_drho(Charge* chr, const double nelec)
7272

7373
double Charge_Mixing::get_dkin(Charge* chr, const double nelec)
7474
{
75-
if (!(XC_Functional::get_has_kedf()))
75+
if (!(XC_Functional::get_ked_flag()))
7676
{
7777
return 0.0;
7878
};

source/module_elecstate/module_charge/charge_mixing_rho.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void Charge_Mixing::mix_rho_recip(Charge* chr)
249249
}
250250

251251
// For kinetic energy density
252-
if ((XC_Functional::get_has_kedf()) && mixing_tau)
252+
if ((XC_Functional::get_ked_flag()) && mixing_tau)
253253
{
254254
std::vector<std::complex<double>> kin_g(PARAM.inp.nspin * rhodpw->npw);
255255
std::vector<std::complex<double>> kin_g_save(PARAM.inp.nspin * rhodpw->npw);
@@ -485,7 +485,7 @@ void Charge_Mixing::mix_rho_real(Charge* chr)
485485
}
486486

487487
double *taur_out, *taur_in;
488-
if ((XC_Functional::get_has_kedf()) && mixing_tau)
488+
if ((XC_Functional::get_ked_flag()) && mixing_tau)
489489
{
490490
taur_in = chr->kin_r_save[0];
491491
taur_out = chr->kin_r[0];
@@ -521,7 +521,7 @@ void Charge_Mixing::mix_rho(Charge* chr)
521521
}
522522
}
523523
std::vector<double> kin_r123;
524-
if ((XC_Functional::get_has_kedf()) && mixing_tau)
524+
if ((XC_Functional::get_ked_flag()) && mixing_tau)
525525
{
526526
kin_r123.resize(PARAM.inp.nspin * nrxx);
527527
for (int is = 0; is < PARAM.inp.nspin; ++is)
@@ -581,7 +581,7 @@ void Charge_Mixing::mix_rho(Charge* chr)
581581
}
582582
}
583583

584-
if ((XC_Functional::get_has_kedf()) && mixing_tau)
584+
if ((XC_Functional::get_ked_flag()) && mixing_tau)
585585
{
586586
for (int is = 0; is < PARAM.inp.nspin; ++is)
587587
{

source/module_elecstate/module_charge/charge_mpi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void Charge::rho_mpi()
132132
for (int is = 0; is < PARAM.inp.nspin; ++is)
133133
{
134134
reduce_diff_pools(this->rho[is]);
135-
if (XC_Functional::get_has_kedf() || PARAM.inp.out_elf[0] > 0)
135+
if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0)
136136
{
137137
reduce_diff_pools(this->kin_r[is]);
138138
}

source/module_elecstate/module_charge/symmetry_rho.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void Symmetry_rho::begin(const int& spin_now,
2424
// if(symm.nrot==symm.nrotk) //pure point-group, do rho_symm in real space
2525
// {
2626
// psymm(CHR.rho[spin_now], rho_basis, Pgrid, symm);
27-
// if(XC_Functional::get_has_kedf()) psymm(CHR.kin_r[spin_now],
27+
// if(XC_Functional::get_ked_flag()) psymm(CHR.kin_r[spin_now],
2828
// rho_basis,Pgrid,symm);
2929
// }
3030
// else //space group, do rho_symm in reciprocal space
@@ -33,7 +33,7 @@ void Symmetry_rho::begin(const int& spin_now,
3333
psymmg(CHR.rhog[spin_now], rho_basis, symm); // need to modify
3434
rho_basis->recip2real(CHR.rhog[spin_now], CHR.rho[spin_now]);
3535

36-
if (XC_Functional::get_has_kedf() || CHR.cal_elf)
36+
if (XC_Functional::get_ked_flag() || CHR.cal_elf)
3737
{
3838
// Use std::vector to manage kin_g instead of raw pointer
3939
std::vector<std::complex<double>> kin_g(CHR.ngmc);
@@ -63,7 +63,7 @@ void Symmetry_rho::begin(const int& spin_now,
6363
// if(symm.nrot==symm.nrotk) //pure point-group, do rho_symm in real space
6464
// {
6565
// psymm(CHR.rho[spin_now], rho_basis, Pgrid, symm);
66-
// if(XC_Functional::get_has_kedf()) psymm(CHR.kin_r[spin_now],
66+
// if(XC_Functional::get_ked_flag()) psymm(CHR.kin_r[spin_now],
6767
// rho_basis,Pgrid,symm);
6868
// }
6969
// else //space group, do rho_symm in reciprocal space
@@ -72,7 +72,7 @@ void Symmetry_rho::begin(const int& spin_now,
7272
psymmg(rhog[spin_now], rho_basis, symm);
7373
rho_basis->recip2real(rhog[spin_now], rho[spin_now]);
7474

75-
if (XC_Functional::get_has_kedf())
75+
if (XC_Functional::get_ked_flag())
7676
{
7777
// Use std::vector to manage kin_g instead of raw pointer
7878
std::vector<std::complex<double>> kin_g(ngmc);

0 commit comments

Comments
 (0)