# DMRG / Quantum Many-Body

Lanczos exact diagonalization for spin-½ chains on the orbit-class chain of the toroidal pentagon mesh. First ship: ED for chains up to N=16 sites (Hilbert dim ≤ 65,536). The two-site DMRG sweep with SVD truncation is the planned drop-in once the SVD substrate lands.

## Substrate framing

The MPS sites map to orbit classes of the pentagon mesh under the C₅ symmetry: site k ↔ orbit_class_k, bond k ↔ HVP-bond between adjacent classes. A periodic chain corresponds to the toroidal wrap-around, naturally giving a periodic MPS once the sweep ships. The cascade depth of the substrate sets the maximum useful bond dimension χ.

## Models

- **Heisenberg**: `H = J Σ_i (Sx_i Sx_{i+1} + Sy_i Sy_{i+1} + Sz_i Sz_{i+1})`
- **Transverse-field Ising**: `H = -J Σ_i Sz_i Sz_{i+1} - h Σ_i Sx_i`

Boundary: `open` (finite chain) or `periodic` (toroidal). Periodic BCs add a wrap-around coupling between site 0 and site N-1.

## Algorithm

Lanczos iteration with **full reorthogonalization**: every new Krylov vector is orthogonalized against every previous one via classical Gram-Schmidt twice (CGS2). This prevents the eigenvalue drift that a partial-reorth scheme suffers on small chains where the Krylov space saturates the Hilbert dim.

Initial vector: continuous random ∈ (-1, 1). The discrete ±1 init can land in a symmetry sector decoupled from the true ground state — for example, on the N=2 Heisenberg singlet, an init with v[1] = v[2] zeros the singlet overlap and Lanczos converges to the wrong eigenvalue.

Smallest tridiagonal eigenvalue: Sturm sign-counting bisection to relative `tol`.

## Validation

- **N=2 Heisenberg**: exact singlet energy `-3J/4 = -0.75` reproduced to 1e-8
- **N=4 Heisenberg open chain**: -1.6160254... matched to 1e-4
- **TFI N=4 critical (h=J=1)**: Lanczos matches a fully independent power-iteration-on-shifted-H reference to 1e-6 (convention-agnostic self-consistency check)

## Precision report

`energy_drift_shades` and `energy_trust` come from a GeoNum accumulation over the converged energy. When `ensemble_m > 1`, the across-seed std on the ground energy is reported — it is a finite-bond-dim proxy for the eventual two-site DMRG truncation error.

## Parameters

| Field | Meaning | Default |
|-------|---------|---------|
| sites | chain length N (2 ≤ N ≤ 16) | 10 |
| model | `heisenberg` or `tfi` | heisenberg |
| j | coupling constant | 1.0 |
| h | transverse field (TFI only) | 1.0 |
| boundary | `open` or `periodic` | open |
| n_lanczos | maximum Lanczos iterations | 200 |
| tol | energy-convergence threshold | 1e-10 |
| ensemble_m | independent seeds for across-seed variance | 1 |
