1. johnjosephwilliamson
  2. PHD Code Clone (bitbucket)


README -- November 2012
John J. Williamson
Email: johnjosephwilliamson@gmail.com for assistance in running a simulation.
NOTE: you need a simconfig.txt to run the simulation, and a preinit.txt to initialise it. Contact me for the latest example versions of these.

This repository contains all the different code for simulation and analysis. doesn't contain the Windows graphical wrapper code that I made in Borland to visually check for bugs.

Recommended procedure/versions of code to use
For initialisation, use Initialiser or Schulzdistrn_Initialiser depending if one wants the polydispersity to be Gaussian or Schulz.
For Main simulation, use SQWell Scalable. The 'Scalable' refers to the nature of the SQWell interaction, but one can disable the square wells to leave standard hard spheres, just by setting the well range to zero. The plain hardsphere_simulation code is a little older and I mainly worked on the SQWell codes towards the end.

Intialiser code
For initialising particle distributions and simulation boxes, taking input from 
preinit.txt parameters file. Versions:
-- 110face_Initialiser -- for generating simulations where the (110) face is used as a template.
-- DUAL_Initialiser -- for generating two side-by-side templates and two separate Gaussian particle size distributions. Use Maple spreadsheet to calculate required parameters for this, kind of complicated.
-- Schulzdistrn_Initialiser -- same as standard, but makes a Schulz size distribution rather than a Gaussian.
-- Initialiser -- standard initialiser code.

Main simulation code

The core simulation file is 'newsimulation.cpp', which is wrapped by TextMode0.cpp etc. In the same folder as newsimulation.cpp, 3 versions of the TextMode wrapper exist: 0 for Data mode, 1 for Equil mode and 2 for Crash Recovery mode. These are the source files which are actually built, and they include newsimulation.cpp.

The include file 'random.h' needs to be in the same folder for compilation. The compiler needs to be told the location of the boost directory, which is in the top level of the repo.

-- 110face_Scalable -- Square Well interaction (scalable variation with particle size), for (110) template face.
-- A-O_simulation -- simulates using the A-O interaction potential.
-- DUAL_Scalable -- Square Well interaction (scalable variation), for dual crystal templates.
-- HardSphere_simulation -- just hard sphere code.
-- SQWell_Simulation -- Scalable and NonScalable versions of square well potential code. 

Compiling TextMode (e.g. TextMode0) simulations
g++ -lm -I<path to boost folder> TextMode0.cpp

or with the proper path and optimise options:
g++ -lm -I./../../ TextMode0.cpp -O2 -o SQWell_50_0

Optimised (depends on compiling machine):
g++ -lm -I../../ -O3 -ftree-vectorize TextMode2.cpp -funroll-loops -march=native

there I've named the executable to indicate whether it's type 0, 1, 2 and put in 50 to show that it makes that many lines per .dat file.

Other code
The rest of the repository consists of various mini-applications for analysis and post-processing of data etc. 

-- Averager... -- takes 3-column (time, control [e.g. x], property [e.g. area density]) and averages over the first or second column. Very useful.
-- Crystallinity_Averager -- averages the DAT_crystallinity files in multiple *folders*, being run from the directory above, to simplify the averaging for loads of files. prints time, avg, and stderror.
-- dirtytoDAT.sh -- converts 'dirty' files to clean data files. Only needed using once.
-- G-L_phaseanalysis -- analyses fractionation properties of the gas and liquid phases according to a local neighbour density definition of the phases.
-- Interface_finder -- finds the position of the crystal interface, defined by some specified density drop, through time and prints to a file.
-- LocalSizeCorrelation2 -- finds a neighbour-neighbour size correlation function either inside or outside the crystal interface position, found by the Interface_finder code, for specified radial neighbour shells. run multiple times to make a rdf-style local size correlation function. Should economise this to make it do that automatically really.
-- MeanRadius_Through_Time -- finds meanradius in the crystal (where crystalline particles are those flagged by the q6 algorithm). This isn't ideal really because the q6 recognition algorithm is sensitive to size.
-- MeanRadius_Through_Time_Interfaceposn -- finds meanradius in the crystal where crystalline particles are defined instead as those behind the interface. Better as it counts *all* particles in the crystal region rather than only those recognised by the q6 algorithm.
-- MSD_Analysis_1.1 -- analyses the self diffusion of particles via mean-squared displacement. Can bin particles by size to measure size dependent self diffusion.
-- Radius_list_finder -- just prints to file all the particle radii in a specified x-region at a specified time. For observing particle sizes along the crystal growth axis.
-- RDF -- code to take RDFs either in front of or behind the crystal interface. In a homogeneous system, run Interface_finder to generate a 'interface' dummy at x=0, then run RDF.
-- REC-DAT_renamer -- where simulations have been resumed, resulting in REC_DAT files, this changes them back to DAT files according to user-input numbering scheme. 
-- Strucfac_code -- used to do RDFs, now just does strucfacs. Can do static and dynamic (intermediate scattering function) kinds of strucfac.
-- Truncater -- truncates a 3-column data file at a certain value of a control variable. Useful for reducing size of large data files where we are only interested in sub-parts of the system.
-- XYZ_converter -- converts x_DAT_dynamic_props.dat files into OVITO-readable .xyz files.