Python implementation of the sc-SQ method for computing many-body Green functions, as described in
S. Yu. Kruchinin, Self-Consistent Spectral Quadrature Approach to Many-Body Green Functions, submitted to PRB.
The method maps spectral moments onto a Gauss–Christoffel quadrature via the
Lanczos recurrence, obtains a pole decomposition
sc-sq/
├── sc_sq/
│ ├── core.py # Hankel matrix, SVD rank, Lanczos, poles/weights
│ ├── anderson.py # Anderson single-impurity model (AIM) solver
│ ├── ed.py # Exact-diagonalization (Caffarel-Krauth) impurity solver
│ ├── dmft.py # DMFT + sc-SQ / sc-GW for Hubbard / Bethe lattice
│ ├── spectral.py # Spectral reconstruction: LB, BRI, SEC, terminator
│ └── bethe.py # Bethe-lattice benchmark helpers (branch selection, broadening)
├── benchmarks/
│ ├── 01_anderson/
│ │ ├── oneshot.py # Fig. 1: one-shot sc-SQ, semielliptic bath
│ │ └── mixed_valence.py # Fig. 2: mixed-valence self-consistency
│ └── 02_hubbard_bethe/
│ ├── hubbard_bethe.py # Fig. 3: Mott transition, spectral + Z
│ └── convergence_N.py # Fig. 4: sc-SQ convergence with rank N
├── tests/
│ ├── test_anderson.py
│ ├── test_core.py
│ └── test_dmft.py
└── README.md
The algorithmic backbone of sc-SQ. Given an array of spectral moments
spectral_quadrature(moments) runs the entire
pipeline and returns an SQResult container; lower-level building blocks
are also exported for custom workflows.
Public API: hankel_matrix, svd_rank, lanczos_from_moments,
poles_and_weights, green_function, green_function_cf,
spectral_quadrature, SQResult.
Exact-diagonalization (Caffarel–Krauth 1994) impurity solver for the
single-orbital Anderson model embedded in a Bethe-lattice DMFT loop.
ED_BetheLattice.solve() fits n_bath discrete bath levels
scipy.linalg.eigh, and evaluates the retarded Green function via the
Lehmann representation.
The returned EDResult exposes A_omega, lehmann_poles, lehmann_weights,
and a moments(2N) method that computes exact spectral moments up to order convergence_N.py to seed the sc-SQ loop and break EOM-closure
traps at higher
Public API: AndersonED, EDResult, ED_BetheLattice.
sc-SQ impurity solver for the Anderson single-impurity model with a
semielliptic bath.
anderson_moments() computes moments wide_band_hybridization(); the AndersonSolver.solve() drives the moment–quadrature–occupancy loop with
linear mixing until convergence, computing occupancy as the
Lorentzian-broadened integral
AndersonSolver.one_shot() evaluates the spectral hierarchy at a fixed input
state without iteration.
Results are returned as AndersonResult dataclasses that expose poles,
weights, occupancy, double_occ, converged, and convenience methods
green(z), spectral_lb(omega), spectral_bri(omega).
Public API: AndersonParams, AndersonSolver, AndersonResult,
wide_band_hybridization, anderson_moments.
Four real-frequency spectral reconstruction procedures, all taking a
poles/weights pair from core.spectral_quadrature as input.
lorentzian_broadening(omega, poles, weights, eta) convolves each
delta-function pole with a Lorentzian of half-width barycentric_interpolation(omega, poles, weights) constructs a
parameter-free smooth envelope via barycentric rational interpolation with
alternating-sign weights self_energy_continuation(omega, poles, weights, G0_inv, eta) extracts
terminator_green(z, a, b) evaluates the continued-fraction Green function
with a Beer–Pettifor semi-elliptic tail (Eq. 30).
The utility spectral_from_G(G) converts any retarded Green function to the
spectral function
Public API: lorentzian_broadening, barycentric_interpolation,
self_energy_continuation, terminator_green.
DMFT + sc-SQ two-loop solver for the half-filled Hubbard model on the Bethe
lattice ($G_0^{-1}(z)=z+\mu_{\rm chem}-t^2G_{\rm loc}(z)$).
hubbard_moments_bethe() computes local moments BetheLattice.solve() runs an outer DMFT iteration (updating the Weiss
field) around an inner sc-SQ loop (converging the impurity moments) and
returns a DMFTResult with converged poles, weights, occupancy, double
occupancy, kinetic energy, and full iteration history.
BetheLattice.quasiparticle_weight() computes
BetheLattice.spectral_sec() evaluates the physical spectral function via
self-energy continuation at the DMFT fixed point.
The non-interacting Bethe DOS
bethe_dos().
Public API: BetheLattice, DMFTResult, bethe_dos.
Reproduces Fig. 1 of the paper.
For the particle-hole symmetric AIM with a semielliptic conduction band
(nrg_spectral_semielliptic_U_over_D_{value}.dat are plotted in black when present.
Panel (b) shows the Hankel SVD spectrum oneshot.pdf and oneshot.h5; accepts --show.
Reproduces Fig. 2 of the paper.
Scans --N and --show.
Writes mixed_valence.pdf and mixed_valence.h5.
Reproduces Fig. 3 of the paper.
Runs BetheLattice.solve() for GW_BetheLattice for the sc-GW reference on
a denser nrg_spectral_U_over_D_{X.X}.dat.
Panel (b) plots the quasiparticle weight nrg_Z_vs_UoverD.dat.
Results are cached in hubbard_bethe.h5; use --recalc sc-sq,
--recalc sc-gw, or --recalc all to force recomputation.
Accepts --N and --show.
Writes hubbard_bethe.pdf and hubbard_bethe.h5.
Reproduces Fig. 4 of the paper.
Shows sc-SQ convergence with pole rank ED_BetheLattice) to
break EOM-closure traps at higher nrg_spectral_U_over_D_{value}.dat.
Writes convergence_N.pdf.
| Package | Version | Notes |
|---|---|---|
| Python | ≥ 3.11 | |
| NumPy | ≥ 1.24 | |
| SciPy | ≥ 1.10 | optional but recommended |
| Matplotlib | ≥ 3.7 | required for the examples |
| h5py | ≥ 3.8 | optional, for HDF5 output |
| TRIQS | ≥ 3.2 | optional, for GfReFreq I/O |
git clone https://github.com/polariton/sc-sq.git
cd sc-sq
pip install -e .For example/benchmark scripts, install optional plotting and HDF5 extras:
pip install -e ".[examples]"Or, without a setup.py, add the repo root to your PYTHONPATH:
export PYTHONPATH="$PWD:$PYTHONPATH"# Inside Ubuntu (WSL)
cd ~/src/sc-sq
python -m pip install numpy scipy matplotlib h5py
python -c "from sc_sq.core import spectral_quadrature; print('OK')"cd sc-sq
python -m pytest tests/ -vAll 51 tests should pass.
Each script writes a PDF in the current working directory and,
if h5py is installed, an HDF5 archive with all numerical data.
Pass --show to open an interactive Matplotlib window.
Panels:
(a) Spectral function at
cd benchmarks/01_anderson
python oneshot.pyOutput: oneshot.pdf, oneshot.h5
Panels:
(a)
cd benchmarks/01_anderson
python mixed_valence.pyAccepts --N to change the pole rank.
Output: mixed_valence.pdf, mixed_valence.h5
DMFT + sc-SQ and sc-GW for the half-filled Hubbard model.
Panels:
(a) Local spectral function
cd benchmarks/02_hubbard_bethe
python hubbard_bethe.pyOutput: hubbard_bethe.pdf, hubbard_bethe.h5
Panels:
(a)
cd benchmarks/02_hubbard_bethe
python convergence_N.pyOutput: convergence_N.pdf
import numpy as np
from sc_sq.core import spectral_quadrature
from sc_sq.anderson import AndersonSolver
from sc_sq.spectral import lorentzian_broadening
# Anderson impurity model: U/Delta = 4, particle-hole symmetric
solver = AndersonSolver(eps_d=-2.0, U=4.0, Delta=1.0, D=10.0)
# Self-consistent solution at N=3
result = solver.solve(N=3)
print(result)
# Lorentzian-broadened spectral function
omega = np.linspace(-12, 12, 2000)
A = lorentzian_broadening(omega, result.poles, result.weights, eta=0.02)
# One-shot (no self-consistency) hierarchy
sq = solver.one_shot(N=3, n_sigma=0.5, D_docc=0.25)
print(sq)| Symbol | Meaning |
|---|---|
| spectral moments | |
| Hankel moment matrix | |
| physical rank (SVD criterion) | |
| sc-SQ Green function | |
| Lorentzian broadening |
MIT