Skip to content

Commit f5b129b

Browse files
committed
Revert "change ucell in the hsolver_pw"
This reverts commit 51ba921.
1 parent 918d8fd commit f5b129b

File tree

6 files changed

+17
-24
lines changed

6 files changed

+17
-24
lines changed

source/module_esolver/esolver_ks_lcaopw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ namespace ModuleESolver
147147
}
148148

149149
hsolver::HSolverLIP<T> hsolver_lip_obj(this->pw_wfc);
150-
hsolver_lip_obj.solve(this->p_hamilt, this->kspw_psi[0], this->pelec, ucell, psig.lock().get()[0], skip_charge);
150+
hsolver_lip_obj.solve(this->p_hamilt, this->kspw_psi[0], this->pelec, psig.lock().get()[0], skip_charge);
151151

152152
// add exx
153153
#ifdef __EXX

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ void ESolver_KS_PW<T, Device>::hamilt2density_single(UnitCell& ucell,
444444
hsolver_pw_obj.solve(this->p_hamilt,
445445
this->kspw_psi[0],
446446
this->pelec,
447-
ucell,
448447
this->pelec->ekb.c,
449448
GlobalV::RANK_IN_POOL,
450449
GlobalV::NPROC_IN_POOL,

source/module_hsolver/hsolver_lcaopw.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace hsolver
2424

2525
#ifdef USE_PAW
2626
template <typename T>
27-
void HSolverLIP<T>::paw_func_in_kloop(const UnitCell& ucell, const int ik)
27+
void HSolverLIP<T>::paw_func_in_kloop(const int ik)
2828
{
2929
if (PARAM.inp.use_paw)
3030
{
@@ -83,7 +83,7 @@ void HSolverLIP<T>::paw_func_in_kloop(const UnitCell& ucell, const int ik)
8383
}
8484

8585
template <typename T>
86-
void HSolverLIP<T>::paw_func_after_kloop(const UnitCell& ucell, psi::Psi<T>& psi, elecstate::ElecState* pes)
86+
void HSolverLIP<T>::paw_func_after_kloop(psi::Psi<T>& psi, elecstate::ElecState* pes)
8787
{
8888
if (PARAM.inp.use_paw)
8989
{
@@ -200,7 +200,6 @@ template <typename T>
200200
void HSolverLIP<T>::solve(hamilt::Hamilt<T>* pHamilt, // ESolver_KS_PW::p_hamilt
201201
psi::Psi<T>& psi, // ESolver_KS_PW::kspw_psi
202202
elecstate::ElecState* pes, // ESolver_KS_PW::pes
203-
const UnitCell& ucell,
204203
psi::Psi<T>& transform,
205204
const bool skip_charge)
206205
{
@@ -213,7 +212,7 @@ void HSolverLIP<T>::solve(hamilt::Hamilt<T>* pHamilt, // ESolver_KS_PW::p_hamilt
213212
pHamilt->updateHk(ik);
214213

215214
#ifdef USE_PAW
216-
this->paw_func_in_kloop(ucell,ik);
215+
this->paw_func_in_kloop(ik);
217216
#endif
218217

219218
psi.fix_k(ik);
@@ -283,7 +282,7 @@ void HSolverLIP<T>::solve(hamilt::Hamilt<T>* pHamilt, // ESolver_KS_PW::p_hamilt
283282
reinterpret_cast<elecstate::ElecStatePW<T>*>(pes)->psiToRho(psi);
284283

285284
#ifdef USE_PAW
286-
this->paw_func_after_kloop(ucell,psi, pes);
285+
this->paw_func_after_kloop(psi, pes);
287286
#endif
288287

289288
ModuleBase::timer::tick("HSolverLIP", "solve");

source/module_hsolver/hsolver_lcaopw.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,16 @@ class HSolverLIP
3030
void solve(hamilt::Hamilt<T>* pHamilt,
3131
psi::Psi<T>& psi,
3232
elecstate::ElecState* pes,
33-
const UnitCell& ucell,
3433
psi::Psi<T>& transform,
3534
const bool skip_charge);
3635

3736
private:
3837
ModulePW::PW_Basis_K* wfc_basis;
3938

4039
#ifdef USE_PAW
41-
void paw_func_in_kloop(const UnitCell& ucell,const int ik);
40+
void paw_func_in_kloop(const int ik);
4241

43-
void paw_func_after_kloop(const UnitCell& ucell, psi::Psi<T>& psi, elecstate::ElecState* pes);
42+
void paw_func_after_kloop(psi::Psi<T>& psi, elecstate::ElecState* pes);
4443
#endif
4544
};
4645

source/module_hsolver/hsolver_pw.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ namespace hsolver
2828

2929
#ifdef USE_PAW
3030
template <typename T, typename Device>
31-
void HSolverPW<T, Device>::paw_func_in_kloop(const UnitCell& ucell,
32-
const int ik)
31+
void HSolverPW<T, Device>::paw_func_in_kloop(const int ik)
3332
{
3433
if (this->use_paw)
3534
{
@@ -69,7 +68,7 @@ void HSolverPW<T, Device>::paw_func_in_kloop(const UnitCell& ucell,
6968
this->wfc_basis->get_ig2iy(ik).data(),
7069
this->wfc_basis->get_ig2iz(ik).data(),
7170
(const double**)kpg,
72-
ucell.tpiba,
71+
GlobalC::ucell.tpiba,
7372
(const double**)gcar);
7473

7574
std::vector<double>().swap(kpt);
@@ -97,7 +96,7 @@ void HSolverPW<T, Device>::call_paw_cell_set_currentk(const int ik)
9796
}
9897

9998
template <typename T, typename Device>
100-
void HSolverPW<T, Device>::paw_func_after_kloop(const UnitCell& ucell, psi::Psi<T, Device>& psi, elecstate::ElecState* pes)
99+
void HSolverPW<T, Device>::paw_func_after_kloop(psi::Psi<T, Device>& psi, elecstate::ElecState* pes)
101100
{
102101
if (this->use_paw)
103102
{
@@ -145,7 +144,7 @@ void HSolverPW<T, Device>::paw_func_after_kloop(const UnitCell& ucell, psi::Psi<
145144
this->wfc_basis->get_ig2iy(ik).data(),
146145
this->wfc_basis->get_ig2iz(ik).data(),
147146
(const double**)kpg,
148-
ucell.tpiba,
147+
GlobalC::ucell.tpiba,
149148
(const double**)gcar);
150149

151150
std::vector<double>().swap(kpt);
@@ -178,7 +177,7 @@ void HSolverPW<T, Device>::paw_func_after_kloop(const UnitCell& ucell, psi::Psi<
178177
{
179178
GlobalC::paw_cell.get_rhoijp(rhoijp, rhoijselect, nrhoijsel);
180179

181-
for (int iat = 0; iat < ucell.nat; iat++)
180+
for (int iat = 0; iat < GlobalC::ucell.nat; iat++)
182181
{
183182
GlobalC::paw_cell.set_rhoij(iat,
184183
nrhoijsel[iat],
@@ -190,7 +189,7 @@ void HSolverPW<T, Device>::paw_func_after_kloop(const UnitCell& ucell, psi::Psi<
190189
#else
191190
GlobalC::paw_cell.get_rhoijp(rhoijp, rhoijselect, nrhoijsel);
192191

193-
for (int iat = 0; iat < ucell.nat; iat++)
192+
for (int iat = 0; iat < GlobalC::ucell.nat; iat++)
194193
{
195194
GlobalC::paw_cell.set_rhoij(iat,
196195
nrhoijsel[iat],
@@ -253,7 +252,6 @@ template <typename T, typename Device>
253252
void HSolverPW<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
254253
psi::Psi<T, Device>& psi,
255254
elecstate::ElecState* pes,
256-
const UnitCell& ucell,
257255
double* out_eigenvalues,
258256
const int rank_in_pool_in,
259257
const int nproc_in_pool_in,
@@ -284,7 +282,7 @@ void HSolverPW<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
284282
pHamilt->updateHk(ik);
285283

286284
#ifdef USE_PAW
287-
this->paw_func_in_kloop(ucell,ik);
285+
this->paw_func_in_kloop(ik);
288286
#endif
289287

290288
/// update psi pointer for each k point
@@ -343,7 +341,7 @@ void HSolverPW<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
343341
reinterpret_cast<elecstate::ElecStatePW<T, Device>*>(pes)->psiToRho(psi);
344342

345343
#ifdef USE_PAW
346-
this->paw_func_after_kloop(ucell,psi, pes);
344+
this->paw_func_after_kloop(psi, pes);
347345
#endif
348346

349347
ModuleBase::timer::tick("HSolverPW", "solve");

source/module_hsolver/hsolver_pw.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@ class HSolverPW
3939
/// @param pHamilt interface to hamilt
4040
/// @param psi reference to psi
4141
/// @param pes interface to elecstate
42-
/// @param ucell reference to unitcell
4342
/// @param method_in dav or cg
4443
/// @param skip_charge
4544
void solve(hamilt::Hamilt<T, Device>* pHamilt,
4645
psi::Psi<T, Device>& psi,
4746
elecstate::ElecState* pes,
48-
const UnitCell& ucell,
4947
double* out_eigenvalues,
5048
const int rank_in_pool_in,
5149
const int nproc_in_pool_in,
@@ -91,11 +89,11 @@ class HSolverPW
9189
std::vector<double> ethr_band;
9290

9391
#ifdef USE_PAW
94-
void paw_func_in_kloop(const UnitCell& ucell, const int ik);
92+
void paw_func_in_kloop(const int ik);
9593

9694
void call_paw_cell_set_currentk(const int ik);
9795

98-
void paw_func_after_kloop(const UnitCell& ucell, psi::Psi<T, Device>& psi, elecstate::ElecState* pes);
96+
void paw_func_after_kloop(psi::Psi<T, Device>& psi, elecstate::ElecState* pes);
9997
#endif
10098
};
10199

0 commit comments

Comments
 (0)