Class Scine::Utils::DensityMatrix

class DensityMatrix

Class defining a density matrix for use in electronic structure calculation methods. Is adequate for both restricted and unrestricted formulations. Allows for an easy transfer of density matrices between different instances of a quantum chemical method. There is no overhead if only the restricted formulation is needed.

Accessors to the matrix elements.

Using template functions to allow perfect forwarding to the Eigen functions.

Arithmetic operations

In the case of functions for pairs of density matrices, the precondition is that they both have the same size and are either RHF-RHF or UHF-UHF.

Public Functions

void setDensity(Matrix &&restrictedMatrix, int nElectrons)

Set the restricted density matrix. If in unrestricted mode, the alpha and beta density are set to half each.

void setDensity(Matrix &&alphaMatrix, Matrix &&betaMatrix, int nAlphaElectrons, int nBetaElectrons)

Set the unrestricted density matrices. The “total” density matrix is automatically updated.

void setUnrestricted(bool b)

Set whether the unrestricted formalism is to use.

bool unrestricted() const

Get whether the unrestricted formalism is used.

bool restricted() const

Get whether the restricted formalism is used.

void setAlphaAndBetaFromRestrictedDensity()

Resizes the alpha and beta density matrices and sets them each to half the full density matrix.

void resize(int nAOs)

Set the size of the matrices (number of atomic orbitals)

int numberElectrons() const

Returns the total number of electrons in the density matrix. Integer version of getOccupation().

int numberElectronsInAlphaMatrix() const

Return the number of electrons corresponding to the alpha density matrix. Integer version of getAlphaOccupation().

int numberElectronsInBetaMatrix() const

Return the number of electrons corresponding to the beta density matrix. Integer version of getBetaOccupation().