Nearest neighbour

Divyam Kalra
  • 13 Jul

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

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.

Divyam Kalra
  • 19 Jul

Thank you!!

  • Page 1 of 1