# Radial distribution function

Dear lammps users,
I am using:
compute myRDF all rdf 1000
fix radi all ave/time 10000 1 10000 c_myRDF[*] file tmp.rdf mode vector
comand to compute the radial distibution function , g(r) values , for an fcc crystal system. As I have understood the relation for computing g(r) is as follows:
g(r)= V*dn(r) / N*4*pi*r^2 *dr
where dn(r) is the number of atoms that lie in a spherical shell of radius r and thickness dr , N total number of atoms and V is the volume of the system.
However, when I used the mentioned command to compute these rdf values using lammps, the values computed did not match the values that I computed manually using this formulation. I wanted to know if lammps is using the same relation for g(r) that I have stated here.
Sincerely,
Melika Vokhshoori

Dear lammps users,
I am using:
compute myRDF all rdf 1000
fix radi all ave/time 10000 1 10000 c_myRDF[*] file tmp.rdf mode vector
comand to compute the radial distibution function , g(r) values , for an
fcc crystal system. As I have understood the relation for computing g(r) is
as follows:
g(r)= V*dn(r) / N*4*pi*r^2 *dr
where dn(r) is the number of atoms that lie in a spherical shell of radius
r and thickness dr , N total number of atoms and V is the volume of the
system.
However, when I used the mentioned command to compute these rdf values
using lammps, the values computed did not match the values that I computed
manually using this formulation. I wanted to know if lammps is using the
same relation for g(r) that I have stated here.

​the expression you quote is a slight simplification. ​it is correct in the
limit of N being a very large number. for smaller systems, you have to
correct the normalization for finite size effects, or else the limit of
g(r) for large r will be (N-1)/N instead of 1.0.

axel.