@@ -64,6 +64,13 @@ void pseudopot_cell_vnl::release_memory()
6464 delmem_ch_op ()(this ->c_deeq_nc );
6565 delmem_ch_op ()(this ->c_vkb );
6666 delmem_ch_op ()(this ->c_qq_so );
67+ #ifdef __DSP
68+ if (this ->z_vkb != nullptr )
69+ {
70+ base_device::memory::delete_memory_op_mt<std::complex <double >, base_device::DEVICE_CPU>()(this ->z_vkb );
71+ this ->z_vkb = nullptr ;
72+ }
73+ #endif
6774 // There's no need to delete double precision pointers while in a CPU environment.
6875 }
6976 memory_released = true ;
@@ -273,13 +280,13 @@ void pseudopot_cell_vnl::init(const UnitCell& ucell,
273280 resmem_sh_op ()(s_tab, this ->tab .getSize ());
274281 resmem_ch_op ()(c_vkb, nkb * npwx);
275282 }
276- #ifdef __DSP
283+ #ifdef __DSP
277284 base_device::memory::resize_memory_op_mt<std::complex <double >, base_device::DEVICE_CPU>()
278- (this ->z_vkb , this ->vkb .size , " Nonlocal<PW>::ps " );
279- memcpy (this ->z_vkb ,this ->vkb .c ,this ->vkb .size *16 );
280- #else
285+ (this ->z_vkb , this ->vkb .size , " VNL::z_vkb " );
286+ // memcpy(this->z_vkb,this->vkb.c,this->vkb.size*16);
287+ #else
281288 this ->z_vkb = this ->vkb .c ;
282- #endif
289+ #endif
283290 this ->d_tab = this ->tab .ptr ;
284291 // There's no need to delete double precision pointers while in a CPU environment.
285292 }
@@ -293,12 +300,12 @@ void pseudopot_cell_vnl::init(const UnitCell& ucell,
293300// with structure factor, for all atoms, in reciprocal space
294301// ----------------------------------------------------------
295302template <typename FPTYPE, typename Device>
296- void pseudopot_cell_vnl::getvnl (Device* ctx,
303+ void pseudopot_cell_vnl::getvnl (Device* ctx,
297304 const UnitCell& ucell,
298- const int & ik,
305+ const int & ik,
299306 std::complex <FPTYPE>* vkb_in) const
300307{
301- if (PARAM.inp .test_pp )
308+ if (PARAM.inp .test_pp )
302309 {
303310 ModuleBase::TITLE (" pseudopot_cell_vnl" , " getvnl" );
304311 }
@@ -732,10 +739,10 @@ void pseudopot_cell_vnl::init_vnl(UnitCell& cell, const ModulePW::PW_Basis* rho_
732739 for (int iq = 0 ; iq < PARAM.globalv .nqx ; iq++)
733740 {
734741 const double q = iq * PARAM.globalv .dq ;
735- ModuleBase::Sphbes::Spherical_Bessel (kkbeta, cell.atoms [it].ncpp .r .data (), q, l, jl);
742+ ModuleBase::Sphbes::Spherical_Bessel (kkbeta, cell.atoms [it].ncpp .r .data (), q, l, jl);
736743 for (int ir = 0 ; ir < kkbeta; ir++)
737- {
738- aux[ir] = cell.atoms [it].ncpp .betar (ib, ir) * jl[ir] * cell.atoms [it].ncpp .r [ir];
744+ {
745+ aux[ir] = cell.atoms [it].ncpp .betar (ib, ir) * jl[ir] * cell.atoms [it].ncpp .r [ir];
739746 }
740747 double vqint=0.0 ;
741748 ModuleBase::Integral::Simpson_Integral (kkbeta, aux, cell.atoms [it].ncpp .rab .data (), vqint);
@@ -1723,7 +1730,7 @@ template void pseudopot_cell_vnl::getvnl<float, base_device::DEVICE_CPU>(base_de
17231730 int const &,
17241731 std::complex <float >*) const ;
17251732template void pseudopot_cell_vnl::getvnl<double , base_device::DEVICE_CPU>(base_device::DEVICE_CPU*,
1726- const UnitCell&,
1733+ const UnitCell&,
17271734 int const &,
17281735 std::complex <double >*) const ;
17291736#if defined(__CUDA) || defined(__ROCM)
0 commit comments