Evaluating coordination number in Paraview?

I solved the problem by adding an extra segment of code to iterate through all the particles and perform contact checks. However, this approach definitely sacrifices computational efficiency.The results shown in the latest attached figures also confirm that using OVERLAP_N in calc_force_dem.f to determine the number of particle contacts might be unreasonable.