ERKALE
ERKALE - DFT from Hel
 All Classes Functions Variables Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AngularGrid Class Reference

Angular integration grid on a radial shell of an atom. More...

#include <dftgrid.h>

Inheritance diagram for AngularGrid:
CasidaShell

Public Member Functions

 AngularGrid (bool lobatto=false)
 
 ~AngularGrid ()
 Destructor.
 
void set_basis (const BasisSet &basis)
 Set basis set.
 
void set_grid (const angshell_t &shell)
 Set radial shell.
 
std::vector< gridpoint_tget_grid () const
 Get the quadrature grid.
 
void check_grad_lapl (int x_func, int c_func)
 Check necessity of computing gradient and laplacians, necessary for compute_bf!
 
void get_grad_lapl (bool &grad, bool &lapl) const
 Get necessity of computing gradient and laplacians.
 
void set_grad_lapl (bool grad, bool lapl)
 Set necessity of computing gradient and laplacians, necessary for compute_bf!
 
void set_hess_lgrad (bool hess, bool lgrad)
 Set necessity of computing Hessian and gradient of Laplacian.
 
angshell_t construct ()
 Construct a fixed size grid.
 
angshell_t construct (const arma::mat &P, double ftol, int x_func, int c_func)
 Construct adaptively a grid centered on the cenind:th center, restricted calculation.
 
angshell_t construct (const arma::mat &Pa, const arma::mat &Pb, double ftol, int x_func, int c_func)
 Construct adaptively a grid centered on the cenind:th center, unrestricted calculation.
 
angshell_t construct (const arma::cx_vec &C, double ftol, int x_func, int c_func)
 Construct adaptively a grid centered on the cenind:th center, SIC calculation.
 
angshell_t construct_becke (double otol)
 Construct a dummy grid that is only meant for the overlap matrix (Becke charges)
 
angshell_t construct_hirshfeld (const Hirshfeld &Hirsh, double otol)
 Construct a dummy grid that is only meant for the overlap matrix (Hirshfeld charges)
 
void form_grid ()
 Form radial shell and compute basis functions.
 
void form_hirshfeld_grid (const Hirshfeld &hirsh)
 Form radial shell using Hirshfeld weights and compute basis functions.
 
void becke_weights (double a=0.7)
 
void hirshfeld_weights (const Hirshfeld &hirsh)
 Compute Hirshfeld weight for grid points.
 
void prune_points ()
 Prune points with small weight.
 
void compute_bf ()
 Compute basis functions on grid points.
 
void free ()
 Free memory.
 
arma::uvec screen_density (double thr=1e-10) const
 Screen wrt small density, returns list of points with nonnegligible values.
 
void update_density (const arma::mat &P)
 Update values of density, restricted calculation.
 
void update_density (const arma::mat &Pa, const arma::mat &Pb)
 Update values of density, unrestricted calculation.
 
void update_density (const arma::cx_vec &C)
 Update values of density, self-interaction correction.
 
void get_density (std::vector< dens_list_t > &list) const
 Get density list; used to determine isosurface values for orbital plots.
 
double compute_Nel () const
 Compute number of electrons.
 
void print_grid () const
 Print out grid information.
 
void print_density (FILE *f) const
 Print density information.
 
void print_potential (int func_id, FILE *f) const
 Print potential information.
 
void init_xc ()
 Initialize XC arrays.
 
void compute_xc (int func_id, bool pot)
 
double eval_Exc () const
 Evaluate exchange/correlation energy.
 
void init_VV10 (double b, double C, bool pot)
 Initialize VV10 calculation.
 
void collect_VV10 (arma::mat &data, std::vector< size_t > &idx, double b, double C, bool nl) const
 Collect VV10 data.
 
void compute_VV10 (const std::vector< arma::mat > &nldata, double b, double C)
 
arma::vec compute_VV10_F (const std::vector< arma::mat > &nldata, const std::vector< angshell_t > &nlgrids, double b, double C)
 Same thing, but also evaluate the grid contribution to the force.
 
void eval_overlap (arma::mat &S) const
 Evaluate atomic contribution to overlap matrix.
 
void eval_diag_overlap (arma::vec &S) const
 Evaluate diagonal elements of overlap matrix.
 
void eval_overlap (const arma::cx_mat &Cocc, size_t io, double k, arma::mat &S, double thr) const
 
void eval_overlap (const arma::cx_mat &Cocc, const arma::vec &Esi, double k, arma::mat &S, double thr) const
 Same thing, but do contraction over SI energies for derivatives.
 
void eval_tau_overlap (const arma::cx_mat &Cocc, double k, arma::mat &S, double thr) const
 
void eval_tau_overlap_deriv (const arma::cx_mat &Cocc, const arma::vec &Esi, double k, arma::mat &S, double thr) const
 Calculate the GGA and meta-GGA type terms for the derivative.
 
void eval_Fxc (arma::mat &H) const
 Evaluate Fock matrix, restricted calculation.
 
void eval_Fxc (arma::mat &Ha, arma::mat &Hb, bool beta=true) const
 Evaluate Fock matrix, unrestricted calculation.
 
void eval_diag_Fxc (arma::vec &H) const
 Evaluate diagonal elements of Fock matrix (for adaptive grid formation), restricted calculation.
 
void eval_diag_Fxc (arma::vec &Ha, arma::vec &Hb) const
 Evaluate diagonal elements of Fock matrix (for adaptive grid formation), unrestricted calculation.
 
void eval_diag_Fxc_SIC (arma::vec &H) const
 Evaluate diagonal elements of Fock matrix (for adaptive grid formation), unrestricted calculation.
 
arma::vec eval_force_r () const
 Evaluate force, restricted.
 
arma::vec eval_force_u () const
 Evaluate force, unrestricted.
 

Protected Member Functions

libxc_dens_t get_dens (size_t idx) const
 Get density data for wanted point.
 
libxc_pot_t get_pot (size_t idx) const
 Get potential data for wanted point.
 
libxc_debug_t get_data (size_t idx) const
 Get density and potential data for wanted point.
 
void lobatto_shell ()
 Add radial shell in Lobatto angular scheme, w/o Becke partitioning or pruning.
 
void lebedev_shell ()
 Add radial shell in Lebedev scheme, w/o Becke partitioning or pruning.
 
void update_shell_list ()
 Update list of important basis functions.
 
void get_weights ()
 Collect weights from grid into w array.
 

Protected Attributes

angshell_t info
 Shell info.
 
const BasisSetbasp
 Basis set pointer.
 
bool use_lobatto
 Use Lobatto quadrature? (Default is Lebedev)
 
std::vector< gridpoint_tgrid
 Integration points.
 
std::vector< size_t > pot_shells
 List of potentially important shells.
 
arma::uvec pot_bf_ind
 List of potentially important functions.
 
std::vector< size_t > shells
 List of important shells.
 
arma::uvec bf_i0
 Indices of first functions on shell.
 
arma::uvec bf_N
 Amount of functions on shell.
 
arma::uvec bf_ind
 List of important functions.
 
arma::uvec bf_potind
 List of important functions in potentials' list.
 
arma::rowvec w
 Duplicate values of weights here.
 
arma::mat bf
 Values of important functions in grid points, Nbf * Ngrid.
 
arma::mat bf_x
 x gradient
 
arma::mat bf_y
 y gradient
 
arma::mat bf_z
 z gradient
 
arma::mat bf_lapl
 Values of laplacians in grid points, (3*Nbf) * Ngrid.
 
arma::mat bf_hess
 Values of Hessians in grid points, (9*Nbf) * Ngrid; used for GGA force.
 
arma::mat bf_lx
 Values of x gradient of laplacian; used for MGGA force.
 
arma::mat bf_ly
 Values of y gradient of laplacian; used for MGGA force.
 
arma::mat bf_lz
 Values of z gradient of laplacian; used for MGGA force.
 
arma::mat Pv
 Density helper matrices: P_{uv} chi_v, and P_{uv} nabla(chi_v)
 
arma::mat Pv_x
 
arma::mat Pv_y
 
arma::mat Pv_z
 
arma::mat Pav
 Same for spin-polarized.
 
arma::mat Pav_x
 
arma::mat Pav_y
 
arma::mat Pav_z
 
arma::mat Pbv
 
arma::mat Pbv_x
 
arma::mat Pbv_y
 
arma::mat Pbv_z
 
bool do_grad
 Is gradient needed?
 
bool do_lapl
 Is laplacian needed?
 
bool do_hess
 Is Hessian needed? (For GGA force)
 
bool do_lgrad
 Is gradient of laplacian needed? (For MGGA force)
 
bool polarized
 Spin-polarized calculation?
 
bool do_gga
 GGA functional used? (Set in compute_xc, only affects eval_Fxc)
 
bool do_mgga
 Meta-GGA used? (Set in compute_xc, only affects eval_Fxc)
 
arma::mat rho
 Density, Nrho x Npts.
 
arma::vec exc
 Energy density, Npts.
 
arma::mat vxc
 Functional derivative of energy wrt electron density, Nrho x Npts.
 
arma::mat grho
 Gradient of electron density, (3 x Nrho) x Npts.
 
arma::mat sigma
 Dot products of gradient of electron density, N x Npts; N=1 for closed-shell and 3 for open-shell.
 
arma::mat vsigma
 Functional derivative of energy wrt gradient of electron density.
 
arma::mat lapl
 Laplacian of electron density.
 
arma::mat tau
 Kinetic energy density.
 
arma::mat vlapl
 Functional derivative of energy wrt laplacian of electron density.
 
arma::mat vtau
 Functional derivative of energy wrt kinetic energy density.
 
double VV10_thr
 Density threshold.
 
arma::mat VV10_arr
 Helper array used in kernel computation to avoid memory thrashing.
 

Detailed Description

Angular integration grid on a radial shell of an atom.

This file contains routines for computing the matrix elements of the used exchange-correlation functional for density-functional theory calculations.

The actual values of exchange-correlation functionals are computed by libxc. The Fock matrix is formed as described in J. A. Pople, P. M. W. Gill and B. G. Johnson, "Kohn-Sham density-functional theory within a finite basis set", Chem. Phys. Lett. 199 (1992), pp. 557 - 560.

For speed and to guarantee the accuracy of the results, the integration grid is formed adaptively by default, as described in A. M. Köster, R. Flores-Morano and J. U. Reveles, "Efficient and reliable numerical integration of exchange-correlation energies and potentials", J. Chem. Phys. 121, pp. 681 - 690 (2004). Fixed grids can also be used.

In addition to the above adaptive procedure, there is also an older variant for adaptive grid generation that is mostly useful for computing partial charges, i.e. M. Krack and A. M. Köster, "An adaptive numerical integrator for molecular integrals", J. Chem. Phys. 108, 3226 (2008).

The radial integral is done with Gauss-Chebyshev quadrature, with the change of variables used being the parameter free version $ \displaystyle{ r_A = \frac 1 {\ln 2} \ln \left( \frac 2 {1-x_A} \right) } $ as used in the aforementioned article.

The angular integrals are performed either by Lebedev quadrature or by Lobatto quadrature, as described in

C. W. Murray, N. C. Handy and G. J. Laming, "Quadrature schemes for integrals of density functional theory", Mol. Phys. 78, pp. 997 - 1014 (1993).

O. Treutler and R. Ahlrichs, "Efficient molecular integration schemes", J. Chem. Phys. 102, pp. 346 - 354 (1994).

Author
Susi Lehtola
Date
2011/05/11 22:35

Constructor & Destructor Documentation

AngularGrid::AngularGrid ( bool  lobatto = false)

Constructor. Need to set shell and basis set before using the construct() functions

Member Function Documentation

void AngularGrid::becke_weights ( double  a = 0.7)

Compute Becke weight for grid points on shell irad.

The weighting scheme is from the article R. E. Stratmann, G. E. Scuseria, M. J. Frisch, "Achieving linear scaling in exchange-correlation density functional quadratures", Chem. Phys. Lett. 257, 213 (1996).

The default value for the constant a is 0.7, as in the Köster et al. (2004) paper.

void AngularGrid::compute_VV10 ( const std::vector< arma::mat > &  nldata,
double  b,
double  C 
)

Evaluates VV10 energy and potential and add to total array

Implementation is described in O. Vydrov and T. Van Voorhis, "Nonlocal van der Waals density functional: The simpler the better", J. Chem. Phys. 133, 244103 (2010).

void AngularGrid::compute_xc ( int  func_id,
bool  pot 
)

Compute XC functional from density and add to total XC array. Pot toggles evaluation of potential

void AngularGrid::eval_overlap ( const arma::cx_mat &  Cocc,
size_t  io,
double  k,
arma::mat &  S,
double  thr 
) const

Evaluate atomic contribution to weighted overlap matrix given by

$ \int \frac {\rho_{i\sigma}^{k}(\mathbf{r})\chi_{\mu}(\mathbf{r})\chi_{\nu}(\mathbf{r})} {\rho_{\sigma}^{k}(\mathbf{r})} {\rm d}^{3}\mathbf{r} $

void AngularGrid::eval_tau_overlap ( const arma::cx_mat &  Cocc,
double  k,
arma::mat &  S,
double  thr 
) const

Evaluate atomic contribution to weighted overlap matrix given by

$ \int \left( \frac{\tau_{\sigma}^{\text{W}}(\mathbf{r})}{\tau_{\sigma}(\mathbf{r})} \right)^{k} \chi_{\mu} (\mathbf{r}) \chi_{\nu} (\mathbf{r}) \mathrm{d}^{3} \mathbf{r} $


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