You might consider the "fix rdf" option, which outputs the radial
distribution function and coordination number for specified atom pairs.
Instantaneous rdfs are printed at specified intervals during the
simulation, and then an average is given at the end. This is all done
during the simulation, not as a post-processing step.