Skip to content

Commit 6632c0b

Browse files
authored
fix nspin=4 error (#5319)
1 parent 3eac0e2 commit 6632c0b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

source/module_hamilt_lcao/module_gint/gint_vl_gpu.cu

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ void gint_vl_gpu(hamilt::HContainer<double>* hRGint,
4747
checkCuda(cudaStreamCreate(&streams[i]));
4848
}
4949

50-
Cuda_Mem_Wrapper<double> grid_vlocal_g(hRGint->get_nnr(), 1, false);
50+
const int nnrg = is_gamma_only ? hRGint->get_nnr() : gridt.nnrg;
51+
Cuda_Mem_Wrapper<double> grid_vlocal_g(nnrg, 1, false);
5152
grid_vlocal_g.memset_device_sync();
5253

5354
Cuda_Mem_Wrapper<double> dr_part(max_atom_per_z * 3, num_streams, true);
@@ -189,15 +190,15 @@ void gint_vl_gpu(hamilt::HContainer<double>* hRGint,
189190
checkCuda(cudaMemcpy(
190191
hRGint->get_wrapper(),
191192
grid_vlocal_g.get_device_pointer(),
192-
hRGint->get_nnr() * sizeof(double),
193+
nnrg * sizeof(double),
193194
cudaMemcpyDeviceToHost));
194195
}
195196
else
196197
{
197198
checkCuda(cudaMemcpy(
198199
pvpR,
199200
grid_vlocal_g.get_device_pointer(),
200-
hRGint->get_nnr() * sizeof(double),
201+
nnrg * sizeof(double),
201202
cudaMemcpyDeviceToHost));
202203
}
203204
for (int i = 0; i < num_streams; i++)

0 commit comments

Comments
 (0)