How to calculate RDF (Radial Distribution Function)

Click For Summary

Discussion Overview

The discussion revolves around the calculation of the Radial Distribution Function (RDF), focusing on its theoretical formulation, practical computation, and the interpretation of results. Participants explore various aspects of RDF, including statistical considerations, normalization methods, and the implications of particle distribution in simulations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about the calculation of RDF and shares their formula, questioning the smoothness of their RDF plot compared to a reference from Wikipedia.
  • Another participant suggests that the lack of smoothness may be due to statistical fluctuations and recommends using a larger number of particles for better results.
  • There is a discussion about whether RDF should be averaged over all particles or calculated for individual particles, with differing opinions on the approach.
  • One participant explains the normalization process for RDF, emphasizing the importance of considering the number density of the system and the volume of the spherical shell.
  • Participants discuss the meaning of the Dirac delta function in the context of RDF calculations, with clarifications provided about its role in the mathematical formulation.
  • There is confusion regarding the use of the total number of particles in the RDF formula, with some participants questioning the necessity of dividing by N multiple times.
  • One participant reflects on their understanding of the RDF calculation and the implications of averaging over particles, expressing uncertainty about their approach.
  • Another participant highlights the importance of the particle's position within the simulation volume and how it affects the RDF results.

Areas of Agreement / Disagreement

Participants express differing views on how to compute RDF, particularly regarding whether to average over all particles or focus on individual particles. There is no consensus on the optimal method for calculating RDF or the interpretation of certain mathematical components.

Contextual Notes

Participants note that the RDF calculations depend on the number of particles and the specific definitions used, which may lead to variations in results. The discussion also highlights the importance of statistical considerations in RDF computation.

Auteng
Messages
20
Reaction score
1
Dear friends
How can i calculate RDF(radial distribution function)?
Thanks
 
Physics news on Phys.org
What are you starting with?
 
  • Like
Likes   Reactions: Auteng
I attache my RDF plot
is it true?
Why it is not smooth?
27 particles in 3.8nm*3.8nm*3.8nm
my formula:
g=(h(n)*l_x^3)/(n_p*4*pi*((n-0.5)*delta_r)^2*delta_r);
h(n):number of particles in bin
n_p:total number of particles
bY0MgDJ.png

But this RDF figure form Wikipedia is very smooth:
and my first peak is very more than this figure...
800px-Radial_Distribution_Function_of_Liquid_Argon.png
 
Last edited:
What are the particle sizes in your simulation ? And in the Wiki figure ?
Auteng said:
Why it is not smooth
Purely statistics. Instead of a cube, take a sphere and use a higher number of particles. You should realize that 8 particles in a bin is ##\pm\sqrt8## ! If you want a noise band of 1%, make sure that even in the higher ##r## bins there are at least 10000 particles per bin !
 
  • Like
Likes   Reactions: Auteng
Should i average RDF on all particles?

Or RDF is for one particle?
 
The RDF is usually determined by calculating the distance between all particle pairs and binning them into a histogram. The histogram is then normalized with respect to an ideal gas, where particle histograms are completely uncorrelated. For three dimensions, this normalization is the number density of the system multiplied by the volume of the spherical shell, which mathematically can be expressed as ##{\displaystyle g(r)_{I}=4\pi r^{2}\rho dr}##, where ##{\displaystyle \rho }## is the number density.
From where you nicked the picture :rolleyes:.
In order not to bias the result: take a few of the particles near the center of your sphere (which should have a radius well exceeding your ##r/\sigma## scale)
 
  • Like
Likes   Reactions: Auteng
I write the RDF formula:

$$g(r)=\frac{\frac{particle at each bin} {4 \pi r^2}} {\frac{total number of atoms} {V total}}$$

But i don't understand why the following link two times divided it by N. I think we should divide by N one time according to the formula that i have wrote...
http://www.physics.emory.edu/faculty/weeks//idl/gofr2.html
 
What is the meaning of ##\delta (r-r_{ij})## in the following equation?

8iVzem8.png


Before all what is the meaning of ##\delta##?
 
Kronecker delta: (integer argument) ##\delta_{ij} = 1## if ## i = j## and for all other values of the argument it is 0.
Not to be confused with the Dirac delta function, ...

But what you have here is the Dirac delta function (real number as argument) which -- for beginning physicists -- is a kind of limit of a 'spike at zero', such that the function is zero for all arguments ##\ne 0## but ##\displaystyle \int_{-\infty}^{+\infty} \delta(x) \, dx = 1 ## nevertheless.

You get away with it because in fact you don't plot/calculate ##g(r)## but ##\int g(r) \, dV## with ##dV = 4\pi r^2 dr ##, the bin width of your histogram.
 
  • Like
Likes   Reactions: Auteng
  • #11
Auteng said:
I write the RDF formula:

$$g(r)=\frac{\frac{particle at each bin} {4 \pi r^2}} {\frac{total number of atoms} {V total}}$$

But i don't understand why the following link two times divided it by N. I think we should divide by N one time according to the formula that i have wrote...
http://www.physics.emory.edu/faculty/weeks//idl/gofr2.html
Can't read it. What is the dimension of particleateachbin ? :smile:

the 2N occurs because you encounter each pair twice, e.g. 34 as 3,4 and as 4,3

[edit] no, that's corny. If you change particleateachbin to numberofparticlesineachbin I'd be happy.
 
  • Like
Likes   Reactions: Auteng
  • #12
particleateachbin=particle at each bin(particles between r , r+dr)
totalnumberofatoms=total number of atoms(N)
 
  • Like
Likes   Reactions: BvU
  • #13
Auteng said:
particleateachbin=particle at each bin(particles between r , r+dr)
totalnumberofatoms=total number of atoms(N)
And remember: that is ##g(r)dr##, not ##g(r)## -- check dimensions
 
  • Like
Likes   Reactions: Auteng
  • #14
Yes i forgot dr in denominator

But the formula that i write is not math with #8
My formula has one N but that formula have two N one in denominator and one in ##\rho_0=N/V##
 
  • #15
I think i should take average over all of particles...??!

What i write is for one particle...?!o_O

Is it true?
 
  • #16
I think for example if we have 3 particles:
first we look at bin 1 for all three particles:
bin 1 for particle 1: 1 atom
bin 1 for particle 2: 1 atom
bin 1 for particle 3: 0 atom

And so on...

we have ##\frac{2} {3} = 0.67## for bin 1 in histogram?
 
  • #17
Hmm, I think I'm making a mess of this. Misunderstood the two N for 2N.
For three dimensions, this normalization is the number density of the system multiplied by the volume of the spherical shell, which mathematically can be expressed as ##{\displaystyle g(r)_{I}=4\pi r^{2}\rho dr}##, where ##{\displaystyle \rho }## is the number density.
##g(r)## is dimensionless and should go to 1 for ##r>>\sigma## (because by then density shouldn't depend on ##r## any more).
So I think #8 (where did that come from?) is something else :smile: than #7. (or it has something to do with this dirac delta)

Your denominator in #7 is ##\rho##. Your numerator goes toward ##\rho## so I think you are OK: the number of particles between ##r## and ##r+dr## is ##g(r) \rho \, 4\pi r^2 \, dr ## so ##g(r)## gives the ratio between what you expect from ideal gas (see quote) and what you count.

Auteng said:
I think i should take average over all of particles...??!
(same as post #5). Do you expect a difference ?
What i write is for one particle...?!o_O
Is that a question ? After all, it's your calculation: you should know that better than anyone else :rolleyes:

Back to post #4: You haven't described what you actually do for your calculation, but one can imagine there is a simulation going on of a volume with particles that obey this potential function. So you have a bunch of positions.

If you take the particle closest to the center of your volume, you get some statistics that can be improved by taking some more particles near the center and repeat. But the further you get from the center, the more asymmetric and biased things become: for a particle at the boundary of your volume the average distance is considerably bigger that for the original particle at the center.

It's a tradeoff; I suppose you are reasonably OK as long as your total volume radius ##>>## the maximum ##r/\sigma## of your ##g(r)## plot and the radius of the sphere you use for counting is ##<## than that maximum. The translation from ## >> ## to a number is up to you (you simply look at the results).
 
  • Like
Likes   Reactions: Auteng

Similar threads

  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 28 ·
Replies
28
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K