ergo
mat::TC2 Class Reference

Trace correcting purification. More...

#include <TC2.h>

List of all members.

Classes

class  Fun
 Help class for bisection root finding calls. More...

Public Member Functions

 TC2 (Tmatrix &F, Tmatrix &DM, const int size, const int noc, const Treal trunc=0, const int maxmm=100)
 Constructor Initializes everything.
Treal fermi_level (Treal tol=1e-15) const
 Returns the Fermi level.
Treal homo (Treal tol=1e-15) const
 Returns upper bound of the HOMO eigenvalue.
Treal lumo (Treal tol=1e-15) const
 Returns lower bound of the LUMO eigenvalue.
int n_multiplies () const
 Returns the number of used matrix matrix multiplications.
void print_data (int const start, int const stop) const
virtual ~TC2 ()
 Destructor.

Protected Member Functions

void purify ()
 Runs purification.

Protected Attributes

Tmatrix & X
 Fock / Kohn-Sham matrix at initialization.
Tmatrix & D
 Density matrix after purification.
const int n
 System size.
const int nocc
 Number of occupied orbitals.
const Treal frob_trunc
 Threshold for the truncation.
const int maxmul
 Number of tolerated matrix multiplications.
Treal lmin
 Lower bound for eigenvalue spectrum.
Treal lmax
 Upper bound for eigenvalue spectrum.
int nmul
 Number of used matrix multiplications.
int nmul_firstpart
 Number of used matrix multiplications in the first part of the purification.
Treal * idemerror
 Upper bound of euclidean norm ||D-D^2||_2 before each step.
Treal * tracediff
 The difference between the trace of the matrix and the number of occupied orbitals before each step.
int * polys
 Choices of polynomials 0 for x^2 and 1 for 2x-x^2 Length: nmul.

Detailed Description

Trace correcting purification.

This template instantiates the trace correcting purification algorithm developed by Niklasson [Phys. Rev. B 66, 155115 (2002)] with modifications by Rubensson and Rudberg [unpublished]. The template can be used with any matrix class Tmatrix that has the following member functions:

  • gersgorin(Treal&, Treal&) const
  • add_identity(Treal)
  • operator*=(Treal)
  • operator=(Tmatrix const &)
  • trace() const
  • frob_thresh(Treal)

The matrix class should also support the following syntax:

  • A = alpha * B * B
  • A = alpha * B * B + beta * A

where A and B are of type Tmatrix and alpha and beta are of type Treal.


Constructor & Destructor Documentation

mat::TC2::TC2 ( Tmatrix &  F,
Tmatrix &  DM,
const int  size,
const int  noc,
const Treal  trunc = 0,
const int  maxmm = 100 
)

Constructor Initializes everything.

Constructor.

< Run purification

Parameters:
FFock/Kohn-Sham matrix (input/workspace)
DMDensity matrix (output)
sizeSystem size (Number of basis functions)
nocNumber of occupied orbitals.
truncThreshold for truncation in Frobenius norm.
maxmmMaximum aloud number of mm-multiplications.

References frob_trunc, nocc, maxmul, X, lmin, lmax, D, idemerror, tracediff, polys, and purify().

virtual mat::TC2::~TC2 ( ) [inline, virtual]

Destructor.

References idemerror, tracediff, and polys.


Member Function Documentation

Treal mat::TC2::fermi_level ( Treal  tol = 1e-15) const

Returns the Fermi level.

Run after call to purify().

Parameters:
tolFault-tolerance for result.

References mat::bisection().

Treal mat::TC2::homo ( Treal  tol = 1e-15) const

Returns upper bound of the HOMO eigenvalue.

Run after call to purify().

Parameters:
tolFault-tolerance for result.

References template_blas_sqrt(), and mat::bisection().

Treal mat::TC2::lumo ( Treal  tol = 1e-15) const

Returns lower bound of the LUMO eigenvalue.

Run after call to purify().

Parameters:
tolFault-tolerance for result.

References template_blas_sqrt(), and mat::bisection().

int mat::TC2::n_multiplies ( ) const [inline]

Returns the number of used matrix matrix multiplications.

References nmul.

void mat::TC2::print_data ( int const  start,
int const  stop 
) const
void mat::TC2::purify ( ) [protected]

Runs purification.

Run by constructor.

References template_blas_sqrt().

Referenced by TC2().


Member Data Documentation

Tmatrix& mat::TC2::D [protected]

Density matrix after purification.

Referenced by TC2().

const Treal mat::TC2::frob_trunc [protected]

Threshold for the truncation.

Referenced by TC2().

Treal* mat::TC2::idemerror [protected]

Upper bound of euclidean norm ||D-D^2||_2 before each step.

This means: idemerror[i] = norm(D[i]-D[i]^2) where D[0] is the initial matrix and D[i] is the matrix after i steps in the purification. This value is calculated after the step since D[i]^2 or 2D[i] - D[i]^2 is needed. Length: nmul

Referenced by ~TC2(), and TC2().

Treal mat::TC2::lmax [protected]

Upper bound for eigenvalue spectrum.

Referenced by TC2().

Treal mat::TC2::lmin [protected]

Lower bound for eigenvalue spectrum.

Referenced by TC2().

const int mat::TC2::maxmul [protected]

Number of tolerated matrix multiplications.

Referenced by TC2().

const int mat::TC2::n [protected]

System size.

int mat::TC2::nmul [protected]

Number of used matrix multiplications.

Referenced by n_multiplies().

int mat::TC2::nmul_firstpart [protected]

Number of used matrix multiplications in the first part of the purification.

const int mat::TC2::nocc [protected]

Number of occupied orbitals.

Referenced by TC2().

int* mat::TC2::polys [protected]

Choices of polynomials 0 for x^2 and 1 for 2x-x^2 Length: nmul.

Referenced by ~TC2(), and TC2().

Treal* mat::TC2::tracediff [protected]

The difference between the trace of the matrix and the number of occupied orbitals before each step.

Length: nmul + 1

Referenced by ~TC2(), and TC2().

Tmatrix& mat::TC2::X [protected]

Fock / Kohn-Sham matrix at initialization.

Then used as workspace by purify(). Empty after call to purify().

Referenced by TC2().


The documentation for this class was generated from the following file: