diff --git a/src/gw_large_cell_gamma_ri_rs.F b/src/gw_large_cell_gamma_ri_rs.F index 9ca1085bec..7ef7f0267c 100644 --- a/src/gw_large_cell_gamma_ri_rs.F +++ b/src/gw_large_cell_gamma_ri_rs.F @@ -242,7 +242,9 @@ CONTAINS atomic_center(:) = particle_set(atom_idx)%r(:) start_idx = ri_rs_grid_offsets(atom_idx) - end_idx = ri_rs_grid_offsets(atom_idx + 1) - 1 + ! offsets are filled in kind-grouped order, so offsets(atom_idx+1) belongs to an + ! unrelated atom when elements are interleaved in the geometry; span from own kind + end_idx = start_idx + bs_env%ri_rs%grid_cache(ikind)%npts - 1 !! Shift the cached origin grid by the atom's center ri_rs_grid_points(1, start_idx:end_idx) = bs_env%ri_rs%grid_cache(ikind)%raw_points(1, :) + atomic_center(1)