Skip to main content

Analysis of lnPi results from TMMC simulation

Project description

Repo Docs PyPI license PyPI version Conda (channel only) Code style: ruff uv

tmmc-lnpy

Overview

A package to analyze $\ln \Pi(N)$ data from Transition Matrix Monte Carlo simulation. The main output from TMMC simulations, $\ln \Pi(N)$, provides a means to calculate a host of thermodynamic properties. Moreover, if $\ln \Pi(N)$ is calculated at a specific chemical potential, it can be reweighted to provide thermodynamic information at a different chemical potential

Features

tmmc-lnpy provides a wide array of routines to analyze $\ln \Pi(N)$. These include:

  • 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

Status

This package is actively used by the author. Please feel free to create a pull request for wanted features and suggestions!

Example usage

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)$

Installation

Use one of the following

pip install tmmc-lnpy

or

conda install -c conda-forge tmmc-lnpy

Documentation

See the documentation for a look at tmmc-lnpy in action.

What's new?

See changelog.

License

This is free software. See LICENSE.

Related work

This package is used for with thermoextrap to analyze thermodynamically extrapolated macro state probability distributions.

Contact

The author can be reached at wpk@nist.gov.

Credits

This package was created using Cookiecutter with the usnistgov/cookiecutter-nist-python template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tmmc_lnpy-0.8.1.tar.gz (121.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tmmc_lnpy-0.8.1-py3-none-any.whl (111.7 kB view details)

Uploaded Python 3

File details

Details for the file tmmc_lnpy-0.8.1.tar.gz.

File metadata

  • Download URL: tmmc_lnpy-0.8.1.tar.gz
  • Upload date:
  • Size: 121.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tmmc_lnpy-0.8.1.tar.gz
Algorithm Hash digest
SHA256 e3bb62713b4aa05a5b7a117fb9b0892be2cb4f0624c2d0ae9899e4077962bf41
MD5 fe68dd2a6222d655fde0fb4f80454528
BLAKE2b-256 88553917cabd8e7cc8c9a27f3bf9bc032e310c7d737eb8e1024ec14b49e853b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tmmc_lnpy-0.8.1.tar.gz:

Publisher: cd.yml on usnistgov/tmmc-lnpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tmmc_lnpy-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: tmmc_lnpy-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 111.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tmmc_lnpy-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02fb5c36b73da7eb33b39e485d338805b0d5eeb3ac5b0983b1d15736d515e18d
MD5 76f18a98488462b574b35f49eaa06e7b
BLAKE2b-256 955880ff8cfb837d54ec92e352198a2d8a9b13f3e8f94134fbb389622db2f1ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for tmmc_lnpy-0.8.1-py3-none-any.whl:

Publisher: cd.yml on usnistgov/tmmc-lnpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page