MADNESS 0.10.1
Functions | Variables
test_dft.cc File Reference
#include <madness.h>
#include <madness/chem/SCFOperators.h>
#include <madness/chem/xcfunctional.h>
Include dependency graph for test_dft.cc:

Functions

bool check_err (double err, double thresh, std::string msg)
 
int main (int argc, char **argv)
 
double slater (const coord_3d &xyz)
 
double slater2 (const coord_3d &xyz)
 
int test_hybrid_coefficients (World &world)
 the exact-exchange fraction of a hybrid must not depend on how it was named
 
int test_meta_gga (World &world)
 the meta-gga machinery, checked against two exact identities
 
int test_meta_gga_dedtau_polarized (World &world)
 
int test_slater_exchange (World &world)
 test the Slater exchange potential and the kernel
 

Variables

static double alpha =10.0
 

Function Documentation

◆ check_err()

bool check_err ( double  err,
double  thresh,
std::string  msg 
)

◆ main()

int main ( int  argc,
char **  argv 
)

◆ slater()

double slater ( const coord_3d xyz)

◆ slater2()

double slater2 ( const coord_3d xyz)

◆ test_hybrid_coefficients()

int test_hybrid_coefficients ( World world)

the exact-exchange fraction of a hybrid must not depend on how it was named

A hybrid can be requested either through one of the hardcoded aliases or by its libxc name. Both must end up with the same admixture: the fraction is a property of the functional, queried from libxc, not of the input line. Before this was queried, the libxc-name form silently ran with no exact exchange at all.

References c, check_err(), madness::XCfunctional::hf_exchange_coefficient(), madness::XCfunctional::initialize(), madness::print(), and madness::World::rank().

Referenced by main().

◆ test_meta_gga()

int test_meta_gga ( World world)

the meta-gga machinery, checked against two exact identities

(a) int(tau) must equal the kinetic energy. tau = 1/2 sum_i |grad psi_i|^2, so this pins the factor of 1/2 that libxc has required since version 2.0.0 and would catch a tau built from the wrong quantity. (b) the non-multiplicative operator must satisfy its own weak form, <phi|v_tau|psi> = 1/2 int (de/dtau) grad(phi).grad(psi). That is the integration by parts the nested form -1/2 sum_x D_x(v_tau D_x psi) is supposed to realize, and it is also the self-adjointness that make_fock_matrix relies on.

References axis, check_err(), madness::copy(), madness::XCOperator< T, NDIM >::get_tau(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), madness::Function< T, NDIM >::is_initialized(), MADNESS_CHECK, madness::Function< T, NDIM >::norm2(), madness::norm2(), madness::print(), psi(), madness::World::rank(), madness::Function< T, NDIM >::scale(), madness::XCOperator< T, NDIM >::set_tau(), slater2(), thresh, and xc.

Referenced by main().

◆ test_meta_gga_dedtau_polarized()

int test_meta_gga_dedtau_polarized ( World world)

pointwise check of the spin-polarized de/dtau against a finite difference

Nothing else exercises the polarized meta-gga unpacking: the closed-shell path uses a different libxc entry point (nspin=1), a different index into vxc()'s result vector, and a different stride. This works on raw tensors, so it isolates the functional layer from everything MRA does.

References check_err(), madness::XCfunctional::enum_rhoa, madness::XCfunctional::enum_rhob, madness::XCfunctional::enum_taua, madness::XCfunctional::enum_taub, madness::XCfunctional::enum_zetaa_x, madness::XCfunctional::enum_zetaa_y, madness::XCfunctional::enum_zetaa_z, madness::XCfunctional::enum_zetab_x, madness::XCfunctional::enum_zetab_y, madness::XCfunctional::enum_zetab_z, madness::XCfunctional::exc(), madness::XCfunctional::get_ggatol(), h(), madness::XCfunctional::initialize(), MADNESS_CHECK, madness::XCfunctional::needs_tau(), madness::XCfunctional::number_xc_args, p(), madness::print(), madness::Tensor< T >::ptr(), madness::World::rank(), v, and madness::XCfunctional::vxc().

Referenced by main().

◆ test_slater_exchange()

int test_slater_exchange ( World world)

test the Slater exchange potential and the kernel

The Slater exchange is a simple function of rho,

\[
   E_\mathrm{xc} = \int\epsilon_\mathrm{xc}[\rho]\rho(r) d^3r
\]

with

\[
   v_\mathrm{xc} = \epsilon_\mathrm{xc} + \rho\frac{\partial \epsilon}{\partial \rho}
                 = 4/3\epsilon_\mathrm{xc}
\]

and

\[
   k_\mathrm{xc} = \frac{\partial^2\epsilon}{\partial \rho^2} = 4/3*1/3 * \epsilon_\mathrm{xc}
\]

References std::abs(), check_err(), madness::copy(), energy, madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), potential(), madness::print(), slater2(), thresh, and xc.

Referenced by main().

Variable Documentation

◆ alpha

double alpha =10.0
static

Referenced by slater().