Reviewing the compute RDF class
In this section, we will look at the source code for the compute_rdf.cpp
and compute_rdf.h
classes, which govern the compute RDF
class.
The compute RDF
class calculates the radial distribution function (RDF) of a group of atoms and returns the normalized numbers of neighbors, sorted into bins that have a uniform radial width () and that extend from zero to a specified cutoff distance. The output is returned as a 1D array that can be used to plot an RDF histogram. For each atom, the value of its RDF (g(r)) at a distance, r, is calculated by taking the ratio of the number of its neighboring atoms (N), which are located in the distance range (r, ) from the atom, to the number of atoms that would have been located in the same range if the atom distribution were uniform.
To derive this function, we must divide the periphery space of a central atom into shells of width dr that each occupy a volume of :
From the preceding equation, dn(r) represents...