Data format for event-driven particle trajectories

On my site, I host data on particle motion, including the motion of molecules in gases and liquids, as well as the motion of Lagrangian particles in turbulence. Most of these systems, like turbulence, exhibit intrinsically smooth time dynamics and can be simulated using conventional time-stepping algorithms such as direct numerical simulation (DNS). However, I also host data on the dynamics of hard-sphere fluids — statistical systems with intrinsically discrete, collision-based dynamics modeled using event-driven algorithms.

The data for hard-sphere systems is obtained using the DynamO particle simulator. DynamO outputs data in XML format and is designed to provide processed data. I, on the other hand, offer raw trajectory data for users to process themselves. I consider HDF5 to be a more convenient format for this purpose. Below, I describe how I store DynamO output in HDF5, along with the parameters used to run the simulations.

Simulation parameters

At equilibrium, the monodisperse hard-sphere fluid is described by only two dimensionless parameters: the number of particles NN and the reduced number density ρ=σ3N/V\rho^* = \sigma^3 N/V, where σ\sigma is the diameter of a hard sphere and VV is the system volume. We are interested in the thermodynamic limit and run simulations with periodic boundary conditions for a relatively large number of particles NN, so that ρ\rho^* becomes the only relevant thermodynamic parameter.

However, to actually run the simulation, in addition to ρ\rho^*, we need to specify time and length scales: the simulation duration and the size of the domain (which corresponds to NN). Both need to be large enough to capture temporal and spatial decorrelation of particle velocities. Because I am primarily interested in the gas-like rather than the liquid-like state of the hard-sphere fluid, all computations below apply to a sufficiently dilute gas.

First, we estimate the simulation duration trunt_\text{run} sufficient to capture decorrelation of the particle velocity u\bm u. We run each simulation for 5τu5 \tau_u, where τu\tau_u is the velocity autocorrelation time:

τu=1uiui0ui(t)ui(0)dt.\tau_u = \frac{1}{\langle u_i u_i \rangle } \int_0^\infty \langle u_i(t) u_i(0) \rangle \, \mathrm{d} t.

Via a Green–Kubo relation, τu\tau_u is directly related to the self-diffusion coefficient DD; in reduced units, τu=D\tau_u^* = D^*:

D=kBTmτu,τu=D.D = \frac{k_\text{B} T}{m} \tau_u, \qquad \tau_u^* = D^*.

For a dilute hard-sphere gas:

D=38nσ2kBTπm,D=38πρ.D = \frac{3}{8 n \sigma^2} \sqrt{\frac{k_\text{B} T}{\pi m}}, \qquad D^* = \frac{3}{8 \sqrt \pi \rho^*}.

Hence, we choose the simulation time in reduced units to be

trun=5×38πρ.t_\text{run}^* = 5 \times \frac{3}{8\sqrt \pi \rho^*}.

To determine the system size, we set half the length of the simulation box, 12V3\frac{1}{2}\sqrt[3] V​, equal to trunct_\text{run} c, where cc is the speed of sound:

c=53kBTm,c=53.c = \sqrt{\frac{5}{3} \frac{k_\text{B} T}{m}}, \qquad c^* = \sqrt{\frac{5}{3}}.

With this, we can estimate the number of particles required:

N=(2trunc)3ρ=53×151564ππ1ρ2.N = (2 t_\text{run}^* c^*)^3 \rho^* = 5^3 \times \frac{15 \sqrt{15}}{64 \pi \sqrt \pi} \frac{1}{ {\rho^*}^2 }.

The goal is to be able to accurately simulate systems with ρ\rho^* as low as 0.010.01. This corresponds to N=20377088N = 20 \, 377 \, 088. We use a fixed value of

N=20710868=4×1733N = 20 \, 710 \, 868 = 4 \times 173^3

for all systems with ρ0.01\rho^* \geqslant 0.01. This value is close to our estimate and is consistent with how DynamO assigns NN in simulations.

DynamO simulation setup

The DynamO simulation proceeds in three main steps:

I describe the three steps using a system at ρ=0.1\rho^* = 0.1.

Initial configuration file

First, I create an initial configuration file named 0.1_173_config.start.xml, where 0.1 reflects the reduced density value, and 173 corresponds to the way DynamO specifies the number of particles.

Initially, the particles are packed into a grid of face-centered cubic (FCC) unit cells (4 particles per cell), with the unit cells arranged in a cubic grid of side length 173. This results in a total of N=4×1733N = 4 \times 173^3 particles.

The initial configuration file is created with the command:

dynamod --pack-mode 0 \
        --NCells 173 \
        --density 0.1 \
        --i1 0 \
        --out-config-file 0.1_173_config.start.xml

Equilibrating the system

Once the initial configuration file was created, we equilibrated the system. For the chosen density, ρ=0.1\rho^* = 0.1, we have trun=10.6t_\text{run}^* = 10.6. Thus, the DynamO command used for equilibration is:

dynarun --config-file 0.1_173_config.start.xml \
        --sim-end-time 10.6 \
        --out-data-file 0.1_173_output.xml.bz2 \
        --out-config-file 0.1_173_config.equilibrated.xml

Running the simulation

Now we use the equilibrated state to launch the main simulation, still for trun=10.6t_\text{run}^* = 10.6. We also want to collect all kinds of data

dynarun --config-file 0.1_173_config.equilibrated.xml \
        --sim-end-time 10.6 \
        --load-plugin Trajectory \
        --unwrapped \
        --out-data-file 0.1_173_output.xml.bz2 \
        --out-config-file 0.1_173_config.end.xml
dynarun --config-file 0.1_32_config.equilibrated.xml \
        --sim-end-time 10.6 \
        --load-plugin Trajectory \
        --unwrapped \
        --out-data-file 0.1_32_output.xml.bz2 \
        --out-config-file 0.1_32_config.end.xml