Useful Scripts

Below are several C++ files I wrote during the project. Since they may require adjusting to support different input formats, I attach the source code only. Source can be compiled on Windows using a compiler of your choice. Code::Blocks is a free compiler that can be used to compile the sources below. On linux, the sources can be compiled using the g++ compiler.

Script to identify and mark the number of neighbours for each atom in the model: Source Code.
The Code marks the number of neighbours as the first value of each atom. It expects 8 arguments - input .xyz file, new output file, simulation box limits - lower x, upper x, lower y, upper y, lower z, upper z.
An example of a .xyz file can be found here.
Bulding the executable can be done using the command:

g++ SP2Marker.cpp -o SP2Marker.ex

Script to calculate and save the Radial Distribution Function into a file: Source Code.
The Code calculates the histogram of the pair correlation. It expects 12/15 arguments - input .xyz file, histogram output file, boundary conditions - [s/p][s/p][s/p] with s being free boundary and p being periodic, simulation box limits - lower x, upper x, lower y, upper y, lower z, upper z, cutoff, bin size and region. Region can either be the string "full" or the centre point (x,y,z) and the radius.
Bulding the executable can be done using the command:

g++ RDFCalculator.cpp -o RDFCalculator.ex

To return to the LAMMPS guide, press here.