#include <assert.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "functionals.h"
Classes | |
| struct | RGFirstDrv |
| struct | RGSecondDrv |
| struct | RGThirdDrv |
| struct | RGFourthDrv |
| struct | FunctionalList |
Defines | |
| #define | _XOPEN_SOURCE 500 |
| #define | _XOPEN_SOURCE_EXTENDED 1 |
| #define | _BSD_SOURCE 1 |
| #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. | |
| 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. | |
| 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 |
Often called a range-separated exchange method.
Pawel Salek, 2004.06, Himmelbjerg - initial implementation.
| #define __CVERSION__ |
| #define _BSD_SOURCE 1 |
| #define _XOPEN_SOURCE 500 |
| #define _XOPEN_SOURCE_EXTENDED 1 |
| #define BECKE88_CORR_WEIGHT 1 |
| #define ELEMENTS | ( | arr | ) | (sizeof(arr)/sizeof(arr[0])) |
| #define EVALUATOR | ( | a, | |||
| type | ) |
Value:
((a<0.14) ? cam_b_ ## type ## _small(a) : \ ((a<4.25) ? cam_b_ ## type ## _medium(a) : \ cam_b_ ## type ## _large(a)))
| #define FAC M_SQRT2 |
| #define LYP_WEIGHT 0.81 |
| #define MAX_LARGE_COEFS 5 |
| #define SQRT_PI 1.77245385090552 |
| #define THR 1e-40 |
| #define VWN_WEIGHT 0.19 |
| static real cam_energy | ( | const FunDensProp * | dp | ) | [static] |
| static void cam_first | ( | FunFirstFuncDrv * | ds, | |
| real | factor, | |||
| const FunDensProp * | dp | |||
| ) | [static] |
| static void cam_first_sigma | ( | real | rho, | |
| real | ex, | |||
| RGFirstDrv * | ds, | |||
| RGFirstDrv * | res | |||
| ) | [static] |
| static void cam_fourth | ( | FunFourthFuncDrv * | ds, | |
| real | factor, | |||
| const FunDensProp * | dp | |||
| ) | [static] |
| static void cam_fourth_sigma | ( | real | rho, | |
| real | ex, | |||
| RGFourthDrv * | f4, | |||
| RGFourthDrv * | res | |||
| ) | [static] |
| static void cam_free_config | ( | void | ) | [static] |
| static int cam_isgga | ( | void | ) | [static] |
| static int cam_read | ( | const char * | conf_line | ) | [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....
| static void cam_report | ( | void | ) | [static] |
| static void cam_second | ( | FunSecondFuncDrv * | ds, | |
| real | factor, | |||
| const FunDensProp * | dp | |||
| ) | [static] |
| static void cam_second_sigma | ( | real | rho, | |
| real | ex, | |||
| RGSecondDrv * | f2, | |||
| RGSecondDrv * | res | |||
| ) | [static] |
| static void cam_third | ( | FunThirdFuncDrv * | ds, | |
| real | factor, | |||
| const FunDensProp * | dp | |||
| ) | [static] |
| static void cam_third_sigma | ( | real | rho, | |
| real | ex, | |||
| RGThirdDrv * | f3, | |||
| RGThirdDrv * | res | |||
| ) | [static] |
| static int camb3lyp_read | ( | const char * | conf_line | ) | [static] |
| static void camb3lyp_report | ( | void | ) | [static] |
| static void fun_a_first | ( | real | rho, | |
| real | a, | |||
| real | ex, | |||
| RGFirstDrv * | fun1, | |||
| RGFirstDrv * | res | |||
| ) | [static] |
| static void fun_a_fourth | ( | real | rho, | |
| real | a, | |||
| real | ex, | |||
| RGFourthDrv * | f4, | |||
| RGFourthDrv * | res | |||
| ) | [static] |
| static void fun_a_second | ( | real | rho, | |
| real | a, | |||
| real | ex, | |||
| RGSecondDrv * | f2, | |||
| RGSecondDrv * | res | |||
| ) | [static] |
| static void fun_a_third | ( | real | rho, | |
| real | a, | |||
| real | ex, | |||
| RGThirdDrv * | f3, | |||
| RGThirdDrv * | res | |||
| ) | [static] |
| static int hse_read | ( | const char * | conf_line | ) | [static] |
| static struct FunctionalList* newFunc | ( | Functional * | f, | |
| real | weight, | |||
| struct FunctionalList * | next | |||
| ) | [static] |
| static int parse_table | ( | const char * | func, | |
| const char * | str, | |||
| int | cnt, | |||
| const char * | keywords[], | |||
| double * | weights | |||
| ) | [static] |
const char* cam_keywords[] = { "alpha", "beta", "mu" } [static] |
Initial value:
{
"Camb3lyp",
cam_isgga,
camb3lyp_read,
camb3lyp_report,
cam_energy,
cam_first,
cam_second,
cam_third,
cam_fourth
}
Initial value:
{
"Cam",
cam_isgga,
cam_read,
cam_report,
cam_energy,
cam_first,
cam_second,
cam_third,
cam_fourth
}
struct FunctionalList* correlationFunctionals = NULL [static] |
const real ENERGY_THR = 1e-13 [static] |
struct FunctionalList* exchangeFunctionals = NULL [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
Initial value:
{
"HSE",
cam_isgga,
hse_read,
cam_report,
cam_energy,
cam_first,
cam_second,
cam_third,
cam_fourth
}
const real large_coefs[] = { 9, 60, 420, 3240, 27720 } [static] |
const real large_coefs1[] = { 4.5, 15, 70, 405 } [static] |
1.4.7