Skip to content

Commit fd6a468

Browse files
author
abacus_fixer
committed
Move LCAO-only DFT+U members from Plus_U_Base to Plus_U
Seven members (yukawa_lambda, npol, nlocal, gamma_only_local, ks_solver, cal_force, cal_stress) were only read by the LCAO subclass (Plus_U) and its component files under source_lcao/module_dftu/. They are now declared in Plus_U and assigned in Plus_U::init, so Plus_U_Base no longer carries LCAO-specific mutable workflow state. Accordingly shorten Plus_U_Base::init_base signature by six parameters (yukawa_lambda, nlocal, gamma_only_local, ks_solver, cal_force, cal_stress); update the two call sites (Plus_U::init in dftu.cpp, PW path in setup_pot.cpp). Plus_U::init keeps its original signature so external callers (lcao_set.cpp) are unaffected.
1 parent 41d243a commit fd6a468

5 files changed

Lines changed: 17 additions & 42 deletions

File tree

source/source_lcao/module_dftu/dftu.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ void Plus_U::init(UnitCell& cell,
6060

6161
this->paraV = pv;
6262

63+
this->yukawa_lambda = yukawa_lambda;
64+
this->npol = npol;
65+
this->nlocal = nlocal;
66+
this->gamma_only_local = gamma_only_local;
67+
this->ks_solver = ks_solver;
68+
this->cal_force = cal_force;
69+
this->cal_stress = cal_stress;
70+
6371
#ifdef __LCAO
6472
ptr_orb_ = orb;
6573
if(ptr_orb_ != nullptr)
@@ -88,15 +96,9 @@ void Plus_U::init(UnitCell& cell,
8896
nspin,
8997
orbital_corr,
9098
yukawa_potential,
91-
yukawa_lambda,
9299
global_readin_dir,
93100
global_out_dir,
94101
init_chg,
95-
nlocal,
96-
gamma_only_local,
97-
ks_solver,
98-
cal_force,
99-
cal_stress,
100102
device,
101103
kpar,
102104
hubbard_u,

source/source_lcao/module_dftu/dftu.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ class Plus_U : public Plus_U_Base
6060

6161
const Parallel_Orbitals* paraV = nullptr;
6262

63+
double yukawa_lambda = 0.0;
64+
int npol = 1;
65+
int nlocal = 0;
66+
bool gamma_only_local = false;
67+
std::string ks_solver;
68+
bool cal_force = false;
69+
bool cal_stress = false;
70+
6371
#ifdef __LCAO
6472
const LCAO_Orbitals* ptr_orb_ = nullptr;
6573
std::vector<double> orb_cutoff_;

source/source_pw/module_pwdft/dftu_base.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,9 @@ void Plus_U_Base::init_base(UnitCell& cell,
3535
const int nspin,
3636
const std::vector<int>& orbital_corr,
3737
const bool yukawa_potential,
38-
const double yukawa_lambda,
3938
const std::string& global_readin_dir,
4039
const std::string& global_out_dir,
4140
const std::string& init_chg,
42-
const int nlocal,
43-
const bool gamma_only_local,
44-
const std::string& ks_solver,
45-
const bool cal_force,
46-
const bool cal_stress,
4741
const std::string& device,
4842
const int kpar,
4943
const std::vector<double>& hubbard_u,
@@ -72,15 +66,6 @@ void Plus_U_Base::init_base(UnitCell& cell,
7266
this->u_current.end(),
7367
0.0);
7468
}
75-
this->yukawa_lambda = yukawa_lambda;
76-
77-
this->npol = npol;
78-
79-
this->nlocal = nlocal;
80-
this->gamma_only_local = gamma_only_local;
81-
this->ks_solver = ks_solver;
82-
this->cal_force = cal_force;
83-
this->cal_stress = cal_stress;
8469
this->device = device;
8570
this->kpar = kpar;
8671

source/source_pw/module_pwdft/dftu_base.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,9 @@ class Plus_U_Base
2222
const int nspin,
2323
const std::vector<int>& orbital_corr,
2424
const bool yukawa_potential,
25-
const double yukawa_lambda,
2625
const std::string& global_readin_dir,
2726
const std::string& global_out_dir,
2827
const std::string& init_chg,
29-
const int nlocal,
30-
const bool gamma_only_local,
31-
const std::string& ks_solver,
32-
const bool cal_force,
33-
const bool cal_stress,
3428
const std::string& device,
3529
const int kpar,
3630
const std::vector<double>& hubbard_u,
@@ -58,7 +52,6 @@ class Plus_U_Base
5852
bool has_correlated_orbital(int it) const { return orbital_corr[it] != -1; }
5953
const int* get_orbital_corr_data() const { return orbital_corr.data(); }
6054

61-
// mohan add 2025-11-08 for dftu_io::output free function
6255
double get_U_Yukawa(int it, int l, int n) const { return U_Yukawa[it][l][n]; }
6356
double get_J_Yukawa(int it, int l, int n) const { return J_Yukawa[it][l][n]; }
6457

@@ -70,13 +63,6 @@ class Plus_U_Base
7063
double energy_u = 0.0;
7164

7265
int cal_type = 3;
73-
double yukawa_lambda = 0.0;
74-
int npol = 1;
75-
int nlocal = 0;
76-
bool gamma_only_local = false;
77-
std::string ks_solver;
78-
bool cal_force = false;
79-
bool cal_stress = false;
8066
std::string device;
8167
int kpar = 1;
8268

source/source_pw/module_pwdft/setup_pot.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,12 @@ void pw::setup_pot(const int istep,
121121
//----------------------------------------------------------
122122
if (inp.dft_plus_u)
123123
{
124-
const int nlocal_dftu = 0;
125124
dftu.init_base(ucell,
126125
PARAM.globalv.npol,
127-
inp.nspin, inp.orbital_corr, inp.yukawa_potential, inp.yukawa_lambda,
126+
inp.nspin, inp.orbital_corr, inp.yukawa_potential,
128127
PARAM.globalv.global_readin_dir,
129128
PARAM.globalv.global_out_dir,
130129
inp.init_chg,
131-
nlocal_dftu,
132-
PARAM.globalv.gamma_only_local,
133-
inp.ks_solver,
134-
inp.cal_force,
135-
inp.cal_stress,
136130
inp.device,
137131
inp.kpar,
138132
PARAM.globalv.hubbard_u,

0 commit comments

Comments
 (0)