Distance between atoms

Hi.

I work on a bulk water system and aim to calculate the distances between oxygen atoms throughout the entire setup at every a few timesteps.
With 512 water molecules comprising the system, directly computing the distances between all pairs of oxygen atoms would strain computational resources significantly.

I’m exploring whether LAMMPS can handle this computation efficiently.
Given the substantial system size, I’m contemplating an alternate strategy: periodically computing distances between 100 randomly selected pairs of oxygen atoms at intervals during a lengthy simulation run.

I’d appreciate hearing your thoughts on this approach.

Why not compute the g(r)?

I want to feed the result to some machine learning based methods to help me to realize the structural differences in my system. I should try g(r) and also angular distribution function.
Thanks.