Fix misc. analysis neighborhood search issues

- Avoid an overflow fp-exception in case of zero cutoff (original fix by
  Roland).
- If a bounding box of the reference positions has a zero size in
  some dimension, fall back to a single grid cell and simple searching
  in that dimension (this could possibly be improved after the search
  uses a rectangular grid).
- If the bounding box (or the PBC box) is very flat or has a forced
  single grid cell in some dimension, adapt the grid dimensions such
  that the cells really have ~10 particles on average.

Change-Id: I4f8e5df9c4c479e480052e575354c54319bac22f