Radial Distribution Function. Java Code
* Computes RDF for the current configuration
public double[] currentValue() {
iterator.reset(); //prepare iterator of atom pairs
for(int i=0; i<nPoints; i++) {y[i] = 0.0;} //zero histogram
while(iterator.hasNext()) { //loop over all pairs in phase
double r = Math.sqrt(iterator.next().r2()); //get pair separation
int index = (int)(r/delr); //determine histogram index
y[index]+=2; //add once for each atom
int n = phase.atomCount(); //compute normalization: divide by
double norm = n*n/phase.volume(); //n, and density*(volume of shell)
for(int i=0; i<nPoints; i++) {y[i] /= (norm*vShell[i]);}
public class MeterRDF extends MeterFunction