Implementation of periodic boundary conditions for k-d trees k

Hi all,

I'm porting some old university project code from Python, and one task within was to find the index of the nearest neighbour of each of N randomly-generated points in a periodic unit cube.

I ported the code 'successfully' using kd-tree and rayon (thanks again to @mmmmib!) only to realise the results were mostly incorrect as I had failed to account for the periodic boundary conditions. Implementing this is fairly trivial in Python, since one can just make use of scipy.spatial.KDTree and specify a boxsize of [1,1,1] for the periodic unit cube.

Does anyone know if there exists a k-d tree crate in Rust that implements periodic boundary conditions in a similar way (or at all)? I read through the docs of 'kd-tree' and nothing appeared to come up. If there aren't any it's no problem; I suspect it's a fairly niche edge-case.


1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.