pyquanty is a thin Python bridge between the quantum many-body scripting
language Quanty and the exact-diagonalization
toolkit QuSpin. It parses operator
dumps produced by Quanty, reconstructs them as QuSpin operators on a custom
fermionic basis, and provides Lanczos / biconjugate-gradient routines for
single-particle and resonant (RIXS) spectra.
It is aimed at condensed matter physicists and quantum chemists who already have a Quanty workflow for X-ray spectroscopies (XAS, RIXS, multiplet calculations) and want to push to larger Hilbert spaces or use diagnostic routines that are most naturally expressed against a stored sparse Hamiltonian.
Quanty is built around a matrix-free philosophy: operators are applied to states on the fly rather than materialised as a stored matrix. For multiplet problems that fit on a single workstation this is the right default — memory cost stays essentially independent of the Hilbert-space dimension, which is precisely what one wants for atomic-physics-scale calculations.
For larger Hilbert spaces, or for diagnostic tasks that benefit from holding the operator in memory once and reusing it many times — dense subspace diagonalisation of small final-state blocks, biconjugate-gradient resolvents swept over many frequencies, multi-vector Krylov, and so on — it can be worth spending the memory to store the Hamiltonian explicitly and gain wall- clock time on repeated solves. The two strategies are complementary; neither dominates the other across all regimes.
pyquanty exists for that second regime. It consumes Quanty's operator
dumps — where Quanty's symbolic algebra has already done the heavy lifting
of building multiplet integrals, rotations, and basis transformations — and
hands the resulting coefficients to a standard sparse-matrix exact-
diagonalisation backend. The Quanty input deck stays the source of truth;
only the numerical solve happens elsewhere.
pyquanty is in light maintenance. An independent Julia package is in
active development that re-implements the symbolic operator-construction
layer natively and offers both stored-sparse and matrix-free paths within a
single package, so the storage strategy becomes a per-problem flag rather
than a choice of toolchain. Until that is released, pyquanty remains the
path of least resistance for users with an existing Quanty workflow who
need to reach larger system sizes.
-
Quanty operator import. Parse
Operator of Length …dumps from Quanty into QuSpin's static-list format, with correct Jordan–Wigner signs for spinful or spinless fermion conventions. -
Custom basis with restrictions. Build a particle-conserving spinless
fermion
user_basiswith arbitrary per-region occupation windows (e.g. core-hole sectors) via Numba-jitted callbacks. -
Spectral function machinery.
CreateSpectracomputes$\langle\psi|(\omega + i\eta - (H - E_0))^{-1}|\psi\rangle$ via Lanczos continued-fraction, Lanczos + Lehmann, or biconjugate gradient. -
Resonant (RIXS) maps.
CreateResonantSpectragives a 2D$(\omega_\text{in}, \omega_\text{out})$ map;CreateRIXSExcitationsreturns final-state energies, weights, and eigenvectors at fixed$\omega_\text{in}$ .
git clone git@github.com:yilu/pyquanty.git
cd pyquanty
pip install -e .- Python ≥ 3.8
quspin,numpy,scipy,numba- Quanty (only required to regenerate operator dumps; the bundled example outputs are sufficient to run the Python side alone)
A complete NiO L₂,₃-edge XAS + RIXS workflow lives in
pyquanty/examples/nio_pyquanty.py,
including the Quanty operator-generation script
generate_quanty_operators.lua
and reference outputs under pyquanty/examples/specs/
for round-trip validation against Quanty's own spectra.
Yi Lu — yilu@nju.edu.cn
Copyright (c) 2025 Yi Lu. Released under the MIT License; see
LICENSE.