DOPAIR1, DOPAIR2 rshift bug?
In the pair interactions there is a condition to skip over particles that don't interact with the neighbouring cell:
const double hi_max = ci->h_max * kernel_gamma - rshift;
const double hj_max = cj->h_max * kernel_gamma;
for (int pid = count_i - 1;
pid >= 0 && sort_i[pid].d + hi_max + dx_max > dj_min; pid--) {
const double di = sort_i[pid].d + hi * kernel_gamma + dx_max - rshift;
if (di < dj_min) continue;
...
which occurs in the first loop and second loop of DOPAIR1. It takes into account boundary conditions with rshift. However, in the second loop the rshift is also applied. Should this happen? I thought you should only apply the rshift to particles in one cell? It would mean that there is more work in the second loop than there needs to be, but the answer would still be correct as there would be no interactions found.
It occurs here:
for (int pjd = 0; pjd < count_j && sort_j[pjd].d - hj_max - dx_max < di_max;
pjd++) {
const double dj = sort_j[pjd].d - hj * kernel_gamma - dx_max - rshift;
if (dj > di_max) continue;
...
plus the rshift is only applied to hi_max and not hj_max which is correct I think.