|
TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
|
Exact diagonalization of atomic (local) Hamiltonians and their atomic Green's function.
The Atomic problem diagonalization module performs exact diagonalization of a many-body Hamiltonian \( \hat H \) acting on the Fock space of a finite set of fermionic single-particle states. The Hilbert space is split into invariant subspaces of \( \hat H \), each of which is diagonalized independently:
\[ H_B = U_B \, \mathrm{diag}(E_B) \, U^{\dagger}_B \; , \]
where \( B \) indexes the subspaces, \( H_B \) is the Hamiltonian restricted to the subspace, \( U_B \) is the unitary matrix mapping the Fock basis of the subspace to the eigenbasis of the Hamiltonian, and \( E_B \) is the vector of eigenvalues. By convention the global ground-state energy is subtracted at construction, so that the smallest eigenvalue across all subspaces is zero.
The invariant subspaces are built either by an auto-partition procedure, by an explicit list of quantum-number operators, or by a particle-number window, and each block is then diagonalized with the QR algorithm.
Notation used throughout the API:
Atomic Green's function.
Derived from a solved diagonalization problem, the atomic Green's function is built in the Lehmann (spectral) representation,
\[ G_{ab}(z) = \frac{1}{Z} \sum_{B, B'} \sum_{i=0}^{\dim(B)-1} \sum_{j=0}^{\dim(B')-1} \Bigl( e^{-\beta E_{B,i}} + \eta\, e^{-\beta E_{B',j}} \Bigr) \frac{\langle B, i\,|\, \hat c_a \,|\, B', j\rangle \, \langle B', j\,|\, \hat c_b^\dagger \,|\, B, i\rangle} {z + E_{B,i} - E_{B',j}} \; , \]
where \( \eta = +1 \) for fermionic and \( \eta = -1 \) for bosonic statistics, \( Z \) is the partition function, \( B, B' \) are subspace indices, and \( i, j \) are eigenstate indices inside the corresponding subspaces with \( 0 \le i < \dim(B) \) and \( 0 \le j < \dim(B') \). The orbital indices \( a, b \) run over one Green's-function block and are mapped to fundamental-operator linear indices through the fundamental operator set. The only non-zero contributions come from \( (B, B') \) pairs that are connected by the application of a creation/annihilation operator, i.e. for which the corresponding matrix block is non-zero.
The poles
\[ p = E_{B',j} - E_{B,i} \]
and the residues
\[ r_p = \bigl(e^{-\beta E_{B,i}} + \eta\, e^{-\beta E_{B',j}}\bigr) \langle B, i\,|\, \hat c_a \,|\, B', j\rangle \langle B', j\,|\, \hat c_b^\dagger \,|\, B, i\rangle / Z \]
are first stored in the Lehmann data structure, then evaluated on the requested target mesh (imaginary time, Matsubara, Legendre, or real frequency).
The solver itself is exposed through triqs::atom_diag::atom_diag (with real- and complex-valued specializations); a set of free functions builds thermodynamic averages, quantum-number tables and the atomic Green's function on different meshes from a solved instance.
Classes | |
| class | triqs::atom_diag::atom_diag< Complex > |
| Lightweight exact diagonalization solver for finite fermionic Hamiltonians. More... | |
Typedefs | |
| using | triqs::atom_diag::excluded_states_t = std::vector<std::pair<int, int>> |
| List of excluded eigenstates. | |
| template<bool Complex> | |
| using | triqs::atom_diag::gf_lehmann_t = std::vector<matrix<gf_scalar_lehmann_t<Complex>>> |
| Lehmann representation of a block matrix-valued Green's function. | |
| template<bool Complex> | |
| using | triqs::atom_diag::gf_scalar_lehmann_t = std::vector<std::pair<double, typename atom_diag<Complex>::scalar_t>> |
| Lehmann representation of a single matrix element of the Green's function. | |
| using | triqs::atom_diag::indices_t = fundamental_operator_set::indices_t |
| Index type used by the fundamental operator set associated with the diagonalization problem. | |
| using | triqs::atom_diag::quantum_number_t = double |
| Type used to store quantum-number values. Quantum-number operators are Hermitian, so their eigenvalues are real. | |
Functions | |
| template<bool Complex> | |
| atom_diag< Complex >::full_hilbert_space_state_t | triqs::atom_diag::act (typename atom_diag< Complex >::many_body_op_t const &op, typename atom_diag< Complex >::full_hilbert_space_state_t const &st, atom_diag< Complex > const &atom) |
| Act with a many-body operator on a state vector, \( |\psi'\rangle = \hat O\, |\psi\rangle \). | |
| template<bool Complex> | |
| atom_diag< Complex >::block_matrix_t | triqs::atom_diag::atomic_density_matrix (atom_diag< Complex > const &atom, double beta) |
| Compute the atomic density matrix at inverse temperature \( \beta \). | |
| template<bool Complex> | |
| block_gf< imfreq > | triqs::atom_diag::atomic_g_iw (atom_diag< Complex > const &atom, double beta, gf_struct_t const &gf_struct, int n_iw, excluded_states_t const &excluded_states={}) |
| Build the atomic Matsubara Green's function directly from a solved diagonalization problem. | |
| template<bool Complex> | |
| block_gf< imfreq > | triqs::atom_diag::atomic_g_iw (gf_lehmann_t< Complex > const &lehmann, gf_struct_t const &gf_struct, imfreq const &mesh) |
| Build the atomic Matsubara Green's function from a precomputed Lehmann representation. | |
| template<bool Complex> | |
| block_gf< legendre > | triqs::atom_diag::atomic_g_l (atom_diag< Complex > const &atom, double beta, gf_struct_t const &gf_struct, int n_l, excluded_states_t const &excluded_states={}) |
| Build the atomic Green's function in the Legendre basis directly from a solved diagonalization problem. | |
| template<bool Complex> | |
| block_gf< legendre > | triqs::atom_diag::atomic_g_l (gf_lehmann_t< Complex > const &lehmann, gf_struct_t const &gf_struct, legendre const &mesh) |
| Build the atomic Green's function in the Legendre basis from a precomputed Lehmann representation. | |
| template<bool Complex> | |
| gf_lehmann_t< Complex > | triqs::atom_diag::atomic_g_lehmann (atom_diag< Complex > const &atom, double beta, gf_struct_t const &gf_struct, excluded_states_t excluded_states={}) |
| Build the Lehmann representation of the atomic Green's function. | |
| template<bool Complex> | |
| block_gf< imtime > | triqs::atom_diag::atomic_g_tau (atom_diag< Complex > const &atom, double beta, gf_struct_t const &gf_struct, int n_tau, excluded_states_t const &excluded_states={}) |
| Build the atomic imaginary-time Green's function directly from a solved diagonalization problem. | |
| template<bool Complex> | |
| block_gf< imtime > | triqs::atom_diag::atomic_g_tau (gf_lehmann_t< Complex > const &lehmann, gf_struct_t const &gf_struct, imtime const &mesh) |
| Build the atomic imaginary-time Green's function from a precomputed Lehmann representation. | |
| template<bool Complex> | |
| block_gf< refreq > | triqs::atom_diag::atomic_g_w (atom_diag< Complex > const &atom, double beta, gf_struct_t const &gf_struct, std::pair< double, double > const &energy_window, int n_w, double broadening=0, excluded_states_t const &excluded_states={}) |
| Build the atomic retarded Green's function on a real-frequency mesh directly from a solved diagonalization problem. | |
| template<bool Complex> | |
| block_gf< refreq > | triqs::atom_diag::atomic_g_w (gf_lehmann_t< Complex > const &lehmann, gf_struct_t const &gf_struct, refreq const &mesh, double broadening=0) |
| Build the atomic retarded Green's function on a real-frequency mesh from a precomputed Lehmann representation. | |
| template<bool Complex> | |
| double | triqs::atom_diag::partition_function (atom_diag< Complex > const &atom, double beta) |
| Compute the atomic partition function at inverse temperature \( \beta \). | |
| template<bool Complex> | |
| std::vector< std::vector< quantum_number_t > > | triqs::atom_diag::quantum_number_eigenvalues (typename atom_diag< Complex >::many_body_op_t const &op, atom_diag< Complex > const &atom) |
| Tabulate the eigenvalues \( q_{B,i} = \langle B,i\,|\,\hat Q\,|\,B,i\rangle \) of a quantum-number operator \( \hat Q \) over all eigenstates of the Hamiltonian. | |
| template<bool Complex> | |
| std::vector< std::vector< quantum_number_t > > | triqs::atom_diag::quantum_number_eigenvalues_checked (typename atom_diag< Complex >::many_body_op_t const &op, atom_diag< Complex > const &atom) |
| Tabulate the eigenvalues \( q_{B,i} \) of a quantum-number operator \( \hat Q \), also checking that the operator is diagonal in the eigenbasis. | |
| template<bool Complex> | |
| atom_diag< Complex >::scalar_t | triqs::atom_diag::trace_rho_op (typename atom_diag< Complex >::block_matrix_t const &density_matrix, typename atom_diag< Complex >::many_body_op_t const &op, atom_diag< Complex > const &atom) |
| Compute the trace of a many-body operator weighted by a block-diagonal density matrix. | |
| using triqs::atom_diag::excluded_states_t = std::vector<std::pair<int, int>> |
#include <triqs/atom_diag/gf.hpp>
List of excluded eigenstates.
Given as \( (B, i) \) pairs (subspace index \( B \) and eigenstate index \( i \) inside the subspace, with \( 0 \le i < \dim(B) \)). Excluded states do not contribute to the Lehmann sum.
| using triqs::atom_diag::gf_lehmann_t = std::vector<matrix<gf_scalar_lehmann_t<Complex>>> |
#include <triqs/atom_diag/gf.hpp>
Lehmann representation of a block matrix-valued Green's function.
Outer list indexed by Green's-function block (per gf_struct), inner matrix indexed by orbital pair (a, b) inside the block; each matrix entry is the Lehmann representation of \( G_{ab}(z) \) for the corresponding orbital pair.
| using triqs::atom_diag::gf_scalar_lehmann_t = std::vector<std::pair<double, typename atom_diag<Complex>::scalar_t>> |
#include <triqs/atom_diag/gf.hpp>
Lehmann representation of a single matrix element of the Green's function.
A list of pole and residue pairs with pole
\[ p = E_{B',j} - E_{B,i} \]
and residue
\[ r_ p = \bigl(e^{-\beta E_{B,i}} + \eta\, e^{-\beta E_{B',j}}\bigr) \langle B, i\,|\, \hat c_a \,|\, B', j\rangle \langle B', j\,|\, \hat c_b^\dagger \,|\, B, i\rangle / Z \]
.
| atom_diag< Complex >::full_hilbert_space_state_t triqs::atom_diag::act | ( | typename atom_diag< Complex >::many_body_op_t const & | op, |
| typename atom_diag< Complex >::full_hilbert_space_state_t const & | st, | ||
| atom_diag< Complex > const & | atom ) |
#include <triqs/atom_diag/functions.hpp>
Act with a many-body operator on a state vector, \( |\psi'\rangle = \hat O\, |\psi\rangle \).
Both the input and the output state are vectors in the full Hilbert space expressed in the eigenbasis of the Hamiltonian. The operator is converted internally into its block-matrix representation in the eigenbasis before being applied to the state. Block-wise, for every source subspace \( B \) with target subspace \( B' \),
\[ \psi'_{B'} \mathrel{+}= O_{B' \leftarrow B}\, \psi_{B}. \]
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| op | Many-body operator to apply. |
| st | Input state vector in the full Hilbert space, expressed in the eigenbasis of the Hamiltonian. |
| atom | Solved diagonalization problem providing the eigenbasis. |
| atom_diag< Complex >::block_matrix_t triqs::atom_diag::atomic_density_matrix | ( | atom_diag< Complex > const & | atom, |
| double | beta ) |
#include <triqs/atom_diag/functions.hpp>
Compute the atomic density matrix at inverse temperature \( \beta \).
Returns the Gibbs density matrix \( \hat\rho = e^{-\beta \hat H} / Z \) as a block-diagonal matrix, with one diagonal block per invariant subspace \( B \). The density matrix is expressed in the eigenbasis, hence each block is itself diagonal,
\[ \rho_B = \mathrm{diag}\!\Bigl( e^{-\beta E_{B,i}} / Z \Bigr)_{i=0}^{\dim(B)-1}. \]
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| atom | Solved diagonalization problem. |
| beta | Inverse temperature \( \beta > 0 \). |
Definition at line 51 of file functions.cpp.
| block_gf< imfreq > triqs::atom_diag::atomic_g_iw | ( | atom_diag< Complex > const & | atom, |
| double | beta, | ||
| gf_struct_t const & | gf_struct, | ||
| int | n_iw, | ||
| excluded_states_t const & | excluded_states = {} ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic Matsubara Green's function directly from a solved diagonalization problem.
Internally builds the Lehmann representation and evaluates
\[ G(i\omega) = \sum_p \frac{r_p}{i\omega - p} \]
on the requested mesh.
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| atom | Solved diagonalization problem. |
| beta | Inverse temperature \( \beta > 0 \). |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| n_iw | Number of positive Matsubara frequencies. |
| excluded_states | Eigenstates to exclude from the Lehmann sum, as \( (B, i) \) pairs. |
| block_gf< imfreq > triqs::atom_diag::atomic_g_iw | ( | gf_lehmann_t< Complex > const & | lehmann, |
| gf_struct_t const & | gf_struct, | ||
| imfreq const & | mesh ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic Matsubara Green's function from a precomputed Lehmann representation.
For each \( (p, r_p) \) in the Lehmann representation, the evaluator is
\[ G(i\omega) = \sum_p \frac{r_p}{i\omega - p}. \]
| Complex | Type of the Lehmann residues (real or complex). |
| lehmann | Lehmann representation of the Green's function. |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| mesh | Matsubara mesh used to evaluate the Green's function. |
| block_gf< legendre > triqs::atom_diag::atomic_g_l | ( | atom_diag< Complex > const & | atom, |
| double | beta, | ||
| gf_struct_t const & | gf_struct, | ||
| int | n_l, | ||
| excluded_states_t const & | excluded_states = {} ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic Green's function in the Legendre basis directly from a solved diagonalization problem.
Internally builds the Lehmann representation and evaluates the corresponding Legendre coefficients
\[ G_\ell = \sqrt{2\ell + 1}\, \int_0^\beta d\tau\, P_\ell(2\tau/\beta - 1)\, G(\tau) \;. \]
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| atom | Solved diagonalization problem. |
| beta | Inverse temperature \( \beta > 0 \). |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| n_l | Number of Legendre coefficients to compute. |
| excluded_states | Eigenstates to exclude from the Lehmann sum, as \( (B, i) \) pairs. |
| block_gf< legendre > triqs::atom_diag::atomic_g_l | ( | gf_lehmann_t< Complex > const & | lehmann, |
| gf_struct_t const & | gf_struct, | ||
| legendre const & | mesh ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic Green's function in the Legendre basis from a precomputed Lehmann representation.
The Legendre coefficients are obtained from the imaginary-time form by the standard projection
\[ G_\ell = \sqrt{2\ell + 1}\, \int_0^\beta d\tau\, P_\ell(2\tau/\beta - 1)\, G(\tau) \;. \]
| Complex | Type of the Lehmann residues (real or complex). |
| lehmann | Lehmann representation of the Green's function. |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| mesh | Legendre mesh used to evaluate the Green's function. |
| gf_lehmann_t< Complex > triqs::atom_diag::atomic_g_lehmann | ( | atom_diag< Complex > const & | atom, |
| double | beta, | ||
| gf_struct_t const & | gf_struct, | ||
| excluded_states_t | excluded_states = {} ) |
#include <triqs/atom_diag/gf.hpp>
Build the Lehmann representation of the atomic Green's function.
Iterates over every pair of eigenstates \( (B, i) \), \( (B', j) \) of the Hamiltonian (subject to the non-zero connection constraint) and collects all non-vanishing pole - residue pairs \( (p, r_p) \). The resulting structure can then be evaluated on any of the supported target meshes via the corresponding builders.
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| atom | Solved diagonalization problem. |
| beta | Inverse temperature \( \beta > 0 \). |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| excluded_states | Eigenstates to exclude from the Lehmann sum, as \( (B, i) \) pairs. |
| block_gf< imtime > triqs::atom_diag::atomic_g_tau | ( | atom_diag< Complex > const & | atom, |
| double | beta, | ||
| gf_struct_t const & | gf_struct, | ||
| int | n_tau, | ||
| excluded_states_t const & | excluded_states = {} ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic imaginary-time Green's function directly from a solved diagonalization problem.
Internally builds the Lehmann representation and evaluates it on the requested mesh,
\[ G(\tau) = \sum_p r_p \, \frac{-e^{-\tau p}}{1 + e^{-\beta p}}, \quad \tau \in [0, \beta]. \]
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| atom | Solved diagonalization problem. |
| beta | Inverse temperature \( \beta > 0 \). |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| n_tau | Number of imaginary-time points. |
| excluded_states | Eigenstates to exclude from the Lehmann sum, as \( (B, i) \) pairs. |
| block_gf< imtime > triqs::atom_diag::atomic_g_tau | ( | gf_lehmann_t< Complex > const & | lehmann, |
| gf_struct_t const & | gf_struct, | ||
| imtime const & | mesh ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic imaginary-time Green's function from a precomputed Lehmann representation.
For each \( (p, r_p) \) in the Lehmann representation, the fermionic imaginary-time evaluator is
\[ G(\tau) = \sum_p r_p \, \frac{-e^{-\tau p}}{1 + e^{-\beta p}}, \quad \tau \in [0, \beta]. \]
| Complex | Type of the Lehmann residues (real or complex). |
| lehmann | Lehmann representation of the Green's function. |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| mesh | Imaginary-time mesh used to evaluate the Green's function. |
| block_gf< refreq > triqs::atom_diag::atomic_g_w | ( | atom_diag< Complex > const & | atom, |
| double | beta, | ||
| gf_struct_t const & | gf_struct, | ||
| std::pair< double, double > const & | energy_window, | ||
| int | n_w, | ||
| double | broadening = 0, | ||
| excluded_states_t const & | excluded_states = {} ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic retarded Green's function on a real-frequency mesh directly from a solved diagonalization problem.
Internally builds the Lehmann representation, constructs a real-frequency mesh from the requested energy window and number of frequency points, and evaluates
\[ G(\omega) = \sum_p \frac{r_p}{\omega + i\eta - p} \; , \]
with the broadening \( \eta \).
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| atom | Solved diagonalization problem. |
| beta | Inverse temperature \( \beta > 0 \). |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| energy_window | Energy window \( (\omega_{\text{min}}, \omega_{\text{max}}) \) of the real-frequency mesh. |
| n_w | Number of frequency points. |
| broadening | Lorentzian broadening \( \eta \) of the spectrum (small positive imaginary-frequency shift). |
| excluded_states | Eigenstates to exclude from the Lehmann sum, as \( (B, i) \) pairs. |
| block_gf< refreq > triqs::atom_diag::atomic_g_w | ( | gf_lehmann_t< Complex > const & | lehmann, |
| gf_struct_t const & | gf_struct, | ||
| refreq const & | mesh, | ||
| double | broadening = 0 ) |
#include <triqs/atom_diag/gf.hpp>
Build the atomic retarded Green's function on a real-frequency mesh from a precomputed Lehmann representation.
For each \( (p, r_p) \) in the Lehmann representation, the retarded evaluator is
\[ G(\omega) = \sum_p \frac{r_p}{\omega + i\eta - p} \; , \]
with the broadening \( \eta \).
| Complex | Type of the Lehmann residues (real or complex). |
| lehmann | Lehmann representation of the Green's function. |
| gf_struct | Block structure of the Green's function: block name -> list of inner indices. |
| mesh | Real-frequency mesh used to evaluate the Green's function. |
| broadening | Lorentzian broadening \( \eta \) of the spectrum (small positive imaginary-frequency shift). |
| double triqs::atom_diag::partition_function | ( | atom_diag< Complex > const & | atom, |
| double | beta ) |
#include <triqs/atom_diag/functions.hpp>
Compute the atomic partition function at inverse temperature \( \beta \).
Sums the Boltzmann weights of all eigenstates of the Hamiltonian,
\[ Z = \sum_{B} \sum_{i=0}^{\dim(B)-1} e^{-\beta E_{B,i}}, \]
where the eigenvalues \( E_{B,i} \) are taken with respect to the ground-state energy as zero.
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| atom | Solved diagonalization problem. |
| beta | Inverse temperature \( \beta > 0 \). |
Definition at line 42 of file functions.cpp.
| std::vector< std::vector< quantum_number_t > > triqs::atom_diag::quantum_number_eigenvalues | ( | typename atom_diag< Complex >::many_body_op_t const & | op, |
| atom_diag< Complex > const & | atom ) |
#include <triqs/atom_diag/functions.hpp>
Tabulate the eigenvalues \( q_{B,i} = \langle B,i\,|\,\hat Q\,|\,B,i\rangle \) of a quantum-number operator \( \hat Q \) over all eigenstates of the Hamiltonian.
Assumes that \( \hat Q \) is a quantum number, i.e. that it commutes with \( \hat H \) and is therefore block-diagonal in the eigenbasis with diagonal blocks. The diagonal entries are returned, grouped by invariant subspace \( B \). Use quantum_number_eigenvalues_checked for a variant that explicitly verifies the block-diagonal property.
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| op | Observable operator; expected to be a quantum number (otherwise an exception is raised). |
| atom | Solved diagonalization problem. |
| std::vector< std::vector< quantum_number_t > > triqs::atom_diag::quantum_number_eigenvalues_checked | ( | typename atom_diag< Complex >::many_body_op_t const & | op, |
| atom_diag< Complex > const & | atom ) |
#include <triqs/atom_diag/functions.hpp>
Tabulate the eigenvalues \( q_{B,i} \) of a quantum-number operator \( \hat Q \), also checking that the operator is diagonal in the eigenbasis.
Same as quantum_number_eigenvalues, but also verifies that the supplied operator is diagonal in the eigenbasis of the Hamiltonian. If it is not, an exception is raised. Useful when constructing a quantum number from scratch and one wants to confirm that it really is a conserved quantity of atom.
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| op | Observable operator; expected to be a quantum number (otherwise an exception is raised). |
| atom | Solved diagonalization problem. |
| atom_diag< Complex >::scalar_t triqs::atom_diag::trace_rho_op | ( | typename atom_diag< Complex >::block_matrix_t const & | density_matrix, |
| typename atom_diag< Complex >::many_body_op_t const & | op, | ||
| atom_diag< Complex > const & | atom ) |
#include <triqs/atom_diag/functions.hpp>
Compute the trace of a many-body operator weighted by a block-diagonal density matrix.
Evaluates
\[ \mathrm{Tr}\,(\hat\rho\, \hat O) = \sum_{B} \mathrm{Tr}\,(\rho_B\, O_{BB}), \]
where \( \hat\rho \) is provided as a list of diagonal blocks (one per invariant subspace of atom) and only the diagonal blocks \( O_{BB} \) of \( \hat O \) contribute. Useful for computing expectation values of arbitrary observables once a density matrix has been built.
| Complex | Specialization of the diagonalization problem (real or complex Hamiltonian). |
| density_matrix | Density matrix as a list of diagonal blocks, indexed by subspace index \( B \). |
| op | Operator to be averaged. |
| atom | Solved diagonalization problem. |
Definition at line 70 of file functions.cpp.