Segfault when too many neighbor bins

I tried a simulation that resulted in atoms spread over a very large distance. It crashed with a segfault and I found a bug in the way that the "Too many neighbor bins" error condition is calculated:
Line 1560 of neighbor.cpp is:
bigint bbin = mbinx*mbiny*mbinz;
However, this results in the RHS being computed as a 32-bit integer before conversion to a bigint and so, if the result does not fit in 32 bits, then it overflows and the resulting negative value is stored in bbin.
The error message works correctly without a segfault if the line is changed to:
bigint bbin = ((bigint)mbinx)*((bigint)mbiny)*((bigint)mbinz);

Tom Coles

Space Propulsion Lab, MIT

good catch - I just added the change in the 18Feb patch