I wanted to have an insight on how you compute the stellar half mass radius with N particles. I want to find the velocities of particles at a distance of any mass, with a factor of X = 0.1, 0.2, etc. Where 0.5 should give the half mass radius.
Do you want to do this for existing subhalos? Then you can use the already computed SubhaloHalfmassRadType values in the catalog.
If you want to compute this yourself, then you can follow the definition: any collection of particles has a "total" of some quantity. If you compute the radial distance of every particle to the center, sort by these distances, and then walk outwards through the particles, summing up the quantity, once you reach half of the total, you have computed the half quantity radius.
Thank you for your suggestion. The code is now able to find the half mass rad with less than 0.1% error when compared with the one given in TNG.