Simulation of liquids (vp.liquids)
The Lennard-Jones programs of Allen and Tildesley's Computer Simulation of Liquids (2nd ed., 2017), ported to Viv.
- molecular dynamics at constant energy (velocity Verlet) and constant temperature (Nosé-Hoover chain)
- Metropolis Monte Carlo at constant volume and constant pressure
- all-pairs, link-cell or Verlet neighbor lists
- block averages with error bars, g(r), the velocity autocorrelation and the mean-square displacement
- the equation of state of Thol et al.
Every program reproduces the book's Fortran bit for bit from the same start and random numbers. If you use it, cite the book.
Part of the distribution vipyr-liquids; it runs from a checkout of the
repository. Planned on PyPI as pip install vipyr-liquids.
Functions
-
vp.liquids.diffusion - Time correlation functions of a trajectory and the diffusion coefficient they give: the velocity autocorrelation function <v(0) . v(t)>, the mean-square displacement <|r(t) - r(0)|^2> and the cross-correlation <v(0) . (r(t) - r(0))>, each averaged over atoms and over time origins spaced along the trajectory. Positions are unfolded across the periodic boundaries frame by frame.
-
vp.liquids.eos - The Lennard-Jones equation of state at one state point, from the fits of Thol et al.: pressure, energy, heat capacities, chemical potential and activity for the full potential, the same moved to the potential cut (not shifted) at 2.5 sigma by the long-range and delta corrections, and for the potential cut and shifted at 2.5 sigma, with the residual free energy and its derivatives behind each. These are the numbers Allen and Tildesley's simulations are tested against.
-
vp.liquids.error_calc - How correlation between successive values changes the error of a time average, shown on a series whose correlation time is known exactly. The series is a generalized Langevin process (an Ornstein-Uhlenbeck process in a memory variable), integrated with a random force; its statistical inefficiency is exactly s = 2 / (m delta) steps.
-
vp.liquids.mc_npt - Metropolis Monte Carlo of Lennard-Jones atoms at constant N, P and T, the potential cut (not shifted) at r_cut. Each step is a sweep of trial displacements, one per atom, then one trial change of the box: its side is scaled by exp(zeta db_max), zeta uniform in (-1, 1), every position with it, and the change is accepted with probability min(1, exp(-(dU + P dV) / T + (N + 1) ln(V_new / V))). A run returns the block and run averages of the density, energy and pressure (for the cut potential, and corrected for the full potential), the configurational temperature, the heat capacity at constant pressure from the enthalpy's fluctuations, the volume's fluctuation, the acceptance ratios, the final configuration and box.
-
vp.liquids.mc_nvt - Metropolis Monte Carlo of Lennard-Jones atoms at constant N, V and T, the potential cut (not shifted) at r_cut. Each step is a sweep: every atom in turn is moved by a random displacement in a cube and the move is accepted with probability min(1, exp(-dU / T)). A run returns the block and run averages of the energy and pressure (for the cut potential, and corrected for the full potential), the configurational temperature, the heat capacity from the energy's fluctuations, the acceptance ratio, the final configuration and, when it samples, g(r).
-
vp.liquids.md_nve - Molecular dynamics of Lennard-Jones atoms at constant N, V and E: velocity Verlet in a periodic cubic box, the potential cut and shifted at r_cut. A run returns the block and run averages of the energy, pressure and temperatures (cut-and-shifted, and with long-range corrections as an estimate for the full potential), the heat capacity from the kinetic energy's fluctuations, the fluctuation of the conserved energy, the final configuration, and, when it samples the trajectory, g(r), the velocity autocorrelation function, the mean-square displacement and the diffusion coefficient from each.
-
vp.liquids.md_nvt - Molecular dynamics of Lennard-Jones atoms at constant N, V and T, the temperature held by a Nose-Hoover chain of three thermostats, integrated by the time-reversible splitting of Martyna, Tuckerman, Tobias and Klein (1996): velocity Verlet for the atoms, wrapped in quarter and half steps of the chain. The potential is cut and shifted at r_cut. A run returns the block and run averages of the energy, pressure and temperatures, the heat capacity from the energy's fluctuations, the conserved quantity of the extended system and its fluctuation, the final configuration, and, when it samples the trajectory, g(r), the correlation functions and the diffusion coefficient.
-
vp.liquids.pair_distribution - The pair distribution function g(r) of a set of configurations of N atoms in a periodic cubic box: a histogram of every pair's separation (nearest image) out to half the box, divided by what an ideal gas of the same density would give in each spherical shell.