Post-processing toolkit for OCTP LAMMPS molecular-dynamics output
Project description
octp-pp
Post-processing toolkit for OCTP (Order-n Transport Properties) output files from LAMMPS molecular dynamics simulations.
The computationally intensive work — file parsing, MSD fitting, and all physical-property models — is compiled to native code via a PyO3/maturin Rust extension. Interactive visualisations use Plotly.
Features
- Rust core — parsing, diffusivity fitting, Laliberte density/viscosity, Dewane and Gilliam conductivity models, and concentration conversions all run natively; the Brent–Dekker molarity→molality inversion is ~570× faster than an equivalent
scipy.fsolveloop - Automatic run averaging — pass a list of parallel-run folders; means and standard deviations are computed automatically
- Biased Random Walk (BRW) correction — built-in correction for proton-hopping contributions (OH⁻ / H₃O⁺) matched against experimental conductivity
- Configurable constants — ion charges, molecular weights, hop distance, etc. live in a JSONL file and can be overridden at runtime without touching code
Installation
pip install octp-pp
From source
git clone https://github.com/JelleLagerweij/octp-pp
cd octp-pp
pip install maturin
maturin develop # debug build (fast compile, slower runtime)
maturin develop --release # release build (slow compile, fast runtime)
maturin build(andpip install .) always use the release profile.maturin developdefaults to debug — ideal during active development.
Quick start
import octp_pp as octp
import octp_pp.helpers as hf
# Five parallel NVT runs stored under data/run_1 … data/run_5
mixture = octp.PP_OCTP(
"data",
[f"run_{i}" for i in range(1, 6)],
groups=["wat", "Na", "OH", "SCN"],
dt=2, # timestep in fs
plotting=True, # interactive Plotly figures
)
# Configure non-default file names (if needed)
mixture.filenames(Diff_Onsag="diffonsag.dat", Diff_self="diffself.dat")
mixture.changefit(Minc=7, Mmax=45, er_max=0.05)
# State properties
mixture.density()
mixture.molality("OH", "wat", hf.MOLECULAR_WEIGHTS["WAT"])
mixture.molality("SCN", "wat", hf.MOLECULAR_WEIGHTS["WAT"])
# Transport properties
mixture.viscosity()
mixture.self_diffusivity(YH_correction=True)
mixture.onsager_coeff()
# Conductivity
octp.cond_NE(mixture, ion_names=["Na", "OH", "SCN"], ion_charges=[1, -1, -1])
octp.cond_Ons(mixture, ion_names=["Na", "OH", "SCN"], ion_charges=[1, -1, -1])
# BRW correction (requires experimental Excel file)
octp.biassed_random_walk(mixture, "Experiments_total.xlsx")
mixture.store() # writes postprocessed.csv next to the data folder
Physical-property helpers (octp_pp.helpers)
All functions are vectorised and delegate to the Rust core.
| Function | Model | Output |
|---|---|---|
statepoint_Laliberte(T, m, salt, fits) |
Laliberte (2004) | density (kg/m³), molarity (mol/L) |
viscosity_Laliberte(T, m, salt, fits) |
Laliberte (2007) | dynamic viscosity (Pa·s) |
dewane_conductivity(T, m, salt, ...) |
Dewane and Hammer | conductivity (S/m) |
KOH_conductivity_Gilliam_combined(T, m, salt, fits) |
Gilliam | conductivity (S/m) |
molarity_to_molality(c, T, salt, fits) |
Brent–Dekker root finder | molality (mol/kg) |
molality_to_mass_fraction(m, salt) |
exact | mass fraction |
mass_fraction_to_molality(w, salt) |
exact | molality (mol/kg) |
molality_to_mol_fraction(m, solvent) |
exact | mole fraction |
mol_fraction_to_molality(x, solvent) |
exact | molality (mol/kg) |
tau_calculator(sig_exp, sig_MD, T, L, N, δ) |
Lagerweij | lifetime τ (s) |
diffusion_adjustment(tau) |
Lagerweij | D_hop (m²/s) |
Fit parameters are stored in a user-provided JSON file (see test/fits_laliberte.json for the expected structure).
Global constants
Loaded from octp_pp/constants.jsonl at import time. Override at runtime without editing any file:
# Add a custom salt for this session
hf.load_constants(updates={"MOLECULAR_WEIGHTS": {"MYMAT": 123.45}})
# Inspect what is loaded
print(hf.MOLECULAR_WEIGHTS)
print(hf.DELTA_HOP)
API reference
PP_OCTP class
| Method | Description |
|---|---|
filenames(**kwargs) |
Set LAMMPS output file names |
changefit(margin, Minc, Mmax, er_max) |
Tune MSD log-log fitting |
check_succesfull(T_min) |
Drop runs shorter than T_min ns |
mandatory_properties() |
Volume, box size, temperature, particle counts |
pressure(plotting, mov_ave) |
Pressure (Pa) |
density() |
Density (kg/m³) from NPT run |
molarity(group) |
Molarity (mol/L) |
molality(group, solvent, MW_solvent) |
Molality (mol/kg) |
viscosity(plotting) |
Shear + bulk viscosity (Pa·s) |
thermal_conductivity(plotting) |
Thermal conductivity (W/m/K) |
self_diffusivity(YH_correction, ...) |
Self-diffusion coefficients (m²/s) |
onsager_coeff(box_size_check, ...) |
Onsager cross-coefficients (m²/s) |
coord_number(solvent, ...) |
Coordination number from RDF |
bond_angles(start, stop, ...) |
Bond-angle distribution |
store(location, name, for_excel) |
Save results DataFrame to CSV / Excel |
All optional methods call mandatory_properties() automatically if it has not yet been run.
Module-level functions
| Function | Description |
|---|---|
cond_NE(mixture, ion_names, ion_charges) |
Nernst–Einstein conductivity (S/m) |
cond_Ons(mixture, ion_names, ion_charges) |
Onsager conductivity (S/m) |
biassed_random_walk(mixture, exp_file) |
BRW correction; writes back to mixture.results |
read(datafile, export) |
Read OCTP MSD file → DataFrame |
local_maximum_finder(data, start, n) |
First local maximum in g(r) |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 octp_pp-0.1.4.tar.gz.
File metadata
- Download URL: octp_pp-0.1.4.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58d65ddacfde3d75740e4d59271d0458b12da7afe2edc70dd8b436e1a4571de6
|
|
| MD5 |
b986bf24d0417a84c6d6f7767c804048
|
|
| BLAKE2b-256 |
527c9419c6ff8ea17f8cb187ecbb6d65bae1754c50a83857091d56a954838cfc
|
Provenance
The following attestation bundles were made for octp_pp-0.1.4.tar.gz:
Publisher:
release.yml on JelleLagerweij/octp-pp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
octp_pp-0.1.4.tar.gz -
Subject digest:
58d65ddacfde3d75740e4d59271d0458b12da7afe2edc70dd8b436e1a4571de6 - Sigstore transparency entry: 1789167588
- Sigstore integration time:
-
Permalink:
JelleLagerweij/octp-pp@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/JelleLagerweij
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Trigger Event:
push
-
Statement type:
File details
Details for the file octp_pp-0.1.4-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: octp_pp-0.1.4-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 290.0 kB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f8d23a2076ed2fc592868ddf32c861c2003337c7707c100ddb9ff5aaaf3b943
|
|
| MD5 |
5377ceb38476b1ca6f45d28b0f43d146
|
|
| BLAKE2b-256 |
d8f34471da1c0cb92dc9f3de0d5fd5d3986e9ed62ccbb214b498483fe9298d15
|
Provenance
The following attestation bundles were made for octp_pp-0.1.4-cp314-cp314-macosx_11_0_arm64.whl:
Publisher:
release.yml on JelleLagerweij/octp-pp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
octp_pp-0.1.4-cp314-cp314-macosx_11_0_arm64.whl -
Subject digest:
4f8d23a2076ed2fc592868ddf32c861c2003337c7707c100ddb9ff5aaaf3b943 - Sigstore transparency entry: 1789167681
- Sigstore integration time:
-
Permalink:
JelleLagerweij/octp-pp@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/JelleLagerweij
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Trigger Event:
push
-
Statement type:
File details
Details for the file octp_pp-0.1.4-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: octp_pp-0.1.4-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 191.4 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57ca55850b607564cd203789ca0cd67169bcf03e5bb0a2b09f624347dd57dea0
|
|
| MD5 |
f4ddc97621f6dddf47fca0eff18372c0
|
|
| BLAKE2b-256 |
5975b8ebbd0ec232170699df1fd4c59f9c0d50b5f887415693881ca74345f277
|
Provenance
The following attestation bundles were made for octp_pp-0.1.4-cp312-cp312-win_amd64.whl:
Publisher:
release.yml on JelleLagerweij/octp-pp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
octp_pp-0.1.4-cp312-cp312-win_amd64.whl -
Subject digest:
57ca55850b607564cd203789ca0cd67169bcf03e5bb0a2b09f624347dd57dea0 - Sigstore transparency entry: 1789167824
- Sigstore integration time:
-
Permalink:
JelleLagerweij/octp-pp@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/JelleLagerweij
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Trigger Event:
push
-
Statement type:
File details
Details for the file octp_pp-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: octp_pp-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 325.6 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13284355b3ed4bfe694252753b83f156d1f7e5f2bfb4d37e105c2dac6177174e
|
|
| MD5 |
2290311919e6e17f1d53504f4e984db8
|
|
| BLAKE2b-256 |
7b57d342e327cc232eeb81d238aedf12c25827ca48abb31b34d89855604a8e80
|
Provenance
The following attestation bundles were made for octp_pp-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on JelleLagerweij/octp-pp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
octp_pp-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
13284355b3ed4bfe694252753b83f156d1f7e5f2bfb4d37e105c2dac6177174e - Sigstore transparency entry: 1789167918
- Sigstore integration time:
-
Permalink:
JelleLagerweij/octp-pp@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/JelleLagerweij
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a88b99c2fc2b4cd3dc24b1905f0bf935c70656f -
Trigger Event:
push
-
Statement type: