@@ -36,7 +36,7 @@ ElecStatePW<T, Device>::~ElecStatePW()
3636 delmem_var_op ()(this ->ctx , this ->rho_data );
3737 delete[] this ->rho ;
3838
39- if (PARAM.globalv .double_grid )
39+ if (PARAM.globalv .double_grid || PARAM. globalv . use_uspp )
4040 {
4141 delmem_complex_op ()(this ->ctx , this ->rhog_data );
4242 delete[] this ->rhog ;
@@ -71,7 +71,7 @@ void ElecStatePW<T, Device>::init_rho_data()
7171 {
7272 this ->rho [ii] = this ->rho_data + ii * this ->charge ->nrxx ;
7373 }
74- if (PARAM.globalv .double_grid )
74+ if (PARAM.globalv .double_grid || PARAM. globalv . use_uspp )
7575 {
7676 this ->rhog = new T*[this ->charge ->nspin ];
7777 resmem_complex_op ()(this ->ctx , this ->rhog_data , this ->charge ->nspin * this ->charge ->rhopw ->npw );
@@ -92,7 +92,7 @@ void ElecStatePW<T, Device>::init_rho_data()
9292 else
9393 {
9494 this ->rho = reinterpret_cast <Real **>(this ->charge ->rho );
95- if (PARAM.globalv .double_grid )
95+ if (PARAM.globalv .double_grid || PARAM. globalv . use_uspp )
9696 {
9797 this ->rhog = reinterpret_cast <T**>(this ->charge ->rhog );
9898 }
@@ -124,7 +124,7 @@ void ElecStatePW<T, Device>::psiToRho(const psi::Psi<T, Device>& psi)
124124 // ModuleBase::GlobalFunc::ZEROS(this->charge->kin_r[is], this->charge->nrxx);
125125 setmem_var_op ()(this ->ctx , this ->kin_r [is], 0 , this ->charge ->nrxx );
126126 }
127- if (PARAM.globalv .double_grid )
127+ if (PARAM.globalv .double_grid || PARAM. globalv . use_uspp )
128128 {
129129 setmem_complex_op ()(this ->ctx , this ->rhog [is], 0 , this ->charge ->rhopw ->npw );
130130 }
0 commit comments