Package for handling the statistical mechanics of fermions and bosons
Project description
wnstatmech is a python package for handling the statistical mechanics of fermions and bosons.
Installation
Install from PyPI with pip by typing in your favorite terminal:
$ pip install wnstatmech
Performance controls
Fermion and Boson objects accept optional integration_epsabs and integration_epsrel arguments to control numerical integration accuracy. Their scalar exact-result caches retain 1,024 entries by default; pass cache_size=0 to disable them or call clear_cache() to clear a particle’s cached values and chemical-potential warm start.
For an application-specific direct inversion, install a chemical-potential function that accepts scalar temperature and number-density values and returns alpha or None to use the numerical fallback:
electron.update_chemical_potential_function(my_direct_alpha)
For better throughput over many thermodynamic states, pass vectorized temperature and alpha arrays to compute_quantity rather than calling it repeatedly in a Python loop:
import wnstatmech as ws
import numpy as np
electron = ws.fermion.create_electron(integration_epsrel=1.0e-6)
temperatures = np.geomspace(1.0e7, 1.0e10, 24)
alphas = np.linspace(-8.0, 8.0, 24)
pressures = electron.compute_quantity("pressure", temperatures, alphas)
Scalar call signatures remain backwards compatible with 1.0.x usage.
Performance benchmarks
Optional benchmarks measure representative scalar, batched, and fixed-density derivative workloads. They are separate from the correctness tests and are not run by the normal build. Install the benchmark extra and run them with:
$ pip install -e '.[benchmark]' $ pytest benchmarks --benchmark-only
Benchmark results are most useful when compared before and after a change on the same machine. The benchmark cases intentionally create a fresh particle for scalar calls so that they measure a cold numerical solve rather than a cache hit.
Contribute
Issue Tracker: https://github.com/mbradle/wnstatmech/issues/
Source Code: https://github.com/mbradle/wnstatmech/
License
The project is licensed under the GNU Public License v3 (or later).
Documentation
The project documentation is available at https://wnstatmech.readthedocs.io.
Usage
The best way to get started using wnstatmech is to follow the tutorial.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wnstatmech-1.2.0.tar.gz.
File metadata
- Download URL: wnstatmech-1.2.0.tar.gz
- Upload date:
- Size: 28.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fba9d277556a00759e2ed7aae6b16918c17cc71746b272cc6533586a9b4431e
|
|
| MD5 |
0f125e1d1cf67057181a2f3d10a005f5
|
|
| BLAKE2b-256 |
c9784f444c2d07a9e1c90488434cdc1e211146ddf569ac3593240b614014732b
|
File details
Details for the file wnstatmech-1.2.0-py3-none-any.whl.
File metadata
- Download URL: wnstatmech-1.2.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0787535bec0f64d8387e53af773b6db34d510755a19aed30e81213d445aa7776
|
|
| MD5 |
4310a08f7e58e17f711d732f19221e75
|
|
| BLAKE2b-256 |
ae6eb4792efdc9023313603a76750457cda782013c4bfee0b42eecb598983851
|