@@ -223,7 +223,9 @@ void DiagoIterAssist<T, Device>::diag_subspace_init(hamilt::Hamilt<T, Device>* p
223223
224224 if (base_device::get_device_type (ctx) == base_device::GpuDevice)
225225 {
226- psi::Psi<T, Device> psi_temp (1 , 1 , psi_nc, dmin, true );
226+ // / NOTE: current_nbasis must be npw (WITHOUT npol) for Nonlocal::act's
227+ // / gemm K (vkb only has npw rows). See CPU branch comment above.
228+ psi::Psi<T, Device> psi_temp (1 , 1 , psi_nc, evc.get_current_nbas (), true );
227229
228230 T* ppsi = psi_temp.get_pointer ();
229231 // hpsi and spsi share the temp space
@@ -270,7 +272,11 @@ void DiagoIterAssist<T, Device>::diag_subspace_init(hamilt::Hamilt<T, Device>* p
270272 }
271273 else if (base_device::get_device_type (ctx) == base_device::CpuDevice)
272274 {
273- psi::Psi<T, Device> psi_temp (1 , nstart, psi_nc, dmin, true );
275+ // / NOTE: the 4th arg (current_nbasis) must be npw (WITHOUT npol),
276+ // / NOT dmin (= nbasis = npol*npwx in SOC). Nonlocal::act uses
277+ // / psi_temp.get_current_nbas() as gemm K, but vkb only has npw rows.
278+ // / dmin (still = nbasis) is kept for hcc/scc gemm K which needs npol.
279+ psi::Psi<T, Device> psi_temp (1 , nstart, psi_nc, evc.get_current_nbas (), true );
274280
275281 T* ppsi = psi_temp.get_pointer ();
276282 syncmem_complex_op ()(ppsi, psi, psi_temp.size ());
@@ -295,7 +301,6 @@ void DiagoIterAssist<T, Device>::diag_subspace_init(hamilt::Hamilt<T, Device>* p
295301 delmem_complex_op ()(temp);
296302
297303 add_to_hcc (hcc, nstart);
298-
299304 }
300305
301306 if (GlobalV::NPROC_IN_POOL > 1 )
0 commit comments