ergo
rho-mat.cc File Reference
#include <string.h>
#include <stdio.h>
#include "realtype.h"
#include "mat_gblas.h"
#include "rho-mat.h"

Macros

#define restrict
 

Typedefs

typedef ergo_real real
 

Functions

static void zeroorbs (real *tmp, const int *nblocks, const int(*iblocks)[2], int ldaib, int nvclen)
 helper function for zeroing only used blocks of orbitals. More...
 
void getrho_blocked_lda (int nbast, const real *dmat, const real *restrict gao, const int *nblocks, const int(*iblocks)[2], int ldaib, real *tmp, int nvclen, real *rho)
 Computes the expectation value <o|dmat|o'> for a symmetric matrix and given set of precomputed orbital values gao. More...
 
void getrho_blocked_gga (int nbast, const real *dmat, const real *restrict gao, const int *nblocks, const int(*iblocks)[2], int ldaib, real *tmp, int nvclen, real *rho, real(*grad)[3])
 Computes the expectation value <o|dmat|o'> and its derivatives for a symmetric matrix and given set of precomputed orbital values and their cartesian derivatives gao. More...
 
void getexp_blocked_lda (int nbast, const real *dmat, const real *gao, const int *nblocks, const int(*iblocks)[2], int ldaib, real *tmp, int nvclen, real *rho)
 Computes the expectation value <o|dmat|o'> for a nonsymmetric matrix and given set of precomputed orbital values gao. More...
 
void getexp_blocked_gga (int nbast, const real *dmat, const real *gao, const int *nblocks, const int(*iblocks)[2], int ldaib, real *tmp, int nvclen, real(*rgrad)[4])
 Computes the expectation value <o|dmat|o'> and its derivatives for a nonsymmetric matrix and given set of precomputed orbital values and their cartesian derivatives gao. More...
 

Detailed Description

Functions for density and gradient evaluation. The density can be evaluated at entire batches of grid points.

Macro Definition Documentation

◆ restrict

#define restrict

Typedef Documentation

◆ real

typedef ergo_real real

Function Documentation

◆ getexp_blocked_gga()

void getexp_blocked_gga ( int  nbast,
const real dmat,
const real gao,
const int *  nblocks,
const int(*)  iblocks[2],
int  ldaib,
real tmp,
int  nvclen,
real(*)  rgrad[4] 
)

Computes the expectation value <o|dmat|o'> and its derivatives for a nonsymmetric matrix and given set of precomputed orbital values and their cartesian derivatives gao.

Sparsity of gao as determined with help of nblocks and iblocks is used to reduce the computational effort.

Parameters
dmatfull square symmetric matrix
nbastsize of dmat
gaoorbital matrix[4][nbast][nvclen]. First block [0][][] contains orbital values. Subsequent blocks - orbital derivatives wrt x,y, and z coordinates. Set values are determied by nblocks and iblocks, other values shall not be accessed.
nblocksnumber of nonzero row blocks in gao
iblocksranges [a,b) of nonzero blocks in gao.
ldaibnot used
tmptemporary matrix [nbast][nvclen]
nvclenbatch length - number of columns in gao.
rgrada vector of quartets where the computed expectation values and gradient values will be stored.

References zeroorbs().

◆ getexp_blocked_lda()

void getexp_blocked_lda ( int  nbast,
const real dmat,
const real gao,
const int *  nblocks,
const int(*)  iblocks[2],
int  ldaib,
real tmp,
int  nvclen,
real rho 
)

Computes the expectation value <o|dmat|o'> for a nonsymmetric matrix and given set of precomputed orbital values gao.

Sparsity of gao as determined with help of nblocks and iblocks is used to reduce the computational effort.

Parameters
dmatfull square symmetric matrix
nbastsize of dmat
gaoorbital matrix[nbast][nvclen]. Set values are determied by nblocks and iblocks, other values shall not be accessed.
nblocksnumber of nonzero row blocks in gao
iblocksranges [a,b) of nonzero blocks in gao.
ldaibnot used
tmptemporary matrix [nbast][nvclen]
nvclenbatch length - number of columns in gao.
rhothe vector[nvclen] where the computed expectation values will be stored.

References zeroorbs().

Referenced by lin_resp_cb_b_lda().

◆ getrho_blocked_gga()

void getrho_blocked_gga ( int  nbast,
const real dmat,
const real *restrict  gao,
const int *  nblocks,
const int(*)  iblocks[2],
int  ldaib,
real tmp,
int  nvclen,
real rho,
real(*)  grad[3] 
)

Computes the expectation value <o|dmat|o'> and its derivatives for a symmetric matrix and given set of precomputed orbital values and their cartesian derivatives gao.

Sparsity of gao as determined with help of nblocks and iblocks is used to reduce the computational effort.

Parameters
dmatfull square symmetric matrix
nbastsize of dmat
gaoorbital matrix[4][nbast][nvclen]. First block [0][][] contains orbital values. Subsequent blocks - orbital derivatives wrt x,y, and z coordinates. Set values are determied by nblocks and iblocks, other values shall not be accessed.
nblocksnumber of nonzero row blocks in gao
iblocksranges [a,b) of nonzero blocks in gao.
ldaibnot used
tmptemporary matrix [nbast][nvclen]
nvclenbatch length - number of columns in gao.
rhothe vector[nvclen] where the computed expectation values will be stored.
grada vector of triples where the computed gradient values will be stored.

References mat::gemm(), ONER, restrict, and zeroorbs().

Referenced by dft_integrate(), and integrate_density_and_energy().

◆ getrho_blocked_lda()

void getrho_blocked_lda ( int  nbast,
const real dmat,
const real *restrict  gao,
const int *  nblocks,
const int(*)  iblocks[2],
int  ldaib,
real tmp,
int  nvclen,
real rho 
)

Computes the expectation value <o|dmat|o'> for a symmetric matrix and given set of precomputed orbital values gao.

Sparsity of gao as determined with help of nblocks and iblocks is used to reduce the computational effort.

Parameters
dmatfull square symmetric matrix
nbastsize of dmat
gaoorbital matrix[nbast][nvclen]. Set values are determied by nblocks and iblocks, other values shall not be accessed.
nblocksnumber of nonzero row blocks in gao
iblocksranges [a,b) of nonzero blocks in gao.
ldaibnot used
tmptemporary matrix [nbast][nvclen]
nvclenbatch length - number of columns in gao.
rhothe vector[nvclen] where the computed expectation values will be stored.

References mat::gemm(), ONER, restrict, mat::symm(), and zeroorbs().

Referenced by dft_integrate(), and integrate_density_and_energy().

◆ zeroorbs()

static void zeroorbs ( real tmp,
const int *  nblocks,
const int(*)  iblocks[2],
int  ldaib,
int  nvclen 
)
static

helper function for zeroing only used blocks of orbitals.

Selected values for the first index are looped over, and all allowed values of the second index.

Parameters
tmpthe matrix[nbast][nvclen]
nblockspointer to an integer containing number of nonzero orbital blocks.
iblocksa set of nblocks integer pairs [a,b) defining the range of first index to be zeroed.
ldaibnot used
nvclenbatch length - and the second dimension of tmp.

Referenced by getexp_blocked_gga(), getexp_blocked_lda(), getrho_blocked_gga(), and getrho_blocked_lda().