This is an event-driven Monte Carlo (EDMD) code for particles interacting via the Weeks-Chandler-Andersen (WCA) potential. It is based on this hard-sphere EDMD code (in particular the "Single" variant), adapted to implement the rejection-free Monte Carlo method introduced by Peters and de With.
Contains an implementation of Xoshiro256+, see Ref., and this page.
Code published along with the paper:
Fast event-driven simulations for soft spheres: from dynamics to Laves phase nucleation
A. Castagnède, L. Filion, and F. Smallenburg,
Journal Of Chemical Physics 161, 024116 (2024).
A simple makefile is included, as well as a sample initial configuration. All simulation parameters are defined as global variables near the top of the main code file. See the comments there for details.
We simulate systems of
The simulation is currently set up to handle either monodisperse or bidisperse systems. Other size distributions should be possible with minor modifications.
The simulation code operates in the following units:
- Lengths are measured in units of the maximum particle size
$\sigma$ . - Mass is measured in units of a reference mass
$m$ (currently just the mass of any particle, since they are all equal). - Time is measured in units of
$\tau = \sqrt{\beta m \sigma^2}$ . Here,$\beta = 1/k_B T$ with$k_B$ Boltzmann's constant. - Energy is measured in units of
$k_B T$ . - Pressure is measured in units of
$k_B T / \sigma^3$ .
Note that the simulation assumes that no particles with a diameter greater than
The simulation code measures the pressure
Similarly, the code outputs the potential energy
The configuration files from the simulation are written in a simple text-based format, which can contain multiple snapshots per file. For each frame, the format consists of
- One line containing just the number of particles
- One line containing the box size, specifying the box length
$L_x$ ,$L_y$ , and$L_z$ along the three axes, separated by whitespace. - One line per particle containing: a letter indicating particle type, three numbers indicating the real-space particle coordinates, and one number indicating the particle radius.
The movie files that are created by the simulation code include multiple of these frames consecutively in a single text file. Note that although the code assumes periodic boundary conditions, coordinates of particles that leave the box during the simulation will be printed as being outside of the simulation box, to allow for analysis of long-time dynamics. Hence, any structural analysis or visualization should apply periodic boundary conditions explicitly.
The simulation codes can read in snapshots in this format as initial configurations (depending on the choice of "initialconfig" in the code). Periodic boundaries will be applied to the snapshot at the start of the simulation. Note again that the simulation code assumes that all box lengths, positions, and radii are given in units of
Configuration files created by these codes (.sph format) can be visualized with Colloid Visualization Tool.
Adaptation to different configuration file formats can be done via modification of the loadparticles, write, and outputsnapshot functions.