fun-cam.c File Reference

General CAM functional. More...

#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 FunctionalListnewFunc (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 FunctionalListexchangeFunctionals = NULL
 The module uses program-wide configuration.
static struct FunctionalListcorrelationFunctionals = 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

Detailed Description

General CAM functional.

Often called a range-separated exchange method.

Pawel Salek, 2004.06, Himmelbjerg - initial implementation.


Define Documentation

#define __CVERSION__
#define _BSD_SOURCE   1
#define _XOPEN_SOURCE   500
#define _XOPEN_SOURCE_EXTENDED   1
#define BECKE88_CORR_WEIGHT   1

Referenced by camb3lyp_read().

#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)))

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
#define SQRT_PI   1.77245385090552
#define THR   1e-40
#define VWN_WEIGHT   0.19

Referenced by camb3lyp_read().


Function Documentation

static real cam_b_energy_large ( real  a  )  [static]

References large_coefs, and MAX_LARGE_COEFS.

static real cam_b_energy_medium ( real  a  )  [static]

References ERF, EXP, and SQRT_PI.

static real cam_b_energy_small ( real  a  )  [static]

References SQRT_PI.

static real cam_b_first_large ( real  a  )  [static]

References large_coefs1, and MAX_LARGE_COEFS.

static real cam_b_first_medium ( real  a  )  [static]

References ERF, EXP, POW, and SQRT_PI.

static real cam_b_first_small ( real  a  )  [static]

References EXP, and SQRT_PI.

static real cam_b_fourth_medium ( real  a  )  [static]
static real cam_b_second_medium ( real  a  )  [static]
static real cam_b_third_medium ( real  a  )  [static]
static real cam_energy ( const FunDensProp dp  )  [static]
static real cam_energy_sigma ( real  rho,
real  ex 
) [static]

References EVALUATOR, and fun_a().

Referenced by cam_energy().

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]

References FunctionalList::next.

Referenced by cam_read(), and camb3lyp_read().

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

  • no actual check is performed! c allows to add an additive functional, usually a correlation one.

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....

Returns:
0 on failure, 1 on success.

References available_functionals, cam_free_config(), camAlpha, camBeta, camMu, ELEMENTS, fun_printf, newFunc(), and FunctionalList::weight.

Referenced by hse_read().

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]

References camAlpha, camBeta, camMu, and fun_printf.

static real evaluate_series ( int  n,
const real coefs,
real  lambda 
) [static]
static real fun_a ( real  rho,
real  ex 
) [static]
static void fun_a_first ( real  rho,
real  a,
real  ex,
RGFirstDrv fun1,
RGFirstDrv res 
) [static]

References RGFirstDrv::df01, RGFirstDrv::df10, FABS, and THR.

Referenced by cam_first_sigma().

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]
int fun_get_cam_param ( real alpha,
real beta,
real mu 
)
static int hse_read ( const char *  conf_line  )  [static]

References cam_read().

static struct FunctionalList* newFunc ( Functional f,
real  weight,
struct FunctionalList next 
) [static, read]
static int parse_table ( const char *  func,
const char *  str,
int  cnt,
const char *  keywords[],
double *  weights 
) [static]

References fun_printf.

Referenced by camb3lyp_read().


Variable Documentation

const char* cam_keywords[] = { "alpha", "beta", "mu" } [static]

Referenced by camb3lyp_read().

real camAlpha = 0.0 [static]
real camBeta = 0.0 [static]
real camMu = 0.0 [static]
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

const real large_coefs[] = { 9, 60, 420, 3240, 27720 } [static]
const real large_coefs1[] = { 4.5, 15, 70, 405 } [static]

Referenced by cam_b_first_large().


Generated on 21 Nov 2012 for ergo by  doxygen 1.6.1