I have been trying to find the nearest subhalo, bit am being unsuccessful. Can you help me with that. How to find the nearest subhalo to another subhalo.

Dylan Nelson

14 Jul '21

Hi Divyam,

You should (1) write a function which calculates the distance between two points, x1,y1,z1 and x2,y2,z2, accounting for the periodic boundary conditions of the box. Then (2) load SubhaloPos for all subhalos, and compute the distance for every one, from your subhalo of interest. (3) take the minimum.

I have been trying to find the nearest subhalo, bit am being unsuccessful. Can you help me with that. How to find the nearest subhalo to another subhalo.

Hi Divyam,

You should (1) write a function which calculates the distance between two points,

`x1,y1,z1`

and`x2,y2,z2`

, accounting for the periodic boundary conditions of the box. Then (2) load`SubhaloPos`

for all subhalos, and compute the distance for every one, from your subhalo of interest. (3) take the minimum.Thank you!!