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
Metadata
Release files for octp-pp 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| octp_pp-0.1.5.tar.gz | 27.1 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| octp_pp-0.1.5-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
| octp_pp-0.1.5-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| octp_pp-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 835.6 kB
Release files / octp_pp-0.1.5.tar.gz
| Download URL | octp_pp-0.1.5.tar.gz |
|---|---|
| Size | 27.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dad02463b5c33dd562713502964c8786a40c55f16d9e7f0401d04d3f27307b8
|
|
BLAKE2b-256 checksum How to use checksums |
89a3875f7f47193396188bf29e245bc4a45243d85cd229b6cb919ff1c8f280e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / octp_pp-0.1.5-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | octp_pp-0.1.5-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 287.5 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6fefe3e25a0db8aa214a8c5cc1523896ea0ebd3885ba0ef66f8988be08e73d62
|
|
BLAKE2b-256 checksum How to use checksums |
d4fe771a7e2dab3e0105d1cea7757417b22efce719b73d8adcb42ae46a31c066
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / octp_pp-0.1.5-cp312-cp312-win_amd64.whl
| Download URL | octp_pp-0.1.5-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 193.1 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4c62af0381c540b183730be867f15b4fcb2bcdf36ee58b6fa0135dd9c37ce695
|
|
BLAKE2b-256 checksum How to use checksums |
d5d43bb072fbdaecfe48a4bfe47de030a79d1db9bd117e6992381950baf62b56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / octp_pp-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | octp_pp-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 327.9 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
12c1b581681d686e307b1c952afdd04d9a56b2cb8376f3f9e69c105cbb0b17d6
|
|
BLAKE2b-256 checksum How to use checksums |
ef8ac88b9fe58a26262a3774418d73fb42a81006c81de417953c03acce52e366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency log