Testing radial distribution function (rdf) calculation results

Dear all,

My own rdf calculations show different results from lammps. Here is a simple test case:

I have 4 atoms at positions x=[1,2,3,4] and y=0 z=0 for all.
box dimensions:

Assume a large simulation box (no pbc contribution).

If rmax=1.5 and nbin=2,

Sorry, I sent the mail accidentally half done before. The complete version:

Dear all,

My own rdf calculations show different results from lammps. Here is a simple test case:

I have 4 atoms at positions x=[1,2,3,4] and y=0 z=0 for all.
box dimensions so that we have no pbc contribution:
-5 10 xlo xhi
-5 5 ylo yhi
-5 5 zlo zhi
we have vol=1500 and number density is: rho=4/1500
If rmax=1.5 and nbin=2 --> rbin=0.75.

The relative number density for each bin and each atom:
0 30.3152
0 60.6305
0 60.6305

0 30.3152

where the columns correspond to bins and rows to atoms. The mean for the second bin: 45.4728

using:

compute 1 all rdf 2
fix 2 all ave/time 1 1 1 c_1[*] file tmp.rdf mode vector

Lammps gives:

Time-averaged data for fix 2

TimeStep Number-of-rows

Row c_1[1] c_1[2] c_1[3]

0 2
1 0.375 0 0
2 1.125 60.6305 1.5

(60.635=~45.4728) As you can see, it’s as if lammps is not considering the first and last atoms and is computing the average for two atoms. The coordination number is correct however.

I’m attaching the runfile and data file that reproduce this. I’m using 11Aug2017 version of lammps.

Thank you and best regards,
Ali

data.dat (166 Bytes)

runfile (429 Bytes)

Sorry, I sent the mail accidentally half done before. The complete version:

Dear all,

My own rdf calculations show different results from lammps. Here is a
simple test case:

I have 4 atoms at positions x=[1,2,3,4] and y=0 z=0 for all.
box dimensions so that we have no pbc contribution:
-5 10 xlo xhi
-5 5 ylo yhi
-5 5 zlo zhi
we have vol=1500 and number density is: rho=4/1500
If rmax=1.5 and nbin=2 --> rbin=0.75.

The relative number density for each bin and each atom:
0 30.3152
0 60.6305
0 60.6305
0 30.3152
where the columns correspond to bins and rows to atoms. The mean for the
second bin: 45.4728

using:
compute 1 all rdf 2
fix 2 all ave/time 1 1 1 c_1[*] file tmp.rdf mode vector

Lammps gives:

# Time-averaged data for fix 2
# TimeStep Number-of-rows
# Row c_1[1] c_1[2] c_1[3]
0 2
1 0.375 0 0
2 1.125 60.6305 1.5

(60.635=~45.4728) As you can see, it's as if lammps is not considering the
first and last atoms and is computing the average for two atoms. The
coordination number is correct however.

​that is self-inflicted, since your pair style cutoff is 1.5, thus compute
rdf will also use that as a cutoff.
please re-read the documentation for compute rdf.

axel.

…and you don’t seem to be accounting for finite size effects.
LAMMPS does correct for that, or else you would get (n-1)/n for large r instead of 1.0

axel.