Pair distribution function g(r)

In this example, we show how to obtain the pair distribution function (also known as radial distribution function) from the atoms trajectories. Let’s assume we have a file with the positions of atoms for each time step of a simulation. If the file is written in the native LPMD format, and called  myfile.lpmd, we can obtain the average g(r) with a single command:

FROM THE COMMAND LINE
lpmd-analyzer -i lpmd:myfile.lpmd -r -u gdr:rcut=5.0,output=g_of_r.dat,average=true -c minimumimage:cutoff=8.0
FROM CONTROL FILE
set replacecell true
input module=lpmd file=myfile.lpmd

use minimumimage
    cutoff 8.0
enduse

use gdr
    rcut 5.0
output g_of_r.dat
average true
enduse

property gdr

    • -i = Determines the plugin to be used as an input. Possible input plugins are crystal3d (as above), xyz, lpmd, lammps, vasp, pdb, and any other available file format. It is the equivalent of module in the control file.
    • -r = Read the cell vectors from the input file. This option is the equivalent to set replacecell true in the control file, and replaces the previously discussed -L (see Create/modify samples).
    • gdr = This is the name of the plugin that calculates g(r). Check the parameters it receive using lpmd -p gdr.
      • rcut = Maximum distance that r in which g(r) will be evaluated. MUST BE less or equal than 1/2 of the shortest edge of the simulation box to avoid self counting.
      • output = File in which the pair distribution function will be written (in this case, g_of_r.dat)..
      • average = Average over all the steps in the simulation. This is generally what is reported as a property of the system, but if you need the static pair distribution function (the separated g(r) for every snapshot of the simulation), then you can use average=false (or simply don’t write it, and average will take its default value).
    • -c = Choose the cell manager method to handle atom neighbors. This  is mandatory for every time lpmd-analyzer is used, even if you don’t use periodic boundary conditions.
      • minimumimage = This is one of the most common ways to handle neighbors counting in molecular dynamics. You can read more about it in this link,. Another option is the linkedcell method.