I think there are scenarios when _gen_relevant_images misses generation of some needed image. See picture below for a scenario with 2D periodic boundary conditions. The query particle is located at the center of the red circle on the left. The query search radius is r.
In the picture, the query particle is located at the center of the red circle on the left. The shaded red area indicates that we will need to add an image, the red-dashed circle. If we go to _gen_relevant_images() and start checking along the X-axis (i=0) we have that abs(real_x[i]) > d so condition at line 35 is not met. We also have abs(bounds[i] - real_x[i]) > d so condition at line 39 is not met either. We end up adding no image.
I think there are scenarios when
_gen_relevant_images
misses generation of some needed image. See picture below for a scenario with 2D periodic boundary conditions. The query particle is located at the center of the red circle on the left. The query search radius isr
.According to periodic_kdtree.py L90-91:
from the picture,
self.max_distance_upper_bound == d
.Now if we set
distance_upper_bound == r
withr
that of the picture, then the capping of this quantity at periodic_kdtree.py L105-106will result in
distance_upper_bound == d
In the picture, the query particle is located at the center of the red circle on the left. The shaded red area indicates that we will need to add an image, the red-dashed circle. If we go to _gen_relevant_images() and start checking along the X-axis (
i=0
) we have thatabs(real_x[i]) > d
so condition at line 35 is not met. We also haveabs(bounds[i] - real_x[i]) > d
so condition at line 39 is not met either. We end up adding no image.