Skip to content

Commit 1388da5

Browse files
committed
Remove Potential double-grid global PARAM dependency
1 parent 9d37bba commit 1388da5

2 files changed

Lines changed: 328 additions & 533 deletions

File tree

source/source_estate/module_pot/potential_new.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "potential_new.h"
22

3+
#include "pot_ml_exx.h"
34
#include "source_base/global_function.h"
45
#include "source_base/global_variable.h"
56
#include "source_base/memory_recorder.h"
@@ -8,7 +9,6 @@
89
#include "source_base/tool_title.h"
910
#include "source_hamilt/module_xc/xc_functional.h"
1011
#include "source_io/module_parameter/parameter.h"
11-
#include "pot_ml_exx.h"
1212

1313
#include <map>
1414

@@ -24,9 +24,8 @@ Potential::Potential(const ModulePW::PW_Basis* rho_basis_in,
2424
double* etxc_in,
2525
double* vtxc_in,
2626
VSep* vsep_cell_in)
27-
: ucell_(ucell_in), vloc_(vloc_in), structure_factors_(structure_factors_in),
28-
solvent_(solvent_in), vsep_cell(vsep_cell_in), etxc_(etxc_in),
29-
vtxc_(vtxc_in)
27+
: ucell_(ucell_in), vloc_(vloc_in), structure_factors_(structure_factors_in), solvent_(solvent_in), vsep_cell(vsep_cell_in),
28+
etxc_(etxc_in), vtxc_(vtxc_in)
3029
{
3130
this->rho_basis_ = rho_basis_in;
3231
this->rho_basis_smooth_ = rho_basis_smooth_in;
@@ -96,19 +95,19 @@ void Potential::allocate()
9695
ModuleBase::TITLE("Potential", "allocate");
9796

9897
const int nspin = PARAM.inp.nspin;
99-
assert(nspin==1 || nspin==2 || nspin==4);
98+
assert(nspin == 1 || nspin == 2 || nspin == 4);
10099

101100
const int nrxx = this->rho_basis_->nrxx;
102101
const int nrxx_smooth = this->rho_basis_smooth_->nrxx;
103102

104103
if (nrxx == 0)
105-
{
106-
return;
107-
}
108-
if (nrxx_smooth == 0)
109-
{
110-
return;
111-
}
104+
{
105+
return;
106+
}
107+
if (nrxx_smooth == 0)
108+
{
109+
return;
110+
}
112111

113112
this->v_eff_fixed.resize(nrxx);
114113
ModuleBase::Memory::record("Pot::veff_fix", sizeof(double) * nrxx);
@@ -156,10 +155,9 @@ void Potential::allocate()
156155
}
157156
}
158157

159-
void Potential::update_from_charge(const Charge*const chg, const UnitCell*const ucell)
158+
void Potential::update_from_charge(const Charge* const chg, const UnitCell* const ucell)
160159
{
161160
ModuleBase::TITLE("Potential", "update_from_charge");
162-
//ModuleBase::timer::start("Potential", "update_from_charge");
163161

164162
if (!this->fixed_done)
165163
{
@@ -194,8 +192,6 @@ void Potential::update_from_charge(const Charge*const chg, const UnitCell*const
194192
}
195193
// There's no need to synchronize memory for double precision pointers while in a CPU environment
196194
}
197-
198-
//ModuleBase::timer::end("Potential", "update_from_charge");
199195
}
200196

201197
void Potential::cal_fixed_v(double* vl_pseudo)
@@ -215,7 +211,7 @@ void Potential::cal_fixed_v(double* vl_pseudo)
215211
ModuleBase::timer::end("Potential", "cal_fixed_v");
216212
}
217213

218-
void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, ModuleBase::matrix& v_eff)
214+
void Potential::cal_v_eff(const Charge* const chg, const UnitCell* const ucell, ModuleBase::matrix& v_eff)
219215
{
220216
ModuleBase::TITLE("Potential", "cal_veff");
221217
ModuleBase::timer::start("Potential", "cal_veff");
@@ -248,7 +244,7 @@ void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Mo
248244
ModuleBase::timer::end("Potential", "cal_veff");
249245
}
250246

251-
void Potential::init_pot(const Charge*const chg)
247+
void Potential::init_pot(const Charge* const chg)
252248
{
253249
ModuleBase::TITLE("Potential", "init_pot");
254250
ModuleBase::timer::start("Potential", "init_pot");
@@ -284,9 +280,9 @@ void Potential::interpolate_vrs(void)
284280
ModuleBase::timer::start("Potential", "interpolate_vrs");
285281

286282
const int nspin = PARAM.inp.nspin;
287-
assert(nspin==1 || nspin==2 || nspin==4);
283+
assert(nspin == 1 || nspin == 2 || nspin == 4);
288284

289-
if (PARAM.globalv.double_grid)
285+
if (rho_basis_ != rho_basis_smooth_)
290286
{
291287
if (rho_basis_->gamma_only != rho_basis_smooth_->gamma_only)
292288
{

0 commit comments

Comments
 (0)