kernel_extraction
kernel_extraction estimates the memory kernel of a generalized Langevin equation
from time correlation functions. The memory kernel describes how past motion
contributes to friction. The package solves discretized Volterra equations on
a uniform time grid and returns either the memory kernel Γ(t) or its running
integral G(t), depending on the method.
A derivation is in the derivations folder of the repository.
Installation
With a Rust toolchain and maturin installed, run this from the repository root.
maturin build --release
pip install target/wheels/correlation-*.whl
The build embeds src/kernel_steps.ptx and requires no CUDA toolkit.
Extract a kernel from correlations
This example uses the sample correlations in the repository. vv_corr is the
velocity autocorrelation, and xdu_corr correlates position with the potential
gradient. Use one-dimensional NumPy arrays of dtype float64 sampled at the
same lag spacing. Set dt to that spacing and trunc to the requested number
of output samples.
import numpy as np
from kernel_extraction import ExtractionMethod, compute_kernel
# Run from the repository root.
vv_corr = np.load("test/data/vv_corr.npy").astype(np.float64)
xdu_corr = np.load("test/data/xdu_corr.npy").astype(np.float64)
dt = 0.01
mass = 2.494 / vv_corr[0] # kBT / Cvv(0) for these sample data
kernel_int = compute_kernel(
ExtractionMethod.G_METHOD_XDU,
dt=dt,
mass=mass,
vv_corr=vv_corr,
xdu_corr=xdu_corr,
trunc=200,
device="auto",
)
| Method | Required correlations | Returns |
|---|---|---|
G_METHOD_XDU |
vv_corr, xdu_corr |
Running integral |
G_METHOD_XDU_NOMASS |
vv_corr, xdu_corr |
Running integral |
G_METHOD_XDU_HALFSTEP |
vv_corr, xdu_corr |
Running integral on the half-step grid |
G_METHOD_VDU |
vv_corr, vdu_corr |
Running integral |
GAMMA_METHOD |
vv_corr, va_corr, aa_corr, adu_corr |
Memory kernel |
Pass the mass to every method except G_METHOD_XDU_NOMASS. To extract a
position-dependent kernel from conditional correlations, use
compute_kernel_2d with arrays shaped (n_lags, n_bins) and a mass per bin
or thermal energy kbt. If you are starting from trajectories,
kernel_from_traj computes the correlations and returns them with the kernel.
That workflow also requires the correlation and md_utils Python modules.
Choosing a device
The same wheel supports both CPU and CUDA on hosts that match its Python ABI
and platform tag. Pass device to compute_kernel, compute_kernel_2d,
kernel_from_traj, or a low-level extraction function.
device="cpu"uses the CPU and is the default in the Python wrappers.device="cuda"uses CUDA device 0 and raisesRuntimeErrorif CUDA setup fails.device="auto"tries CUDA device 0 and uses the CPU if CUDA setup fails.
CUDA requires a visible NVIDIA GPU, a driver that supports the embedded CUDA 12.6 PTX, and a CUDA 12 cuBLAS shared library on the system library search path. The CPU backend requires no NVIDIA libraries.
Metadata
Release files for kernel-extraction 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kernel_extraction-0.1.0.tar.gz | 3.4 MB | Without provenance | Details for kernel_extraction-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kernel_extraction-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.34+ x86-64 | Details for kernel_extraction-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl |
Total release size: 3.9 MB
Release files / kernel_extraction-0.1.0.tar.gz
| Download URL | kernel_extraction-0.1.0.tar.gz |
|---|---|
| Size | 3.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cacca352ee93f42c1a9e6d4afedaea325f831f4a8cbf9b54d2751887a64fb3f2
|
|
BLAKE2b-256 checksum How to use checksums |
4b1aa10ecfb03299ffe5da796b200b7844ab8397768c07c1e3e49b3bad579fee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / kernel_extraction-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | kernel_extraction-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 522.9 kB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
51dbe169e42a5361a88d2a1dcf11eaa76b57cf4f66c3d15dc2f0d4b3cd599fc3
|
|
BLAKE2b-256 checksum How to use checksums |
22ecd2105ddffd59bd36786102607c4e689e8e57249a4b7c112e5ed4edd3ec08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for kernel-extraction 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.