ergo
|
General CAM functional. More...
#include <assert.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include "functionals.h"
Classes | |
struct | RGFirstDrv |
struct | RGSecondDrv |
struct | RGThirdDrv |
struct | RGFourthDrv |
struct | FunctionalList |
Macros | |
#define | __CVERSION__ |
#define | ELEMENTS(arr) (sizeof(arr)/sizeof(arr[0])) |
#define | THR 1e-40 |
#define | BECKE88_CORR_WEIGHT 1 |
#define | LYP_WEIGHT 0.81 |
#define | VWN_WEIGHT 0.19 |
#define | SQRT_PI 1.77245385090552 |
#define | MAX_LARGE_COEFS 5 |
#define | FAC M_SQRT2 |
#define | EVALUATOR(a, type) |
Functions | |
static int | camb3lyp_read (const char *conf_line) |
static void | camb3lyp_report (void) |
static int | cam_isgga (void) |
static int | cam_read (const char *conf_line) |
Read the configuration. More... | |
static void | cam_report (void) |
static real | cam_energy (const FunDensProp *dp) |
static void | cam_first (FunFirstFuncDrv *ds, real factor, const FunDensProp *dp) |
static void | cam_second (FunSecondFuncDrv *ds, real factor, const FunDensProp *dp) |
static void | cam_third (FunThirdFuncDrv *ds, real factor, const FunDensProp *dp) |
static void | cam_fourth (FunFourthFuncDrv *ds, real factor, const FunDensProp *dp) |
static int | hse_read (const char *conf_line) |
static struct FunctionalList * | newFunc (Functional *f, real weight, struct FunctionalList *next) |
static void | cam_free_config (void) |
static int | parse_table (const char *func, const char *str, int cnt, const char *keywords[], double *weights) |
static real | fun_a (real rho, real ex) |
static void | fun_a_first (real rho, real a, real ex, RGFirstDrv *fun1, RGFirstDrv *res) |
static void | fun_a_second (real rho, real a, real ex, RGSecondDrv *f2, RGSecondDrv *res) |
static void | fun_a_third (real rho, real a, real ex, RGThirdDrv *f3, RGThirdDrv *res) |
static void | fun_a_fourth (real rho, real a, real ex, RGFourthDrv *f4, RGFourthDrv *res) |
static real | cam_b_energy_small (real a) |
static real | cam_b_first_small (real a) |
static real | cam_b_energy_large (real a) |
static real | cam_b_first_large (real a) |
static real | cam_b_energy_medium (real a) |
static real | cam_b_first_medium (real a) |
static real | evaluate_series (int n, const real *coefs, real lambda) |
static real | cam_b_second_medium (real a) |
static real | cam_b_third_medium (real a) |
static real | cam_b_fourth_medium (real a) |
static real | cam_energy_sigma (real rho, real ex) |
static void | cam_first_sigma (real rho, real ex, RGFirstDrv *ds, RGFirstDrv *res) |
static void | cam_second_sigma (real rho, real ex, RGSecondDrv *f2, RGSecondDrv *res) |
static void | cam_third_sigma (real rho, real ex, RGThirdDrv *f3, RGThirdDrv *res) |
static void | cam_fourth_sigma (real rho, real ex, RGFourthDrv *f4, RGFourthDrv *res) |
int | fun_get_cam_param (real *alpha, real *beta, real *mu) |
Variables | |
Functional | Camb3lypFunctional |
Functional | CamFunctional |
Functional | HseFunctional |
static struct FunctionalList * | exchangeFunctionals = NULL |
The module uses program-wide configuration. More... | |
static struct FunctionalList * | correlationFunctionals = NULL |
static real | camAlpha = 0.0 |
static real | camBeta = 0.0 |
static real | camMu = 0.0 |
static const char * | cam_keywords [] = { "alpha", "beta", "mu" } |
static const real | large_coefs [] = { 9, 60, 420, 3240, 27720 } |
static const real | large_coefs1 [] = { 4.5, 15, 70, 405 } |
static const real | ENERGY_THR = 1e-13 |
General CAM functional.
Often called a range-separated exchange method.
Pawel Salek, 2004.06, Himmelbjerg - initial implementation.
#define __CVERSION__ |
#define BECKE88_CORR_WEIGHT 1 |
Referenced by camb3lyp_read().
#define ELEMENTS | ( | arr | ) | (sizeof(arr)/sizeof(arr[0])) |
Referenced by cam_b_fourth_medium(), cam_b_second_medium(), cam_b_third_medium(), cam_read(), and camb3lyp_read().
#define EVALUATOR | ( | a, | |
type | |||
) |
Referenced by cam_energy_sigma(), cam_first_sigma(), cam_fourth_sigma(), cam_second_sigma(), and cam_third_sigma().
#define FAC M_SQRT2 |
#define LYP_WEIGHT 0.81 |
Referenced by camb3lyp_read().
#define MAX_LARGE_COEFS 5 |
Referenced by cam_b_energy_large(), and cam_b_first_large().
#define SQRT_PI 1.77245385090552 |
Referenced by cam_b_energy_medium(), cam_b_energy_small(), cam_b_first_medium(), cam_b_first_small(), cam_b_fourth_medium(), and fun_a().
#define THR 1e-40 |
Referenced by cam_b_second_medium(), cam_b_third_medium(), cam_energy(), cam_first(), cam_fourth(), cam_second(), cam_third(), fun_a_first(), fun_a_second(), and xcCallbackGgaU().
#define VWN_WEIGHT 0.19 |
Referenced by camb3lyp_read().
References large_coefs, and MAX_LARGE_COEFS.
References large_coefs1, and MAX_LARGE_COEFS.
References ELEMENTS, evaluate_series(), EXP, large_coefs, POW, and SQRT_PI.
Referenced by cam_fourth_sigma().
References ELEMENTS, evaluate_series(), EXP, FABS, large_coefs, POW, and THR.
Referenced by cam_fourth_sigma(), cam_second_sigma(), and cam_third_sigma().
References ELEMENTS, evaluate_series(), EXP, FABS, large_coefs, POW, and THR.
Referenced by cam_fourth_sigma(), and cam_third_sigma().
|
static |
References cam_energy_sigma(), camAlpha, camBeta, correlationFunctionals, ENERGY_THR, exchangeFunctionals, FABS, FunctionalList::func, Functional_::func, FunDensProp_::grada, FunDensProp_::gradab, FunDensProp_::gradb, FunctionalList::next, FunDensProp_::rhoa, FunDensProp_::rhob, THR, and FunctionalList::weight.
References EVALUATOR, and fun_a().
Referenced by cam_energy().
|
static |
References cam_first_sigma(), camAlpha, correlationFunctionals, FunFirstFuncDrv::df0001, FunFirstFuncDrv::df0010, RGFirstDrv::df01, FunFirstFuncDrv::df0100, RGFirstDrv::df10, FunFirstFuncDrv::df1000, ENERGY_THR, exchangeFunctionals, FABS, Functional_::first, FunctionalList::func, Functional_::func, FunDensProp_::grada, FunDensProp_::gradab, FunDensProp_::gradb, FunctionalList::next, FunDensProp_::rhoa, FunDensProp_::rhob, THR, and FunctionalList::weight.
|
static |
References camBeta, RGFirstDrv::df01, RGFirstDrv::df10, EVALUATOR, fun_a(), and fun_a_first().
Referenced by cam_first().
|
static |
References cam_fourth_sigma(), camAlpha, correlationFunctionals, FunFourthFuncDrv::df0001, FunFourthFuncDrv::df0002, FunFourthFuncDrv::df0003, FunFourthFuncDrv::df0004, FunFourthFuncDrv::df0010, FunFourthFuncDrv::df0020, FunFourthFuncDrv::df0030, FunFourthFuncDrv::df0040, RGFourthDrv::df01, FunFourthFuncDrv::df0100, FunFourthFuncDrv::df0101, FunFourthFuncDrv::df0102, FunFourthFuncDrv::df0103, RGFourthDrv::df02, FunFourthFuncDrv::df0200, FunFourthFuncDrv::df0201, FunFourthFuncDrv::df0202, RGFourthDrv::df03, FunFourthFuncDrv::df0300, FunFourthFuncDrv::df0301, RGFourthDrv::df04, FunFourthFuncDrv::df0400, RGFourthDrv::df10, FunFourthFuncDrv::df1000, FunFourthFuncDrv::df1010, FunFourthFuncDrv::df1020, FunFourthFuncDrv::df1030, RGFourthDrv::df11, RGFourthDrv::df12, RGFourthDrv::df13, RGFourthDrv::df20, FunFourthFuncDrv::df2000, FunFourthFuncDrv::df2010, FunFourthFuncDrv::df2020, RGFourthDrv::df21, RGFourthDrv::df22, RGFourthDrv::df30, FunFourthFuncDrv::df3000, FunFourthFuncDrv::df3010, RGFourthDrv::df31, RGFourthDrv::df40, FunFourthFuncDrv::df4000, ENERGY_THR, exchangeFunctionals, FABS, Functional_::fourth, FunctionalList::func, Functional_::func, FunDensProp_::grada, FunDensProp_::gradab, FunDensProp_::gradb, FunctionalList::next, FunDensProp_::rhoa, FunDensProp_::rhob, THR, and FunctionalList::weight.
|
static |
References cam_b_fourth_medium(), cam_b_second_medium(), cam_b_third_medium(), camBeta, RGFourthDrv::df01, RGFourthDrv::df02, RGFourthDrv::df03, RGFourthDrv::df04, RGFourthDrv::df10, RGFourthDrv::df11, RGFourthDrv::df12, RGFourthDrv::df13, RGFourthDrv::df20, RGFourthDrv::df21, RGFourthDrv::df22, RGFourthDrv::df30, RGFourthDrv::df31, RGFourthDrv::df40, EVALUATOR, fun_a(), and fun_a_fourth().
Referenced by cam_fourth().
|
static |
References correlationFunctionals, exchangeFunctionals, free(), and FunctionalList::next.
Referenced by cam_read(), and camb3lyp_read().
|
static |
|
static |
Read the configuration.
The configuration consists of three types of terms that follow general pattern:
(p|x|c):(FUNCTIONAL)=(weight)
p prefix is followed by either 'alpha', 'beta' or 'mu' parameters and corresponding weights. x prefix defines an exchange functional
Example configuration for CAM-B3LYP is:
CAM p:alpha=0.19 p:beta=0.46 p:mu=0.33 x:slater=1 x:becke=1 c:lyp=0.81 c:vwn5=0.19
We obviously need to carefully exclude the recursive case of cam functional built from another cam functional....
References available_functionals, cam_free_config(), camAlpha, camBeta, CamFunctional, camMu, correlationFunctionals, ELEMENTS, exchangeFunctionals, fun_printf, newFunc(), and FunctionalList::weight.
Referenced by hse_read().
|
static |
|
static |
References cam_second_sigma(), camAlpha, correlationFunctionals, FunSecondFuncDrv::df0001, FunSecondFuncDrv::df0002, FunSecondFuncDrv::df0010, FunSecondFuncDrv::df0020, RGSecondDrv::df01, FunSecondFuncDrv::df0100, FunSecondFuncDrv::df0101, RGSecondDrv::df02, FunSecondFuncDrv::df0200, RGSecondDrv::df10, FunSecondFuncDrv::df1000, FunSecondFuncDrv::df1010, RGSecondDrv::df11, RGSecondDrv::df20, FunSecondFuncDrv::df2000, ENERGY_THR, exchangeFunctionals, FABS, FunctionalList::func, Functional_::func, FunDensProp_::grada, FunDensProp_::gradab, FunDensProp_::gradb, FunctionalList::next, FunDensProp_::rhoa, FunDensProp_::rhob, Functional_::second, THR, and FunctionalList::weight.
|
static |
References cam_b_second_medium(), camBeta, RGSecondDrv::df01, RGSecondDrv::df02, RGSecondDrv::df10, RGSecondDrv::df11, RGSecondDrv::df20, EVALUATOR, fun_a(), and fun_a_second().
Referenced by cam_second().
|
static |
References cam_third_sigma(), camAlpha, correlationFunctionals, FunThirdFuncDrv::df0001, FunThirdFuncDrv::df0002, FunThirdFuncDrv::df0003, FunThirdFuncDrv::df0010, FunThirdFuncDrv::df0020, FunThirdFuncDrv::df0030, RGThirdDrv::df01, FunThirdFuncDrv::df0100, FunThirdFuncDrv::df0101, FunThirdFuncDrv::df0102, RGThirdDrv::df02, FunThirdFuncDrv::df0200, FunThirdFuncDrv::df0201, RGThirdDrv::df03, FunThirdFuncDrv::df0300, RGThirdDrv::df10, FunThirdFuncDrv::df1000, FunThirdFuncDrv::df1010, FunThirdFuncDrv::df1020, RGThirdDrv::df11, RGThirdDrv::df12, RGThirdDrv::df20, FunThirdFuncDrv::df2000, FunThirdFuncDrv::df2010, RGThirdDrv::df21, RGThirdDrv::df30, FunThirdFuncDrv::df3000, ENERGY_THR, exchangeFunctionals, FABS, FunctionalList::func, Functional_::func, FunDensProp_::grada, FunDensProp_::gradab, FunDensProp_::gradb, FunctionalList::next, FunDensProp_::rhoa, FunDensProp_::rhob, Functional_::third, THR, and FunctionalList::weight.
|
static |
References cam_b_second_medium(), cam_b_third_medium(), camBeta, RGThirdDrv::df01, RGThirdDrv::df02, RGThirdDrv::df03, RGThirdDrv::df10, RGThirdDrv::df11, RGThirdDrv::df12, RGThirdDrv::df20, RGThirdDrv::df21, RGThirdDrv::df30, EVALUATOR, fun_a(), and fun_a_third().
Referenced by cam_third().
|
static |
References BECKE88_CORR_WEIGHT, BeckeFunctional, cam_free_config(), cam_keywords, camAlpha, camBeta, camMu, correlationFunctionals, ELEMENTS, exchangeFunctionals, fun_set_cam_param, fun_set_hf_weight, LYP_WEIGHT, LYPFunctional, newFunc(), parse_table(), SlaterFunctional, VWN_WEIGHT, and VWNFunctional.
|
static |
References camAlpha, camBeta, camMu, and fun_printf.
Referenced by cam_b_fourth_medium(), cam_b_second_medium(), and cam_b_third_medium().
References camMu, SQRT, and SQRT_PI.
Referenced by cam_energy_sigma(), cam_first_sigma(), cam_fourth_sigma(), cam_second_sigma(), and cam_third_sigma().
|
static |
References RGFirstDrv::df01, RGFirstDrv::df10, FABS, and THR.
Referenced by cam_first_sigma().
|
static |
References RGFourthDrv::df01, RGFourthDrv::df02, RGFourthDrv::df03, RGFourthDrv::df04, RGFourthDrv::df10, RGFourthDrv::df11, RGFourthDrv::df12, RGFourthDrv::df13, RGFourthDrv::df20, RGFourthDrv::df21, RGFourthDrv::df22, RGFourthDrv::df30, RGFourthDrv::df31, RGFourthDrv::df40, and FABS.
Referenced by cam_fourth_sigma().
|
static |
References RGSecondDrv::df01, RGSecondDrv::df02, RGSecondDrv::df10, RGSecondDrv::df11, RGSecondDrv::df20, FABS, and THR.
Referenced by cam_second_sigma().
|
static |
References RGThirdDrv::df01, RGThirdDrv::df02, RGThirdDrv::df03, RGThirdDrv::df10, RGThirdDrv::df11, RGThirdDrv::df12, RGThirdDrv::df20, RGThirdDrv::df21, RGThirdDrv::df30, and FABS.
Referenced by cam_third_sigma().
References camAlpha, Camb3lypFunctional, camBeta, CamFunctional, camMu, HseFunctional, and selected_func.
Referenced by get_hf_weight_and_cam_params().
|
static |
References cam_read().
|
static |
References FunctionalList::func, malloc(), FunctionalList::next, and FunctionalList::weight.
Referenced by cam_read(), and camb3lyp_read().
|
static |
References fun_printf, and FunctionalList::func.
Referenced by camb3lyp_read().
|
static |
Referenced by camb3lyp_read().
|
static |
Referenced by cam_energy(), cam_first(), cam_fourth(), cam_read(), cam_report(), cam_second(), cam_third(), camb3lyp_read(), camb3lyp_report(), and fun_get_cam_param().
Functional Camb3lypFunctional |
Referenced by fun_get_cam_param().
|
static |
Functional CamFunctional |
Referenced by cam_read(), and fun_get_cam_param().
|
static |
Referenced by cam_read(), cam_report(), camb3lyp_read(), camb3lyp_report(), fun_a(), and fun_get_cam_param().
|
static |
Referenced by cam_energy(), cam_first(), cam_fourth(), cam_free_config(), cam_read(), cam_report(), cam_second(), cam_third(), and camb3lyp_read().
|
static |
Referenced by cam_energy(), cam_first(), cam_fourth(), cam_second(), and cam_third().
|
static |
The module uses program-wide configuration.
It uses following range separation of the HF exchange: HF_RS_Exch = (alpha + beta*erf(mu*r))*HF_exchange
This means that the DFT exchange becomes: 1 - HF_RS_Exch
Referenced by cam_energy(), cam_first(), cam_fourth(), cam_free_config(), cam_read(), cam_report(), cam_second(), cam_third(), and camb3lyp_read().
Functional HseFunctional |
Referenced by fun_get_cam_param().
|
static |
Referenced by cam_b_energy_large(), cam_b_fourth_medium(), cam_b_second_medium(), and cam_b_third_medium().
|
static |
Referenced by cam_b_first_large().