Skip to main content

Thermodynamic extrapolation

Project description

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

thermoextrap: Thermodynamic Extrapolation/Interpolation Library

This repository contains code used and described in references [^fn1] [^fn2].

[^fn1]: Extrapolation and Interpolation Strategies for Efficiently Estimating Structural Observables as a Function of Temperature and Density

[^fn2]: Leveraging Uncertainty Estimates and Derivative Information in Gaussian Process Regression for Expedited Data Collection in Molecular Simulations. In preparation.

Overview

If you find this code useful in producing published works, please provide an appropriate citation. Note that the second citation is focused on adding features that make use of GPR models based on derivative information produced by the core code base. For now, the GPR code, along with more information, may be found under here. In a future release, we expect this to be fully integrated into the code base rather than a standalone module.

Code included here can be used to perform thermodynamic extrapolation and interpolation of observables calculated from molecular simulations. This allows for more efficient use of simulation data for calculating how observables change with simulation conditions, including temperature, density, pressure, chemical potential, or force field parameters. Users are highly encourage to work through the Jupyter Notebooks presenting examples for a variety of different observable functional forms. We only guarantee that this code is functional for the test cases we present here or for which it has previously been applied Additionally, the code may be in continuous development at any time. Use at your own risk and always check to make sure the produced results make sense. If bugs are found, please report them. If specific features would be helpful just let us know and we will be happy to work with you to come up with a solution.

Features

  • Fast calculation of derivatives

Status

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

Quick start

Use one of the following to install thermoextrap:

conda install -c conda-forge thermoextrap

or

pip install thermoextrap

Additional dependencies

To utilize the full potential of thermoextrap, additional dependencies are needed. This can be done via pip by using:

pip install thermoextrap[all]

If using conda, then you'll have to manually install some dependencies. For example, you can run:

conda install bottleneck dask "pymbar>=4.0"

At this time, it is recommended to install the Gaussian Process Regression (GPR) dependencies via pip, as the conda-forge recipes are slightly out of date:

pip install tensorflow tensorflow-probability "gpflow>=2.6.0"

Building cmomy library

thermoextrap makes extensive use of the cmomy library. If using thermoextrapin parallel, you should either first compile cached numba code with

python -m cmomy.compile

Or run your command with the environment variable CMOMY_NUMBA_CACHE set to false

CMOMY_NUMBA_CACHE=false python ....

Installing from source

The repo is setup to use uv to create a development environment. Use the following:

uv sync

This environment will include all additional dependencies mentioned above.

Alternatively, you can install the (locked) development dependencies using:

pip install requirements/lock/dev.txt

It is not recommended to install the development dependencies with conda.

Example usage

import thermoextrap

Documentation

See the documentation for a look at thermoextrap in action.

To have a look at using thermoextrap with Gaussian process regression, look in the gpr and gpr_active_learning directories.

License

This is free software. See LICENSE.

Related work

This package extensively uses the cmomy package to handle central comoments.

Contact

Questions may be addressed to Bill Krekelberg at william.krekelberg@nist.gov or Jacob Monroe at jacob.monroe@uark.edu.

Credits

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

Changelog

Changelog for thermoextrap

Unreleased

See the fragment files in changelog.d

v0.6.0 — 2025-02-18

Changed

  • Project now setup to use uv with lock file.
  • Updated code to use latest version of cmomy
  • Initial work for adding typing to code.

v0.5.0 — 2024-03-15

Removed

  • Scaling of GPR inputs (x_scale_fac argument in HeteroscedasticGPR)
  • Left x_scale_fac as object attribute with value 1.0 for back-compatibility

Added

  • Support for multidimensional inputs for GPRs
  • Testing around basic multiD input GPRs
  • Updated make_rbf_expr in active_utils (old 1D in make_rbf_expr_old)
  • Updated DerivativeKernel, HetGaussianDeriv, HeteroscedasticGPR in gpr_models

Changed

  • Updates to match with newer versions of GPflow

  • HetGaussianDeriv likelihood now accepts X (input data) argument for all methods

  • HetGaussianDeriv init now takes obs_dims argument instead of d_order

  • build_scaled_cov_mat method now takes X, which includes derivative orders

  • all mean functions inherit from gpflow.functions.MeanFunction (same behavior)

  • Changed structure of the repo to better support some third party tools.

  • Moved nox environments from .nox to .nox/{project-name}/envs. This fixes issues with ipykernel giving odd names for locally installed environments.

  • Moved repo specific dot files to the config directory (e.g., .noxconfig.toml to config/userconfig.toml). This cleans up the top level of the repo.

  • added some support for using nbqa to run mypy/pyright on notebooks.

  • Added ability to bootstrap development environment using pipx. This should simplify initial setup. See Contributing for more info.

v0.4.0 — 2023-06-15

Added

  • Package now available on conda-forge

  • Now support python3.11

  • Bumped pymbar version to pymbar>=4.0

Changed

  • Switched from tox to nox for testing.

Deprecated

  • No longer support pymbar < 4.0

v0.3.0 — 2023-05-03

Changed

  • New linters via pre-commit

  • Development env now handled by tox

  • Moved models, data, idealgas from thermoextrap.core to thermoextrap. These were imported at top level anyway. This fixes issues with doing things like from thermoextrap.data import ..., etc.

  • Moved core._docstrings_ to docstrings.

  • Now using cmomy.docstrings instead of repeating them here.

Full set of changes: v0.2.2...v0.3.0

v0.2.2 - 2023-04-05

Full set of changes: v0.2.1...v0.2.2

v0.2.1 - 2023-03-30

Full set of changes: v0.2.0...v0.2.1

v0.2.0 - 2023-03-28

Full set of changes: v0.1.9...v0.2.0

v0.1.9 - 2023-02-15

Full set of changes: v0.1.8...v0.1.9

v0.1.8 - 2023-02-15

Full set of changes: v0.1.7...v0.1.8

v0.1.7 - 2023-02-14

This software was developed by employees of the National Institute of Standards and Technology (NIST), an agency of the Federal Government. Pursuant to title 17 United States Code Section 105, works of NIST employees are not subject to copyright protection in the United States and are considered to be in the public domain. Permission to freely use, copy, modify, and distribute this software and its documentation without fee is hereby granted, provided that this notice and disclaimer of warranty appears in all copies.

THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY, CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.

Distributions of NIST software should also include copyright and licensing statements of any third-party software that are legally bundled with the code in compliance with the conditions of those licenses.

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

thermoextrap-0.6.1.tar.gz (818.9 kB view details)

Uploaded Source

Built Distribution

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

thermoextrap-0.6.1-py3-none-any.whl (147.4 kB view details)

Uploaded Python 3

File details

Details for the file thermoextrap-0.6.1.tar.gz.

File metadata

  • Download URL: thermoextrap-0.6.1.tar.gz
  • Upload date:
  • Size: 818.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.0

File hashes

Hashes for thermoextrap-0.6.1.tar.gz
Algorithm Hash digest
SHA256 7bbc96993bd38d4626db0c000a69a12d02cfe770920de9b6abf1f41149475fcd
MD5 dd8b9630dc1c17e169d17251f85e8dd8
BLAKE2b-256 04789b35c6a17c09b1b447062bb0e16598e85908f052b701c811131f8d311678

See more details on using hashes here.

File details

Details for the file thermoextrap-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for thermoextrap-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0183b5bd336d239b07f76a64231440a737b09dba17afc38da5291c9b2c30efa0
MD5 85fcf2f08340e4f8128332c3b778e606
BLAKE2b-256 3862387cb446a0d231c324686255d5a8e44d3db54ca67121afc322d78e4c748d

See more details on using hashes here.

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