Skip to content

Commit adb8a2f

Browse files
committed
change ucell in pwdft/stress_func_loc.cpp
1 parent a9626e7 commit adb8a2f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

source/module_hamilt_pw/hamilt_pwdft/stress_func.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ class Stress_Func
133133
ModuleBase::matrix& sigma,
134134
ModulePW::PW_Basis* rho_basis,
135135
const Charge* const chr); // gga part in both PW and LCAO basis
136-
void stress_mgga(ModuleBase::matrix& sigma,
136+
void stress_mgga(const UnitCell& ucell,
137+
ModuleBase::matrix& sigma,
137138
const ModuleBase::matrix& wg,
138139
const ModuleBase::matrix& v_ofk,
139140
const Charge* const chr,

source/module_hamilt_pw/hamilt_pwdft/stress_func_mgga.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
// calculate the Pulay term of mGGA stress correction in PW
1111
template <typename FPTYPE, typename Device>
12-
void Stress_Func<FPTYPE, Device>::stress_mgga(ModuleBase::matrix& sigma,
12+
void Stress_Func<FPTYPE, Device>::stress_mgga(const UnitCell& ucell,
13+
ModuleBase::matrix& sigma,
1314
const ModuleBase::matrix& wg,
1415
const ModuleBase::matrix& v_ofk,
1516
const Charge* const chr,
@@ -52,9 +53,9 @@ void Stress_Func<FPTYPE, Device>::stress_mgga(ModuleBase::matrix& sigma,
5253

5354
for (int ibnd = 0; ibnd < PARAM.inp.nbands; ibnd++)
5455
{
55-
const FPTYPE w1 = wg(ik, ibnd) / GlobalC::ucell.omega;
56+
const FPTYPE w1 = wg(ik, ibnd) / ucell.omega;
5657
const std::complex<FPTYPE>* psi = &psi_in[0](ik, ibnd, 0);
57-
XC_Functional::grad_wfc<std::complex<FPTYPE>, Device>(ik, GlobalC::ucell.tpiba, wfc_basis, psi, gradwfc.data<std::complex<FPTYPE>>());
58+
XC_Functional::grad_wfc<std::complex<FPTYPE>, Device>(ik, ucell.tpiba, wfc_basis, psi, gradwfc.data<std::complex<FPTYPE>>());
5859
cal_stress_mgga_solver(
5960
current_spin, nrxx, w1, gradwfc.data<std::complex<FPTYPE>>(), crosstaus.data<FPTYPE>());
6061
} // band loop

source/module_hamilt_pw/hamilt_pwdft/stress_pw.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ void Stress_PW<FPTYPE, Device>::cal_stress(ModuleBase::matrix& sigmatot,
7979
this->stress_gga(ucell,sigmaxc, rho_basis, pelec->charge);
8080
if (XC_Functional::get_func_type() == 3 || XC_Functional::get_func_type() == 5)
8181
{
82-
this->stress_mgga(sigmaxc,
82+
this->stress_mgga(ucell,
83+
sigmaxc,
8384
this->pelec->wg,
8485
this->pelec->pot->get_effective_vofk(),
8586
pelec->charge,

0 commit comments

Comments
 (0)