@@ -35,7 +35,7 @@ template <typename T, typename Device>
3535void Stochastic_WF<T, Device>::init(K_Vectors* p_kv, const int npwx_in)
3636{
3737 this ->nks = p_kv->get_nks ();
38- this ->ngk = p_kv->ngk . data () ;
38+ this ->ngk = p_kv->ngk ;
3939 this ->npwx = npwx_in;
4040 nchip = new int [nks];
4141
@@ -111,7 +111,7 @@ void Stochastic_WF<T, Device>::allocate_chi0()
111111
112112 this ->nchip_max = tmpnchip;
113113 size_t size = this ->nchip_max * npwx * nks;
114- this ->chi0_cpu = new psi::Psi<T>(nks, this ->nchip_max , npwx, this ->ngk );
114+ this ->chi0_cpu = new psi::Psi<T>(nks, this ->nchip_max , npwx, this ->ngk , true );
115115 ModuleBase::Memory::record (" SDFT::chi0_cpu" , size * sizeof (T));
116116
117117 for (int ik = 0 ; ik < nks; ++ik)
@@ -123,7 +123,7 @@ void Stochastic_WF<T, Device>::allocate_chi0()
123123 Device* ctx = {};
124124 if (base_device::get_device_type<Device>(ctx) == base_device::GpuDevice)
125125 {
126- this ->chi0 = new psi::Psi<T, Device>(nks, this ->nchip_max , npwx, this ->ngk );
126+ this ->chi0 = new psi::Psi<T, Device>(nks, this ->nchip_max , npwx, this ->ngk , true );
127127 }
128128 else
129129 {
@@ -207,7 +207,7 @@ void Stochastic_WF<T, Device>::init_com_orbitals()
207207 delete[] npwip;
208208 }
209209 size_t size = this ->nchip_max * npwx * nks;
210- this ->chi0_cpu = new psi::Psi<std::complex <double >>(nks, this ->nchip_max , npwx, this ->ngk );
210+ this ->chi0_cpu = new psi::Psi<std::complex <double >>(nks, this ->nchip_max , npwx, this ->ngk , true );
211211 this ->chi0_cpu ->zero_out ();
212212 ModuleBase::Memory::record (" SDFT::chi0_cpu" , size * sizeof (std::complex <double >));
213213 for (int ik = 0 ; ik < nks; ++ik)
@@ -252,7 +252,7 @@ void Stochastic_WF<T, Device>::init_com_orbitals()
252252 Device* ctx = {};
253253 if (base_device::get_device_type<Device>(ctx) == base_device::GpuDevice)
254254 {
255- this ->chi0 = new psi::Psi<T, Device>(nks, this ->nchip_max , npwx, this ->ngk );
255+ this ->chi0 = new psi::Psi<T, Device>(nks, this ->nchip_max , npwx, this ->ngk , true );
256256 }
257257 else
258258 {
@@ -266,7 +266,7 @@ void Stochastic_WF<T, Device>::init_com_orbitals()
266266 const int npwx = this ->npwx ;
267267 const int nks = this ->nks ;
268268 size_t size = this ->nchip_max * npwx * nks;
269- this ->chi0_cpu = new psi::Psi<std::complex <double >>(nks, npwx, npwx, this ->ngk );
269+ this ->chi0_cpu = new psi::Psi<std::complex <double >>(nks, npwx, npwx, this ->ngk , true );
270270 this ->chi0_cpu ->zero_out ();
271271 ModuleBase::Memory::record (" SDFT::chi0_cpu" , size * sizeof (std::complex <double >));
272272 for (int ik = 0 ; ik < nks; ++ik)
@@ -284,7 +284,7 @@ void Stochastic_WF<T, Device>::init_com_orbitals()
284284 Device* ctx = {};
285285 if (base_device::get_device_type<Device>(ctx) == base_device::GpuDevice)
286286 {
287- this ->chi0 = new psi::Psi<T, Device>(nks, this ->nchip_max , npwx, this ->ngk );
287+ this ->chi0 = new psi::Psi<T, Device>(nks, this ->nchip_max , npwx, this ->ngk , ture );
288288 }
289289 else
290290 {
0 commit comments