File DensityMatrix.h¶
- Copyright
This code is licensed under the 3-clause BSD license.
Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.
See LICENSE.txt for details.
-
namespace
Scine
This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.
This header contains alias definitions defining which classes to use for the different degrees of derivatives.
-
namespace
Utils
-
class
DensityMatrix
- #include <DensityMatrix.h>
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 underlying matrices by const reference. @{
-
const DensityMatrix::Matrix &
restrictedMatrix
() const¶
-
const DensityMatrix::Matrix &
alphaMatrix
() const¶
-
const DensityMatrix::Matrix &
betaMatrix
() const¶
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.
-
DensityMatrix &
operator+=
(const DensityMatrix &rhs)¶
-
DensityMatrix
operator+
(const DensityMatrix &rhs) const¶
-
DensityMatrix &
operator-=
(const DensityMatrix &rhs)¶
-
DensityMatrix
operator-
(const DensityMatrix &rhs) const¶
-
DensityMatrix &
operator*=
(double f)¶
-
DensityMatrix
operator*
(double f)¶
Public Types
-
using
Matrix
= Eigen::MatrixXd¶
Public Functions
-
DensityMatrix
()¶
-
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().
-
double
getOccupation
() const¶
-
double
getAlphaOccupation
() const¶
-
double
getBetaOccupation
() const¶
Private Members
-
SpinAdaptedMatrix
matrix_
¶
-
bool
unrestricted_
= false¶ true if the alpha and beta densities are needed and were set.
-
double
alphaOccupation_
= 0.0¶
-
double
betaOccupation_
= 0.0¶
-
const DensityMatrix::Matrix &
-
class
-
namespace