I noticed that a large (hours-long) simulation ran much slower when I put a primitive wall/gran/hertz/history on the left side of the box (at xlo), than in an identical simulation but where the primitive wall is on the right side (at xhi). After a little bit of head scratching, I found this at line 124 of primitive_wall_definitions.h:
static bool resolveNeighlist(double *pos, double r, double treshold, double *param)
{
double dMax = r + treshold;
double dist = pos[d::x] - *param;
return (dMax < dist || -dMax < dist);
}
It seems like this is trying to build a neighbor list for the wall of particles which are within the neighbor cutoff. But the condition is strange, "(dMax < dist || -dMax < dist)". That would grab any particles where dist is positive and much larger than dMax, i.e. far outside of the cutoff. In my simulations, that happens to include a few hundred thousand extra particles when the wall is at xlo. I think the condition should be something like this:
static bool resolveNeighlist(double *pos, double r, double treshold, double *param)
{
double dMax = r + treshold;
double dist = pos[d::x] - *param;
double absdist = (dist > 0.0) ? dist : -dist;
return (absdist <= dMax);
}
ckloss | Thu, 05/16/2013 - 17:12
Hi Sam,
Hi Sam,
thanks... you're right, this actually will bloat the neighbor list unnecessarily. I'll include your proposed patch in the next release (either today or on Tuesday)
thanks,
Christoph