Obtain the average number of nearest neighbors

I’m just curious that how do I obtain the average number of nearest first/second/etc. neighbors for a system? I know that I can do that in gromacs but I’m not quite sure how to.
Thanks a lot for the help!

Hi mtp2,

You could use gmx mindist, or if you’re not afraid of compiling old code, g_contacts for that, giving you a list of atoms contacting other atoms in a specific frame or on average over a trajectory, then re-run using the results as input for second neighbours.