# From beads to bath memory

A static RPMD-GLE teaching page. Open through an HTTP server (for example
`python -m http.server 8000` from the website root), then visit
`/teaching/rpmd-gle/`. No build step, backend or third-party JavaScript is required.

## Scope and units

This lesson describes a scalar, mass-scaled, linear system–bath coupling.
It is not a simulation of quantum trajectories or an atomistic friction tensor.
The ring view displays real free-ring-polymer mode patterns on a schematic
circular reference layout. Every bead displacement is along the same horizontal
Cartesian axis. The centroid mode translates the entire ring rigidly; internal
modes preserve its centroid. The cross follows the centroid, and the dashed
circle marks the undisplaced layout. Amplitude and animation speed are
illustrative. Conjugate indices show cosine/sine partners. P is bounded to 256
for the visualizer. This is a UI bound, not a physical restriction.

Angular frequencies and A entries are in fs^-1; kernels and alpha in fs^-2.
The nuclear temperature determines omega_n; it is not an electronic-temperature
parameter. KB = 8.617333262145e-5 eV/K; hbar = 0.6582119569 eV fs.
The finite-memory bath is Lambda(omega) = eta exp(-omega/cutoff).
K(t) = (2/pi) integral Lambda(omega) cos(omega t) d omega.
No plotted kernel is normalized by its value at zero.

The mode-transformed spectrum is zero below omega_n, and otherwise
sqrt(Omega^2 - omega_n^2)/Omega * Lambda(sqrt(Omega^2 - omega_n^2)).
At mode zero, use the original spectrum, including Omega = 0.
Memory kernels are integrated in the original frequency variable, with its
omega^2/(omega^2+omega_n^2) weight and shifted oscillation frequency.
The browser uses composite Simpson quadrature (2048 intervals) in sqrt(omega/cutoff), covering
omega/cutoff in [0,24] and resolving the low-frequency region. The centroid kernel uses its analytic expression.
The time window shortens for high-frequency modes to resolve oscillations.

For a perfectly white bath the spectrum transformation is exact. K_0 is
2 eta delta(t). Internal kernels contain this impulse plus a regular tail
whose t=0 value is -eta omega_n. The white-bath panel describes these
pieces in text; it does not approximate a delta function with a finite peak
or plot a truncated Fourier transform of the flat spectrum.
Alpha = (2/pi) integral Lambda(omega) omega_n^2/(omega^2+omega_n^2) d omega;
for the white bath alpha = eta omega_n. This is a separate static correction.
The lesson does not implement nonlinear or tensor-valued atomistic coupling.

## GLEfit examples

`fit-examples.json` contains actual offline fits generated by George Trenins'
GLEfit using `Optimization.from_config` and the EF optimizer. The source Git
revision, target, units, fit range, convergence status, error and all matrices
are recorded. These are illustrative small fits, not production parameters.

To regenerate:

```
python generate_examples.py /path/to/GLEfit
```

Install GLEfit's dependencies plus PyYAML in the Python environment first.
The script imports the supplied checkout; it does not install or modify it.
Six fits use P=8, T=300 K, eta=0.05 fs^-1, cutoff=0.20 fs^-1,
modes 0,1,4 and one or three damped-cosine components. Each component uses
two auxiliaries. It uses GLEfit's `nmLambda` and `nmfreq` for the targets.
The objective is trapezoidal-weighted squared spectral error on
0 <= omega/cutoff <= omega_n/cutoff + 10. Relative L2 error is the square
root of weighted squared residual divided by weighted squared target.

In the convention dX/dt = -A X + noise, A=[0,theta^T;-theta,A_ss].
A damped cosine uses A_ss=[[gamma,Omega],[-Omega,gamma]] and coupling to
its first auxiliary. Its kernel is theta^2 exp(-gamma t) cos(Omega t).
The plotted analytical formulas and matrix entries use this same convention.
Noise is required for thermal equilibrium; A alone is not the full model.

The saved fits are independent of the live controls. The browser does not
optimize a new fit when temperature, bead count or bath parameters change.
Downloads preserve parameters, units, targets, kernels and matrices as JSON.
The Python reproduction script and the saved fit bank can also be downloaded.

## Attribution

Trenins & Rossi, Physical Review Letters **134**, 226201 (2025),
https://doi.org/10.1103/PhysRevLett.134.226201.
Open paper and supplement: https://arxiv.org/abs/2412.15014.
GLEfit copyright 2025 Georgijs Trenins, MIT licence; see GLEfit-LICENSE.txt.
