A package to analyze
tmmc-lnpy provides a wide array of routines to analyze
- Reweighting to arbitrary chemical potential
- Segmenting
$\ln \Pi(N)$ (to identify unique phases) - Containers for interacting with several values of
$\ln \Pi(N)$ in a vectorized way. - Calculating thermodynamic properties from these containers
- Calculating limits of stability, and phase equilibrium
This package is actively used by the author. Please feel free to create a pull request for wanted features and suggestions!
Note that the distribution name tmmc-lnpy is different than the import name
lnpy due to name clashing on pypi.
>>> import numpy as np
>>> import lnpy
>>> import lnpy.examples
>>> ref = lnpy.examples.load_example_lnpimasked("lj_sub")
>>> phase_creator = lnpy.PhaseCreator(nmax=1, ref=ref)
>>> build_phases = phase_creator.build_phases_mu([None])
>>> collection = lnpy.lnPiCollection.from_builder(
... lnzs=np.linspace(-10, 3, 5), build_phases=build_phases
... )
# Collections are like pandas.Series
>>> collection
<class lnPiCollection>
lnz_0 phase
-10.00 0 [-10.0]
-6.75 0 [-6.75]
-3.50 0 [-3.5]
-0.25 0 [-0.25]
3.00 0 [3.0]
dtype: object
# Access xarray backend for Grand Canonical properties with `xge` accessor
>>> collection.xge.betaOmega()
<xarray.DataArray 'betaOmega' (lnz_0: 5, phase: 1)> Size: 40B
array([[-2.3245e-02],
[-6.0370e-01],
[-1.8552e+02],
[-1.5447e+03],
[-2.9580e+03]])
Coordinates:
* lnz_0 (lnz_0) float64 40B -10.0 -6.75 -3.5 -0.25 3.0
* phase (phase) int64 8B 0
beta float64 8B 1.372
volume float64 8B 512.0
Attributes:
dims_n: ['n_0']
dims_lnz: ['lnz_0']
dims_comp: ['component']
dims_state: ['lnz_0', 'beta', 'volume']
dims_rec: ['sample']
standard_name: grand_potential
long_name: $\beta \Omega(\mu,V,T)$
Use one of the following
pip install tmmc-lnpyor
conda install -c conda-forge tmmc-lnpySee the documentation for a look at tmmc-lnpy in action.
See changelog.
This is free software. See LICENSE.
This package is used for with thermoextrap to analyze thermodynamically extrapolated macro state probability distributions.
The author can be reached at wpk@nist.gov.
This package was created using Cookiecutter with the usnistgov/cookiecutter-nist-python template.