# Radial pair distribution function (VMD). How to define it for a water NaCl system with multiple Na and Cl?

I'm struggling to understand a paper in which someone has presented radial distribution functions (RDFs) for a system that contains multiple Na, Cl, and water atoms/molecules. I don't know exactly how the RDFs have been calculated--there must be some standard method.

I'm a newbie to molecular dynamics and have run my own simulations. I would like to compare my RDFs to the ones in the paper. However, I am not sure that I understand RDFs. One reason I'm worried is that I keep receiving an error when I try to plot my own RDFs using the software, VMD. The error is something like "cannot measure RDF." It is either a bug in VMD or a conceptual misunderstanding on my part. I don't know exactly how VMD calculates an RDF.

Let's say we have an RDF from Na to Cl in my system that contains multiple Na and Cl. Is it correct that an RDF is based on an average of what ALL Cl atoms are doing in relation to ALL Na atoms? Or do I have to somehow define pairs of Na and Cl (I don't have these--they're all far apart in my system) and create RDFs for each pair?

I'm not sure whether "Chemistry" is the right StackExchange section for this question. If it isn't and anyone has any advice on a more appropriate section, I'd be very grateful. Thank you.

I haven't done it in vmd, but a rdf is really kind of like a histogram. For a particle of interest, you count how many particles are between r and $$\Delta r$$ from it and record that number in a bin, then move outwards, recording numbers in each shell into a bin for that shell. That tells you the rdf of that particle interacting with everything else. If there are three other types of particles in the simulation, you will get 3 rdfs from that one rdf calculation centered at the particle of interest.Repeat for other particles once you are done so you can get a nice average.
So all you need to do is count particles in $$\Delta r$$'s (and from this you get the volume too!, that is trivial though. I would do this for all Na's and Cl's and then average each of their bins to get one rdf for Cl-Cl, one for Cl-Na, one for Cl-O, one for Cl-H.