Skip to content

Commit b299d64

Browse files
A-006pre-commit-ci-lite[bot]
authored andcommitted
Refactor:Remove GlobalC::ucell in module_lcaodft (deepmodeling#5649)
* update ucell in force_gamma/force_k * change GlobalC::ucell in the force_stress * change GlobalC::ucell in the grid_init.cpp * update ucell in hamilt_lcao * update ucell in LCAO_alloacte * update ucell in record_adj * update ucell in spra_dh.cpp * update ucell in wavefunc_in_pw * fix bug in wavefunc * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 470d9fd commit b299d64

25 files changed

+319
-261
lines changed

source/module_esolver/esolver_gets.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
101101
PARAM.inp.test_atom_input);
102102

103103
Record_adj RA;
104-
RA.for_2d(this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs());
104+
RA.for_2d(ucell,this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs());
105105

106106
if (this->p_hamilt == nullptr)
107107
{
108108
if (PARAM.inp.nspin == 4)
109109
{
110110
this->p_hamilt
111-
= new hamilt::HamiltLCAO<std::complex<double>, std::complex<double>>(&this->pv,
111+
= new hamilt::HamiltLCAO<std::complex<double>, std::complex<double>>(ucell,
112+
&this->pv,
112113
this->kv,
113114
*(two_center_bundle_.overlap_orb),
114115
orb_.cutoffs());
@@ -117,7 +118,8 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
117118
}
118119
else
119120
{
120-
this->p_hamilt = new hamilt::HamiltLCAO<std::complex<double>, double>(&this->pv,
121+
this->p_hamilt = new hamilt::HamiltLCAO<std::complex<double>, double>(ucell,
122+
&this->pv,
121123
this->kv,
122124
*(two_center_bundle_.overlap_orb),
123125
orb_.cutoffs());

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
164164
// 5) initialize Hamilt in LCAO
165165
// * allocate H and S matrices according to computational resources
166166
// * set the 'trace' between local H/S and global H/S
167-
LCAO_domain::divide_HS_in_frag(PARAM.globalv.gamma_only_local, pv, this->kv.get_nks(), orb_);
167+
LCAO_domain::divide_HS_in_frag(PARAM.globalv.gamma_only_local, ucell , pv, this->kv.get_nks(), orb_);
168168

169169
#ifdef __EXX
170170
// 6) initialize exx
@@ -294,6 +294,7 @@ void ESolver_KS_LCAO<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& for
294294
PARAM.inp.cal_stress,
295295
PARAM.inp.test_force,
296296
PARAM.inp.test_stress,
297+
ucell,
297298
this->pv,
298299
this->pelec,
299300
this->psi,

source/module_esolver/lcao_before_scf.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
127127
// (2)For each atom, calculate the adjacent atoms in different cells
128128
// and allocate the space for H(R) and S(R).
129129
// If k point is used here, allocate HlocR after atom_arrange.
130-
this->RA.for_2d(this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs());
130+
this->RA.for_2d(ucell,this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs());
131131

132132
// 2. density matrix extrapolation
133133

@@ -174,7 +174,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
174174
}
175175

176176
// prepare grid in Gint
177-
LCAO_domain::grid_prepare(this->GridT, this->GG, this->GK, orb_, *this->pw_rho, *this->pw_big);
177+
LCAO_domain::grid_prepare(this->GridT, this->GG, this->GK, ucell, orb_, *this->pw_rho, *this->pw_big);
178178

179179
// init Hamiltonian
180180
if (this->p_hamilt != nullptr)
@@ -188,6 +188,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
188188
this->p_hamilt = new hamilt::HamiltLCAO<TK, TR>(
189189
PARAM.globalv.gamma_only_local ? &(this->GG) : nullptr,
190190
PARAM.globalv.gamma_only_local ? nullptr : &(this->GK),
191+
ucell,
191192
&this->pv,
192193
this->pelec->pot,
193194
this->kv,

source/module_esolver/lcao_others.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
128128
// (2)For each atom, calculate the adjacent atoms in different cells
129129
// and allocate the space for H(R) and S(R).
130130
// If k point is used here, allocate HlocR after atom_arrange.
131-
this->RA.for_2d(this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs());
131+
this->RA.for_2d(ucell,this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs());
132132

133133
// 2. density matrix extrapolation
134134

@@ -175,7 +175,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
175175
}
176176

177177
// prepare grid in Gint
178-
LCAO_domain::grid_prepare(this->GridT, this->GG, this->GK, orb_, *this->pw_rho, *this->pw_big);
178+
LCAO_domain::grid_prepare(this->GridT, this->GG, this->GK, ucell,orb_, *this->pw_rho, *this->pw_big);
179179

180180
// init Hamiltonian
181181
if (this->p_hamilt != nullptr)
@@ -189,6 +189,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
189189
this->p_hamilt = new hamilt::HamiltLCAO<TK, TR>(
190190
PARAM.globalv.gamma_only_local ? &(this->GG) : nullptr,
191191
PARAM.globalv.gamma_only_local ? nullptr : &(this->GK),
192+
ucell,
192193
&this->pv,
193194
this->pelec->pot,
194195
this->kv,

source/module_hamilt_lcao/hamilt_lcaodft/FORCE.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class Force_LCAO
7272
Record_adj* ra = nullptr);
7373

7474
// get the ds, dt, dvnl.
75-
void allocate(const Parallel_Orbitals& pv,
75+
void allocate(const UnitCell& ucell,
76+
const Parallel_Orbitals& pv,
7677
ForceStressArrays& fsr, // mohan add 2024-06-15
7778
const TwoCenterBundle& two_center_bundle,
7879
const LCAO_Orbitals& orb,

0 commit comments

Comments
 (0)