MDAnalysis / cellgrid

MIT License
7 stars 6 forks source link

capped_distance functions return distances larger then max_dist #12

Open kain88-de opened 6 years ago

kain88-de commented 6 years ago

See https://gist.github.com/kain88-de/247049819f75c0a72b3d61c7967f10ec

The max_dist is set to 10 A.U but there are distances returned with a larger value. The docs state that this shouldn't happen.

kain88-de commented 6 years ago

The reason why this happens is because max_dist used to build the cellgrid binsize. For two particles in neighboring cells it is possible to have a distance larger then the cell bin size.

richardjgowers commented 6 years ago

Yeah so the max_dist is slightly approximate right now which is wrong. An easy fix would be dists = dists[dists <= max_dist] right at the end. Or alternatively filter them as you insert.