diff --git a/tangos/input_handlers/pynbody.py b/tangos/input_handlers/pynbody.py index 8bdaf23e..3508b207 100644 --- a/tangos/input_handlers/pynbody.py +++ b/tangos/input_handlers/pynbody.py @@ -98,6 +98,7 @@ def load_timestep_without_caching(self, ts_extension, mode=None) -> pynbody.snap raise NotImplementedError("Load mode %r is not implemented"%mode) def _build_kdtree(self, timestep, mode): + timestep.wrap() # Because we have converted pos to kpc, FP roundoff may place particles at the boundaries outside the period of the box. timestep.build_tree() def load_region(self, ts_extension, region_specification, mode=None, expected_number_of_queries=None) -> pynbody.snapshot.simsnap.SimSnap: diff --git a/tangos/parallel_tasks/pynbody_server/snapshot_queue.py b/tangos/parallel_tasks/pynbody_server/snapshot_queue.py index 9982d1c5..b4fdf46a 100644 --- a/tangos/parallel_tasks/pynbody_server/snapshot_queue.py +++ b/tangos/parallel_tasks/pynbody_server/snapshot_queue.py @@ -110,6 +110,7 @@ def build_tree(self): num_threads = multiprocessing.cpu_count() else: num_threads = None + self.current_snapshot.wrap() # Because we have converted pos to kpc, FP roundoff may place particles at the boundaries outside the period of the box. self.current_snapshot.build_tree(num_threads=num_threads, shared_mem=self.current_shared_mem_flag)