kac-zwanzig 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 William C. Pfalzgraff
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,359 @@
1
+ Metadata-Version: 2.4
2
+ Name: kac-zwanzig
3
+ Version: 0.4.0
4
+ Summary: An exactly solvable Kac-Zwanzig bath: spectral densities, memory kernels, correlation functions and sampled trajectories for testing memory-kernel extraction
5
+ Author: William C. Pfalzgraff
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/william-pfalzgraff/kac-zwanzig
8
+ Project-URL: Repository, https://github.com/william-pfalzgraff/kac-zwanzig
9
+ Project-URL: Issues, https://github.com/william-pfalzgraff/kac-zwanzig/issues
10
+ Project-URL: Changelog, https://github.com/william-pfalzgraff/kac-zwanzig/blob/main/CHANGELOG.md
11
+ Keywords: generalized Langevin equation,memory kernel,Kac-Zwanzig,harmonic bath,velocity autocorrelation,Volterra integral equation,statistical mechanics
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: numpy>=1.24
26
+ Provides-Extra: examples
27
+ Requires-Dist: matplotlib>=3.7; extra == "examples"
28
+ Provides-Extra: test
29
+ Requires-Dist: pytest>=7; extra == "test"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7; extra == "dev"
32
+ Requires-Dist: matplotlib>=3.7; extra == "dev"
33
+ Requires-Dist: ruff>=0.5; extra == "dev"
34
+ Requires-Dist: build; extra == "dev"
35
+ Requires-Dist: twine; extra == "dev"
36
+ Requires-Dist: nbformat; extra == "dev"
37
+ Requires-Dist: nbclient; extra == "dev"
38
+ Requires-Dist: ipykernel; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # kac-zwanzig
42
+
43
+ [![tests](https://github.com/william-pfalzgraff/kac-zwanzig/actions/workflows/ci.yml/badge.svg)](https://github.com/william-pfalzgraff/kac-zwanzig/actions/workflows/ci.yml)
44
+ [![PyPI](https://img.shields.io/pypi/v/kac-zwanzig)](https://pypi.org/project/kac-zwanzig/)
45
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
46
+
47
+ A Python package that generates exact memory kernels, velocity autocorrelation functions
48
+ and trajectories for a particle linearly coupled to a bath of harmonic oscillators, plus
49
+ sampled correlation functions with controllable statistical noise.
50
+
51
+ The Kac–Zwanzig model is a single particle linearly coupled to a collection of harmonic
52
+ oscillators; these oscillators are often called the "bath". It is a simple model of a
53
+ solute in a solvent: the forces imparted on the particle by the oscillators represent
54
+ the forces that would be experienced by a solute. The velocity autocorrelation
55
+ function (VACF) is qualitatively similar to those produced by moleculr dynamics (MD)
56
+ simulations of solutes in liquids.
57
+
58
+ Because every force in the model is linear, it can be solved exactly. The particle's
59
+ correlation functions, the memory kernel of its generalized Langevin equation (GLE),
60
+ and individual trajectories are all available in closed form, up to one matrix
61
+ diagonalization.
62
+
63
+ `kac_zwanzig` generates:
64
+
65
+ - the spectral density of the bath and its discretization into oscillators,
66
+ - the exact memory kernel of the finite bath and its continuum limit,
67
+ - the exact VACF $C(t)$ and its time derivative,
68
+ - exact trajectories of the particle: velocity, acceleration, position and the GLE's random force,
69
+ - sampled VACFs from $n$ independent trajectories, with the noise a simulation would have,
70
+ including standard errors and bootstrapped confidence intervals.
71
+
72
+ It depends only on numpy and contains no solver.
73
+
74
+ ## Theory
75
+
76
+ **The Hamiltonian.** A particle of mass $M$, coordinate $q$, momentum $p$, optionally in a
77
+ harmonic trap of frequency $Ω$ (zero by default), coupled to $N$ oscillators with
78
+ coordinates $x_j$, frequencies $\omega_j$ and coupling weights $k_j \geq 0$:
79
+
80
+ $$
81
+ H=\frac{p^2}{2M}+\frac{1}{2}M\Omega^2q^2+\sum_{j=1}^{N}\left[\frac{p_j^2}{2}+\frac{\omega_j^2}{2}\Big(x_j-\frac{\sqrt{k_j}}{\omega_j} q\Big)^2\right]. \qquad (1)
82
+ $$
83
+
84
+ **The bath kernel and the spectral density.** The bath acts on the particle through the memory
85
+ kernel. For a bath of $N$ harmonic oscillators the kernel $K_N$ is:
86
+
87
+ $$
88
+ K_N(t)=\sum_{j=1}^{N}k_j\cos (\omega_j t). \qquad (2)
89
+ $$
90
+
91
+ This is exact for the finite bath. A continuous bath is described by a spectral density
92
+ $J(ω)$; the two are related by
93
+
94
+ $$
95
+ J(\omega)=\frac{\pi}{2}\sum_j k_j \omega_j \delta(\omega-\omega_j),\qquad
96
+ K_\infty(t)=\frac{2}{\pi}\int_0^\infty\frac{J(\omega)}{\omega}\cos\omega t\ d\omega, \qquad (3)
97
+ $$
98
+
99
+ so choosing `(ω_j, k_j)` is choosing a quadrature rule for the cosine transform in (3).
100
+
101
+ **The generalized Langevin equation.** Integrating out the oscillators exactly gives, for
102
+ the particle's velocity $v = \frac{p}{M}$,
103
+
104
+ $$
105
+ M \dot v(t)=-M\Omega^2 q(t)-\int_0^t K_N(t-s) v(s)\ ds+F(t), \qquad (4)
106
+ $$
107
+
108
+ where $F(t)$ is the *random force*, a function of the oscillators' initial conditions
109
+ only. When those initial conditions are drawn from the canonical (thermal) ensemble,
110
+ $⟨F(t) F(0)⟩ = k_BT K_N(t)$ (the fluctuation–dissipation theorem) and $⟨F(t) v(0)⟩ = 0$.
111
+
112
+ **The memory kernel of the correlation function.** Multiplying (4) by $v(0)$ and averaging
113
+ turns it into an equation for the normalized VACF $C(t) = ⟨v(t)v(0)⟩/⟨v²⟩$:
114
+
115
+ $$
116
+ \dot C(t)=-\int_0^t\Gamma(t-s) C(s)\ ds,\qquad \Gamma(t)=\frac{K_N(t)+M\Omega^2}{M}. \qquad (5)
117
+ $$
118
+
119
+ $\Gamma$ is the memory kernel (the bath kernel per unit mass, plus the trap). Equation (5)
120
+ holds identically for every finite bath, so $\Gamma$ is the exact reference no matter how
121
+ the bath was discretized.
122
+
123
+ **Normal modes.** The coupled system is a set of $N+1$ independent oscillators. Their
124
+ frequencies $\nu_k$ are the square roots of the eigenvalues of the Hessian, an $(N+1)×(N+1)$
125
+ arrowhead matrix, and each mode carries a share $a_k²$ of the particle (`Σ_k a_k² = 1`).
126
+ The nonzero frequencies solve
127
+
128
+ $$
129
+ \sum_{j=1}^{N}\frac{k_j}{\nu^2-\omega_j^2}=M, \qquad (6)
130
+ $$
131
+
132
+ one root between each pair of neighbouring $\omega_j^2$ and one above the last. A free particle
133
+ also has one zero-frequency mode, the rigid translation of everything together.
134
+
135
+ **The exact correlation function.** In the normal mode representation the VACF is a finite
136
+ cosine series:
137
+
138
+ $$
139
+ C(t)=\sum_k a_k^2\cos\nu_k t,\qquad \dot C(t)=-\sum_k a_k^2 \nu_k\sin\nu_k t. \qquad (7)
140
+ $$
141
+
142
+ **Exact trajectories.** Thermal initial conditions are independent Gaussians in the
143
+ normal modes, so a trajectory of the particle is
144
+
145
+ $$
146
+ v(t)=\sum_k\big[\alpha_k\cos\nu_k t+\beta_k\sin\nu_k t\big],\qquad
147
+ \alpha_k,\beta_k\sim\mathcal N\left(0,\ \frac{a_k^2 k_BT}{M}\right), \qquad (8)
148
+ $$
149
+
150
+ with the acceleration $dv/dt$ and the position $q(t) = q(0) + ∫v$ obtained term by term
151
+ and the random force $F(t)$ of (4) reconstructed from the oscillators' initial
152
+ coordinates.
153
+
154
+ **Sampled correlation functions.** A "simulation" is an average over $n$ independent
155
+ trajectories,
156
+
157
+ $$
158
+ \hat C(t)=\frac{\sum_{n}v_n(t) v_n(0)}{\sum_{n}v_n(0)^2},\qquad
159
+ \mathrm{Var}\big[\hat C(t)\big]=\frac{1-C(t)^2}{n},\qquad
160
+ \mathrm{Cov}\big[\hat C(t),\hat C(t')\big]=\frac{C(t-t')-C(t)C(t')}{n}, \qquad (9)
161
+ $$
162
+
163
+ because $v(t)$ is a Gaussian process. The noise is correlated in time on the scale of
164
+ $C$ itself, which matters when $C$ is differentiated or inverted. The derivative can also
165
+ be estimated without differencing, from $⟨\dot{v}(t) v(0)⟩$, since the acceleration is known
166
+ along every trajectory (as the forces are in MD).
167
+
168
+ **The two preset baths.**
169
+
170
+ $$
171
+ \text{Ohmic: }J(\omega)=\eta \omega e^{-\omega/\omega_c},\quad K_\infty(t)=\frac{2\eta\omega_c/\pi}{1+\omega_c^2t^2};\qquad
172
+ \text{Debye: }J(\omega)=\frac{2\lambda\omega_c \omega}{\omega_c^2+\omega^2},\quad K_\infty(t)=2\lambda e^{-\omega_c t}. \qquad (10)
173
+ $$
174
+
175
+ For a free particle in the Ohmic bath the shape of $C(t)$ depends on one number only,
176
+ $η/(Mω_c)$; $ω_c$ sets the unit of time. With $M = ω_c = 1$, $η = 1$ gives the single shallow
177
+ negative dip typical of liquids.
178
+
179
+ The derivations are in [docs/theory.md](docs/theory.md); the choice of frequency grid is
180
+ analysed in [docs/frequency_grids.pdf](docs/frequency_grids.pdf).
181
+
182
+ ## Install
183
+
184
+ ```bash
185
+ pip install kac-zwanzig
186
+ ```
187
+
188
+ Only numpy is required. For the examples add matplotlib (`pip install "kac-zwanzig[examples]"`).
189
+ From a checkout: `pip install -e ".[dev]"` and `python -m pytest -q` (about 30 tests, under a minute).
190
+
191
+ ## Quick start
192
+
193
+ ```python
194
+ import numpy as np
195
+ import kac_zwanzig as kz
196
+
197
+ bath = kz.ohmic(eta=1.0, omega_c=1.0, N=2000) # J(ω) of eq. (10), discretized into 2000 oscillators
198
+ s = kz.System(bath, M=1.0, kT=1.0) # the particle of eq. (1), free (Omega = 0)
199
+ t = np.arange(0, 20, 0.05)
200
+
201
+ K_N = bath.kernel(t) # eq. (2)
202
+ K_oo = bath.kernel_continuum(t) # eq. (3), closed form for the presets
203
+ C = s.vacf(t) # eq. (7)
204
+ Cdot = s.vacf_dot(t)
205
+ Gamma = s.memory_kernel(t) # eq. (5): the answer a kernel-extraction method should find
206
+
207
+ traj = s.trajectory(t, n_traj=1, seed=0, random_force=True) # eq. (8): traj.v, traj.a, traj.q, traj.F
208
+ est = s.sampled_vacf(t, n_traj=10_000, seed=1) # eq. (9): est.C, est.Cdot_acc, est.stderr()
209
+ boot = est.bootstrap(1000) # replicate curves: boot.std(), boot.band()
210
+
211
+ data = s.inversion_data(t, est, derivative="acc") # C, dC/dt and the exact Γ, bundled for your solver
212
+ # Gamma_solved = my_solver(data.C, data.Cdot, data.dt) solves eq. (5)
213
+ # data.residual(Gamma_solved) max error against the exact Γ
214
+ ```
215
+
216
+ [examples/quickstart.py](examples/quickstart.py) runs this end to end, recovers the kernel with
217
+ the deliberately simple solver in [examples/naive_inversion.py](examples/naive_inversion.py),
218
+ and makes the figure below; [examples/quickstart.ipynb](examples/quickstart.ipynb) is the
219
+ same as an executed notebook.
220
+
221
+ ![quickstart figure](docs/quickstart.png)
222
+
223
+ ## Worked examples
224
+
225
+ **Which discretization?** Two grids are built in. `grid="uniform"` places oscillators at
226
+ equally spaced frequencies up to a cutoff and weights them by $J(ω)/ω$; it is a midpoint
227
+ rule for the integral in (3), its error is a smooth, tiny copy of the kernel shifted to
228
+ $t = 2\pi/\Delta \omega$, and it is the default for the Ohmic bath. `grid="invcdf"` places the
229
+ oscillators at quantiles of $J(ω)/ω$ with equal weights; it never truncates and gets
230
+ $K(0)$ exactly but leaves a small high-frequency ripple in $K_N$. Either way $K_N$ and $\Gamma$
231
+ are the exact answers for the bath you built; the grid only decides how closely the
232
+ finite bath imitates the continuum. [examples/frequency_grids.py](examples/frequency_grids.py)
233
+ makes the comparison figures; the PDF in `docs/` has the analysis.
234
+
235
+ ```python
236
+ b1 = kz.ohmic(eta=1.0, N=2000) # uniform grid: |K_N - K_oo| ~ 4e-6 for t < 250
237
+ b2 = kz.ohmic(eta=1.0, N=2000, grid="invcdf") # equal-weight quantile grid: ripple ~ 2e-3
238
+ b3 = kz.Bath.from_spectral_density(lambda w: 0.5*w**3*np.exp(-w), N=1000, omega_max=30) # any J(ω)
239
+ ```
240
+
241
+ **One trajectory and the GLE.** Equation (4) holds exactly along every trajectory; the
242
+ residual of the discretized convolution is a direct check of the whole machinery.
243
+
244
+ ```python
245
+ tr = s.trajectory(np.arange(0, 5, 0.002), n_traj=3, seed=0, random_force=True)
246
+ res = kz.gle_residual(s, tr) # M dv/dt + int K_N v - F, zero up to the trapezoid error
247
+ ```
248
+
249
+ **Sampled VACF with error bars.** `sampled_vacf` splits the trajectories into
250
+ independent groups (50 by default), keeps a complete estimate per group, and reports the
251
+ pooled estimate. The group spread gives a standard error at each time; resampling groups
252
+ with replacement gives bootstrap replicates that keep the time correlation of (9) and
253
+ handle the ratio normalization exactly. Use the replicates to put error bars on anything
254
+ computed from $C$.
255
+ [examples/sampling_noise.py](examples/sampling_noise.py) studies the noise, the derivative
256
+ estimators and why averaging one long trajectory over time does not work for this model.
257
+
258
+ ```python
259
+ est = s.sampled_vacf(t, n_traj=100_000, seed=1) # noise ~ sqrt((1 - C^2)/1e5) ~ 3e-3
260
+ se = est.stderr() # standard error from the group spread
261
+ boot = est.bootstrap(n_boot=1000, seed=2)
262
+ lo, hi = boot.band("C", level=0.95) # pointwise 95% band
263
+ sig = np.sqrt(kz.predicted_variance(C, 100_000)) # what eq. (9) predicts, for comparison
264
+ ```
265
+
266
+ ## API
267
+
268
+ Everything below is available as `kz.<name>` after `import kac_zwanzig as kz`.
269
+
270
+ ### Baths (`kac_zwanzig.bath`)
271
+
272
+ | Call | Returns |
273
+ |---|---|
274
+ | `kz.ohmic(eta, omega_c, N=2000, grid="uniform", omega_max=25ω_c)` | `Bath`, eq. (10) Ohmic; friction `η`, `K(0) = 2ηω_c/π` |
275
+ | `kz.debye(lmbda, omega_c, N=2000, grid="invcdf", omega_max=100ω_c)` | `Bath`, eq. (10) Debye; `K(0) = 2λ` |
276
+ | `kz.Bath.from_spectral_density(J, N, grid, omega_max)` | `Bath` from any callable `J(ω)` (numerical quantiles and continuum kernel) |
277
+ | `kz.Bath(omega, k)` | `Bath` from arrays `ω_j`, `k_j` |
278
+ | `bath.kernel(t)` | exact `K_N(t)`, eq. (2); also `kernel_dot`, `kernel_integral` |
279
+ | `bath.kernel_continuum(t)` | `K_∞(t)`, eq. (3) |
280
+ | `bath.J(omega)` | continuum spectral density |
281
+ | `bath.spectral_density_histogram(bins)` | the discrete `J` binned, for plotting |
282
+ | `bath.K0`, `bath.N`, `bath.omega`, `bath.k`, `bath.describe()` | |
283
+ | `kz.debye_vacf_continuum(t, lmbda, omega_c, M)` | closed-form continuum VACF for the Debye bath |
284
+
285
+ ### Particle + bath (`kac_zwanzig.system`)
286
+
287
+ | Call | Returns |
288
+ |---|---|
289
+ | `kz.System(bath, M=1, kT=1, Omega=0)` | the particle of eq. (1) |
290
+ | `s.vacf(t)`, `s.vacf_dot(t)`, `s.vacf_ddot(t)` | exact `C`, `dC/dt`, `d²C/dt²`, eq. (7), on any grid |
291
+ | `s.memory_kernel(t)`, `s.memory_kernel_0` | exact `Γ(t)` of eq. (5) and `Γ(0)` |
292
+ | `s.memory_kernel_continuum(t)` | its `N → ∞` limit, for orientation |
293
+ | `s.spectral_measure()` → `nu, a2` | mode frequencies and particle weights, eq. (6) |
294
+ | `s.eigenvectors()` | full eigenvector matrix (needed only for the random force) |
295
+ | `s.trajectory(t, n_traj=1, seed=None, positions=True, random_force=False)` | `Trajectory` with `v, a, q, F` of shape `(n_traj, len(t))`, eq. (8) |
296
+ | `s.sampled_vacf(t, n_traj, seed=None, normalization="sample", n_blocks=50)` | `VACFEstimate`, eq. (9) |
297
+ | `s.inversion_data(t, estimate=None, derivative="acc")` | `InversionData`: `.C, .Cdot, .dt, .memory_kernel, .memory_kernel_0, .residual(Γ)` |
298
+
299
+ ### Sampling, propagation, estimators (`kac_zwanzig.sample`, `.propagate`, `.estimate`)
300
+
301
+ | Call | Returns |
302
+ |---|---|
303
+ | `kz.sample_modes(s, n_traj, rng)` → `alpha, beta` | thermal initial conditions as the amplitudes of eq. (8), `(N+1, n_traj)` |
304
+ | `kz.sample_state(s, n_traj, rng)` → `ModeState` | the full mode state `(P, Q)` plus `alpha, beta`; needed for the random force |
305
+ | `kz.velocity(s, t, alpha, beta)`, `kz.acceleration(...)`, `kz.position(..., q0=0)` | `(n_traj, len(t))` arrays, exact |
306
+ | `kz.random_force(s, t, state)`, `kz.initial_position(s, state)` | `F(t)` of eq. (4) and the sampled `q(0)` |
307
+ | `kz.gle_residual(s, traj)` | `M dv/dt + MΩ²q + ∫K_N v − F` on the trajectory grid |
308
+ | `kz.vacf_ensemble(s, t, n_traj, rng, normalization, n_blocks)` | `VACFEstimate` (same as `s.sampled_vacf`) |
309
+ | `est.C`, `est.Cdot_acc`, `est.Cdot_sym` | pooled estimate; `⟨v̇(t)v(0)⟩` derivative; its symmetrized version |
310
+ | `est.stderr(which="C")` | standard error from the spread of the groups |
311
+ | `est.bootstrap(n_boot, seed)` → `BootstrapResult` | replicate curves `.C, .Cdot_acc, .Cdot_sym` with `.std()`, `.band(level)`, `.covariance()` |
312
+ | `est.blocks_C`, `est.blocks_R`, `est.block_sizes` | per-group normalized and raw estimates |
313
+ | `kz.vacf_direct(s, t, alpha, beta)` | reference estimator that forms the trajectories explicitly |
314
+ | `kz.finite_difference(C, dt, order=2)` | `dC/dt` by central differences, using `C(−t) = C(t)` at the origin |
315
+ | `kz.predicted_variance(C, n_traj, normalization)`, `kz.predicted_covariance(...)` | eq. (9) (and the `(1 + C²)/n` form for exact normalization) |
316
+ | `kz.vacf_time_average(v, n_lags)`, `kz.time_average_floor(s, t)` | single-trajectory time average and its (non-vanishing) error floor |
317
+
318
+ ## Conventions and things to know
319
+
320
+ - **Normalization.** $C(0) = 1$. Sampled estimates divide by the sampled $⟨v(0)^2⟩$ by default
321
+ (`normalization="sample"`, eq. (9)); `"exact"` divides by $k_BT/M$ instead and has noise
322
+ $(1 + C^2)/n$. The memory kernel does not depend on either choice.
323
+ - **Sign of the kernel.** The package reports $Γ$ as defined in (5), positive at $t = 0$.
324
+ - **Groups, not time blocks.** The "blocks" in `sampled_vacf` are groups of independent
325
+ trajectories, used for standard errors and the bootstrap. They are not the block
326
+ averaging of MD time series; trajectories here are independent by construction.
327
+ - **Ensemble, not time, averages.** The finite bath is integrable: averaging one long
328
+ trajectory over time origins stalls at an error floor set by $1/\Sigma_k a_k^4$ effective modes
329
+ and never converges to the thermal $C(t)$. `sampled_vacf` averages over independent
330
+ initial conditions, which does converge (`kz.vacf_time_average` exists to demonstrate the trap).
331
+ - **Derivatives.** `est.Cdot_acc` uses the acceleration along each trajectory, so it has no
332
+ differencing error; `kz.finite_difference` is the alternative. Because the noise in (9) is
333
+ smooth in time, differencing amplifies it far less than white noise would.
334
+ - **Cost.** The eigensolve takes about a second at $N = 2000$ and scales as $N^3$. `sampled_vacf`
335
+ never forms the trajectory array ($O(N (n_traj + len(t)))$; $10^6$ trajectories in about 30 s).
336
+ `trajectory` does form it, $n_traj \times len(t)$ doubles, and the random force additionally needs
337
+ the $(N+1)^2$ eigenvector matrix (32 MB at `N = 2000`).
338
+ - **What it is not.** No anharmonic potentials (the particle is free or harmonically trapped),
339
+ no thermostat or integrator (nothing to integrate), no quantum effects, no time-averaged
340
+ observables (see above), and no solver.
341
+
342
+ ## Repository layout
343
+
344
+ | Path | Contents |
345
+ |---|---|
346
+ | `src/kac_zwanzig/` | the package: `bath`, `system`, `sample`, `propagate`, `estimate` |
347
+ | `tests/` | test suite (`python -m pytest -q`) |
348
+ | `examples/` | `quickstart.py` and its executed notebook, `naive_inversion.py`, `frequency_grids.py`, `sampling_noise.py`, `orientation.py` |
349
+ | `docs/` | `theory.md` (derivations), `frequency_grids.pdf` (grid analysis), the README figure |
350
+ | `CITATION.cff`, `CHANGELOG.md`, `RELEASING.md` | citation metadata, release notes, how releases are made |
351
+
352
+ ## Citing
353
+
354
+ If this package is useful in your work, please cite it: GitHub's "Cite this repository"
355
+ button (from `CITATION.cff`) gives BibTeX and APA entries.
356
+
357
+ ## License
358
+
359
+ MIT, see [LICENSE](LICENSE).