Template Class fdmBackwardIteration#

Class Documentation#

template<typename nrgcore_type>
class fdmBackwardIteration#

Propagates the reduced density matrix through backward NRG iterations.

This helper class tracks the kept/discarded state indices for the current Wilson shell and builds the density matrix used to evaluate FDM-based spectral quantities such as local Green’s functions and static responses.

Template Parameters:

nrgcore_type – Type of the underlying NRG core object.

Public Functions

inline explicit fdmBackwardIteration(nrgcore_type *t_nrgObject)#

Construct an FDM backward-iteration helper for a given NRG core.

Parameters:

t_nrgObject – Pointer to the NRG model state used for the current calculation.

inline void setup(nrgcore_type *t_nrgObject)#

Bind the helper to a specific NRG core object.

This resets the iteration state to the initial backward-iteration regime and prepares the object to work with the supplied model data.

Parameters:

t_nrgObject – Pointer to the NRG core object.

inline void calcSpectrum(double energyScale)#

Compute the density-matrix ingredients for the current shell.

The routine updates the kept-state index set, reconstructs the density matrix for the current shell, and reduces it to the impurity sector in the order required for the backward iteration.

Parameters:

energyScale – Retained for API compatibility; density-matrix weights are constructed from the shell data held by this object.

inline void setReduceDensityMatrix()#

Build the reduced density matrix for the impurity sector.

The full density matrix is rotated into the instantaneous eigenbasis and then traced over the bath degrees of freedom to produce the reduced density matrix stored in reducedRho for the current shell.

inline void setLocalPartitionFunction()#

Compute the local partition function and ground-state energy.

The routine identifies the lowest-energy state in each shell and assigns Boltzmann weights to the states that are considered degenerate within the numerical tolerance defined by energyErrorBar.

inline auto rhoDotStaticOperators(std::vector<qOperator> *bOperator)#

Contract the density matrix with a set of static operators.

Parameters:

bOperator – Pointer to the operator set used in the contraction.

Returns:

Vector of scalar traces \(\mathrm{Tr}[\rho B]\) for each operator.

inline void setRhoZero(const std::vector<std::vector<double>> &tBoltzmannFactor)#

Construct the density matrix from a provided set of Boltzmann factors.

The discarded states are filled with the supplied weights while the kept states are overwritten with the reduced density matrix from the previous Wilson shell whenever the backward iteration is not in the final step.

Parameters:

tBoltzmannFactor – Boltzmann factors of the form \(\exp(-\beta E_n)\) for each shell state.

inline void setRhoZero()#

Construct the density matrix using the internally stored Boltzmann factors and reduced density matrix.

This overload is used when the class has already computed the local partition function in the current shell.

inline void setTemperature(double mkBT)#

Set the temperature used for the calculation.

Parameters:

mkBT – Temperature in the same units as the NRG energy scale.

inline void setCurrentIndex()#

Update the kept states for the current shell.

The implementation reuses the previous kept-state set during later iterations and initializes an empty set when the current shell is the last one in the backward pass.

inline void clearKeptIndex()#

Reset the stored shell information and clear the density-matrix cache.

This is useful when restarting the backward iteration from the final shell.

Public Members

nrgcore_type *nrgObject#

Pointer to the active NRG core object used by the backward iteration.

double kBT = {0}#

Temperature of the NRG system in the FDM formalism.

std::vector<std::vector<size_t>> currentKeptIndex#

Kept-state indices for the current Wilson shell.

std::vector<qmatrix<>> rhoZero#

Density matrices for the current shell in the active basis.

bool lastiteration = {true}#

True when the current shell is the final backward-iteration step.

double energyErrorBar = {1e-5}#

Numerical tolerance used when identifying degenerate shell states.