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.
Part of the distribution vipyr-liquids; it runs from a checkout of the
repository. Planned on PyPI as pip install vipyr-liquids.
Signature
vp.liquids.eos(*, temperature=1.0, density=0.75) Parameters
- temperature : float, default
1.0 - The temperature, in units of epsilon / k_B. Range: > 0.
- density : float, default
0.75 - The number density, in sigma^-3. Range: > 0.
Returns
A frozen EOSResult. Iterating it gives the fields below in order; it also has
params, tests, log and check().
- p_full : float
- The pressure.
- e_full : float
- The energy per atom, with the ideal gas's 3T/2.
- cv_full : float
- The heat capacity per atom at constant volume, in units of k_B.
- cp_full : float
- The heat capacity per atom at constant pressure.
- mu_full : float
- The chemical potential.
- z_full : float
- The activity, exp(mu / T) in units of the thermal wavelength cubed.
- p_cut : float
- The pressure.
- e_cut : float
- The energy per atom.
- mu_cut : float
- The chemical potential.
- z_cut : float
- The activity.
- p_cs : float
- The pressure.
- e_cs : float
- The energy per atom.
- cv_cs : float
- The heat capacity per atom at constant volume.
- cp_cs : float
- The heat capacity per atom at constant pressure.
- mu_cs : float
- The chemical potential.
- z_cs : float
- The activity.
- a_res_full_table : ndarray[float64]
- The table tau^i delta^j d^(i+j) a_res / d tau^i d delta^j, rows i and columns j from 0 to 2 (entries with i + j > 2 are not used) (rank 2).
- a_res_cs_table : ndarray[float64]
- The cut-and-shifted fit's table, as a_res_full (rank 2).
Raises
- vipyr.ParameterError
- A ValueError: an argument outside its range, choices, rank or shape, or one of a group given without the rest; its .param names the argument.
- TypeError
- An argument of the wrong type, or an unknown keyword.
- vipyr.VivBuildError
- An ImportError: no C compiler, or the program's C does not build.
- RuntimeError
- The program stops with its own message (a combination it rejects, or no convergence where the program treats that as an error).
Examples
import vipyr as vp
r = vp.liquids.eos(temperature=1.0, density=0.75)
print(r.p_full, r.e_full, r.cv_full) # Thol et al. 2016: 0.3996, -3.7212, 2.2630
print(r.p_cs, r.e_cs) # cut and shifted at 2.5: 0.9897, -2.9287
assert r.check() 0.3995824497857153 -3.721249230098813 2.2630169185686153
0.9896959151485801 -2.9286513983540416Each example ran as written when these pages were generated, and the output shown is what it printed.
Checked against
- Tests
- ports/liquids/test_liquids.py: every tolerance is stated beside its check
- Upstream
- eos_lj of https://github.com/Allen-Tildesley/examples at 4818bc82, built with gfortran -O2 by ports/liquids/oracle/build.py; same bits from the same start and random numbers
Credits
- A port of the examples of Allen and Tildesley's Computer Simulation of Liquids, which are CC0-1.0.
Source
- Manifest: ports/liquids/eos_lj.export.toml
- Viv: ports/liquids/eos_lj.viv
- The defs it reaches and the calls between them: map of the code