From 2ee9243c76645036adc786921ffc3805b9d90224 Mon Sep 17 00:00:00 2001 From: YuLiu98 Date: Wed, 25 Dec 2024 16:38:48 +0800 Subject: [PATCH] Fix: init rhog --- source/module_elecstate/elecstate_pw.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/module_elecstate/elecstate_pw.cpp b/source/module_elecstate/elecstate_pw.cpp index 90dbc3f918..5558856289 100644 --- a/source/module_elecstate/elecstate_pw.cpp +++ b/source/module_elecstate/elecstate_pw.cpp @@ -36,7 +36,7 @@ ElecStatePW::~ElecStatePW() delmem_var_op()(this->ctx, this->rho_data); delete[] this->rho; - if (PARAM.globalv.double_grid) + if (PARAM.globalv.double_grid || PARAM.globalv.use_uspp) { delmem_complex_op()(this->ctx, this->rhog_data); delete[] this->rhog; @@ -71,7 +71,7 @@ void ElecStatePW::init_rho_data() { this->rho[ii] = this->rho_data + ii * this->charge->nrxx; } - if (PARAM.globalv.double_grid) + if (PARAM.globalv.double_grid || PARAM.globalv.use_uspp) { this->rhog = new T*[this->charge->nspin]; resmem_complex_op()(this->ctx, this->rhog_data, this->charge->nspin * this->charge->rhopw->npw); @@ -92,7 +92,7 @@ void ElecStatePW::init_rho_data() else { this->rho = reinterpret_cast(this->charge->rho); - if (PARAM.globalv.double_grid) + if (PARAM.globalv.double_grid || PARAM.globalv.use_uspp) { this->rhog = reinterpret_cast(this->charge->rhog); } @@ -124,7 +124,7 @@ void ElecStatePW::psiToRho(const psi::Psi& psi) // ModuleBase::GlobalFunc::ZEROS(this->charge->kin_r[is], this->charge->nrxx); setmem_var_op()(this->ctx, this->kin_r[is], 0, this->charge->nrxx); } - if (PARAM.globalv.double_grid) + if (PARAM.globalv.double_grid || PARAM.globalv.use_uspp) { setmem_complex_op()(this->ctx, this->rhog[is], 0, this->charge->rhopw->npw); }