Skip to content

Commit e5fcf0c

Browse files
committed
change ucell in sto_iter.cpp
1 parent 0f4fb6d commit e5fcf0c

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

source/module_esolver/esolver_sdft_pw.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ void ESolver_SDFT_PW<T, Device>::hamilt2density_single(UnitCell& ucell, int iste
171171
this->psi[0],
172172
this->pelec,
173173
this->pw_wfc,
174+
ucell,
174175
this->stowf,
175176
istep,
176177
iter,

source/module_hamilt_pw/hamilt_stodft/sto_iter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ void Stochastic_Iter<T, Device>::sum_stoeband(Stochastic_WF<T, Device>& stowf,
562562
template <typename T, typename Device>
563563
void Stochastic_Iter<T, Device>::cal_storho(Stochastic_WF<T, Device>& stowf,
564564
elecstate::ElecStatePW<T, Device>* pes,
565+
const UnitCell& ucell,
565566
ModulePW::PW_Basis_K* wfc_basis)
566567
{
567568
ModuleBase::TITLE("Stochastic_Iter", "cal_storho");
@@ -651,12 +652,12 @@ void Stochastic_Iter<T, Device>::cal_storho(Stochastic_WF<T, Device>& stowf,
651652
#endif
652653
for (int ir = 0; ir < nrxx; ++ir)
653654
{
654-
sto_rho[is][ir] /= GlobalC::ucell.omega;
655+
sto_rho[is][ir] /= ucell.omega;
655656
sto_ne += sto_rho[is][ir];
656657
}
657658
}
658659

659-
sto_ne *= GlobalC::ucell.omega / wfc_basis->nxyz;
660+
sto_ne *= ucell.omega / wfc_basis->nxyz;
660661

661662
#ifdef __MPI
662663
MPI_Allreduce(MPI_IN_PLACE, &sto_ne, 1, MPI_DOUBLE, MPI_SUM, POOL_WORLD);

source/module_hamilt_pw/hamilt_stodft/sto_iter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Stochastic_Iter
6666
*/
6767
void cal_storho(Stochastic_WF<T, Device>& stowf,
6868
elecstate::ElecStatePW<T, Device>* pes,
69+
const UnitCell& ucell,
6970
ModulePW::PW_Basis_K* wfc_basis);
7071

7172
/**

source/module_hsolver/hsolver_pw_sdft.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ void HSolverPW_SDFT<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
1616
psi::Psi<T>& psi_cpu,
1717
elecstate::ElecState* pes,
1818
ModulePW::PW_Basis_K* wfc_basis,
19+
const UnitCell& ucell,
1920
Stochastic_WF<T, Device>& stowf,
2021
const int istep,
2122
const int iter,
@@ -141,7 +142,7 @@ void HSolverPW_SDFT<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
141142
pes_pw->psiToRho(psi);
142143
}
143144
// calculate stochastic rho
144-
stoiter.cal_storho(stowf, pes_pw, wfc_basis);
145+
stoiter.cal_storho(stowf, pes_pw, ucell,wfc_basis);
145146

146147
// will do rho symmetry and energy calculation in esolver
147148
ModuleBase::timer::tick("HSolverPW_SDFT", "solve");

source/module_hsolver/hsolver_pw_sdft.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class HSolverPW_SDFT : public HSolverPW<T, Device>
4747
psi::Psi<T>& psi_cpu,
4848
elecstate::ElecState* pes,
4949
ModulePW::PW_Basis_K* wfc_basis,
50+
const UnitCell& ucell,
5051
Stochastic_WF<T, Device>& stowf,
5152
const int istep,
5253
const int iter,

0 commit comments

Comments
 (0)