adapol: Adaptive Pole Fitting for Quantum Many-Body Physics
adapol (“add-a-pole”) is a Python package for constructing compact pole approximations of Matsubara functions,
with real poles \(p_k\) and scalar or matrix-valued residues \(R_k\), using the AAA rational approximation algorithm and nonlinear optimization. Given Matsubara data, or an existing pole expansion (for example, a discretized spectral density or a discrete Lehmann representation), adapol finds an accurate approximation with a specified maximum number of poles, or as few poles as possible. A typical application is hybridization fitting: constructing a compact bath representation of a given hybridization function.
Installation
pip install adapol
The only dependencies are numpy and scipy.
Note: the interface described below requires a newer version of adapol, which has not yet been released on PyPI. For now, install from source:
pip install git+https://github.com/flatironinstitute/adapol
Usage
adapol provides three main functions:
approx_freq_aaa(F, Z, ...)fits frequency dataF, sampled at (typically Matsubara) pointsZ, with a sum of simple poles, using the AAA algorithm. The number of poles is controlled by a pole budgetmax_n_polesand/or a AAA error toleranceaaa_tol.approx_sop_fast(poles, residues, beta, ...)approximates a given sum of poles by a (hopefully) smaller one in a single AAA pass. The number of poles is again controlled bymax_n_polesand/oraaa_tol, and an optionalnonlinear_optimizationstep refines the pole locations.approx_sop_tol(poles, residues, tol, beta, ...)finds the smallest sum of poles whose actual error (in \(L^2(\tau)\) and \(l^2(i \omega_n)\)) is below the tolerancetol.
Citation
If you use this package in your research, please include a reference to this GitHub repository, and cite the following references:
Huang, Zhen, Emanuel Gull, and Lin Lin. “Robust analytic continuation of Green’s functions via projection, pole estimation, and semidefinite relaxation,” Phys. Rev. B 107, 075151 (2023).
Huang, Zhen, Denis Golež, Hugo U. R. Strand, and Jason Kaye. “Automated evaluation of imaginary time strong coupling diagrams by sum-of-exponentials hybridization fitting,” SciPost Phys. 19 (5), 121 (2025).
License
adapol is distributed under the GNU General Public License v3.0 (see LICENSE).