From put_in_list we first call new_i_nblist, then add some
j particles and then close_i_nblist
In new_i_nblist the number of i particles is typically
increased by one, that is nblist->nri is increased.
However, in case that there are no j particles, the nri
is not decreased again, which can lead to reading garbage
data from e.g. nblist->jjindex. In addition there is a
left-over variable (len) that computes the number of
j particles added, but this value is not used.
Change-Id: I38601a6865f6a4d879bec55246deded40943afb7
nlist->jindex[nri+1] = nlist->nrj;
len = nlist->nrj - nlist->jindex[nri];
+ /* If there are no j-particles we have to reduce the
+ * number of i-particles again, to prevent errors in the
+ * kernel functions.
+ */
+ if ((len == 0) && (nlist->nri > 0))
+ {
+ nlist->nri--;
+ }
}
}