Skip to content

Spectral Functions & Dynamics

Spectral functions reveal the dynamical properties of quantum systems, such as density of states (DOS) and dynamical spin/charge correlations. In qkrylov, dynamical response is evaluated efficiently without full diagonalization using the continued fraction expansion over a Krylov subspace.

Core Functions

continued_fraction_coeffs(H, phi0, n_iter) Calculates the \(\alpha\) and \(\beta\) tridiagonal coefficients of the Hamiltonian projected onto the Krylov subspace generated by repeated application of \(H\) on the initial state phi0.

evaluate_spectral_function(alphas, betas, norm_phi0, omega, E0, eta) Evaluates the continued fraction representation to compute \(A(\omega) = -\frac{1}{\pi} \Im \langle \phi_0 | \frac{1}{\omega + E_0 - H + i\eta} | \phi_0 \rangle\).

Parameters Explained

  • alphas, betas: Tridiagonal coefficients from continued_fraction_coeffs.
  • norm_phi0: The square norm of the starting vector phi0.
  • omega: Frequencies to evaluate.
  • E0: Ground state energy.
  • eta: Artificial broadening factor (\(\eta > 0\)).

Example: Dynamical Spin Structure Factor

import numpy as np
from qkrylov import MatrixFreeHamiltonian, lanczos_ground_state
from qkrylov import continued_fraction_coeffs, evaluate_spectral_function

# Assuming H is a previously defined MatrixFreeHamiltonian
# and site is a SpinHalfSite.

# 1. Get ground state
E0, psi0 = lanczos_ground_state(H)

# 2. Apply perturbation: S^z_0 |psi0>
# Note: For ops on states, use H.apply or construct a new MatrixFreeHamiltonian for the operator
# Here we assume a routine that constructs the perturbed state
# phi0 = H_Sz0.apply(psi0)

# Mock perturbation application
# phi0 = apply_operator(psi0, site.Sz, 0)

# 3. Get continued fraction coefficients
# alphas, betas = continued_fraction_coeffs(H, phi0, n_iter=100)

# 4. Evaluate spectral function A(omega)
# omegas = np.linspace(0.0, 5.0, 500)
# A_w = [evaluate_spectral_function(alphas, betas, np.linalg.norm(phi0)**2, w, E0, eta=0.1) for w in omegas]
#include <qkrylov/solvers/dynamics.hpp>
// Example usage of continued_fraction_coeffs and evaluate_spectral_function
// std::vector<double> alphas, betas;
// std::tie(alphas, betas) = continued_fraction_coeffs(H, phi0, 100);
// double A = evaluate_spectral_function(alphas, betas, norm2, w, E0, 0.1);

Coming Soon

Julia bindings are planned via extern "C" FFI. See the roadmap.