ergo
dft_common.cc File Reference

Common DFT routines. Mostly functional mixing. More...

#include <ctype.h>
#include <cmath>
#include <pthread.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <list>
#include <map>
#include "dft_common.h"
#include "functionals.h"
#include "grid_atomic.h"
#include "output.h"
#include "barrier.h"

Classes

class  ShellTree
 Class that allows to find in NLogN time all shells that overlap with a given box. More...
 
struct  Ball
 

Macros

#define __CVERSION__
 

Functions

void * dal_malloc_ (size_t sz, const char *place, unsigned line)
 
int sync_threads (bool release, int nThreads)
 creates or destroys a barrier for nThreads. More...
 
static void dft_set_hf_weight (real w)
 
static real dft_get_hf_weight (void)
 
static int ergo_fort_print (const char *format,...)
 
EXTERN_C void dft_init (void)
 
EXTERN_C int dft_get_num_threads (void)
 
EXTERN_C void dft_set_num_threads (int nThreads)
 
int dft_setfunc (const char *line)
 
static ergo_real distance (const ergo_real *a, const ergo_real *b)
 Coomputes distance between two points, they do not need to be of the Vector3D type. More...
 
void ergoShellsToOrbs (const int *nshlbl, const int(*shlblock)[2], int *norbbl, int(*orbblock)[2], const BasisInfoStruct &bis)
 transform shell block indices to orbital block indices. More...
 
real dftene_ (const real *rho, const real *grad)
 
void dftptf0_ (real *rho, real *grad, real *wght, real *vx)
 
void dftpot0_ (FirstDrv *ds, const real *weight, const FunDensProp *dp)
 
void dftpot1_ (SecondDrv *ds, const real *w, const FunDensProp *dp, const int *triplet)
 

Variables

int ZEROI = 0
 
int ONEI = 1
 
int THREEI = 3
 
int FOURI = 4
 
real ZEROR = 0.0
 
real ONER = 1.0
 
real TWOR = 2.0
 
real FOURR = 4.0
 
static const ergo_real GET_BLOCKS_FUDGE_FACTOR = 1.0
 
static const ergo_real SET_SHELL_RADII_ORBITAL_THR = 1e-11
 
static real dft_hf_weight = 0.0
 
int(* fort_print )(const char *format,...) = printf
 
static int dft_thread_count = -1
 

Detailed Description

Common DFT routines. Mostly functional mixing.

Author
: Pawel Salek responsible

(c) Pawel Salek, pawsa.nosp@m.@the.nosp@m.ochem.nosp@m..kth.nosp@m..se, 2001-08-02 NOTES: Adding new functionals: a. use fun-slater.c as template. b. add 'extern Functional MyFunctional;' to functionals.h c. add '&MyFunctional' to available_functionals below. d. have a beer. Or some crackers, if you prefer.

Macro Definition Documentation

◆ __CVERSION__

#define __CVERSION__

Function Documentation

◆ dal_malloc_()

void* dal_malloc_ ( size_t  sz,
const char *  place,
unsigned  line 
)

◆ dft_get_hf_weight()

static real dft_get_hf_weight ( void  )
static

References dft_hf_weight.

Referenced by dft_setfunc().

◆ dft_get_num_threads()

◆ dft_init()

EXTERN_C void dft_init ( void  )

References ergo_fort_print(), fort_print, and fun_printf.

Referenced by main(), test_mol(), and test_small().

◆ dft_set_hf_weight()

static void dft_set_hf_weight ( real  w)
static

References dft_hf_weight.

Referenced by dft_setfunc().

◆ dft_set_num_threads()

EXTERN_C void dft_set_num_threads ( int  nThreads)

References dft_thread_count.

Referenced by es_set_nthreads().

◆ dft_setfunc()

◆ dftene_()

◆ dftpot0_()

◆ dftpot1_()

◆ dftptf0_()

◆ distance()

◆ ergo_fort_print()

static int ergo_fort_print ( const char *  format,
  ... 
)
static

References do_voutput(), LOG_AREA_DFT, and LOG_CAT_INFO.

Referenced by dft_init().

◆ ergoShellsToOrbs()

void ergoShellsToOrbs ( const int *  nshlbl,
const int(*)  shlblock[2],
int *  norbbl,
int(*)  orbblock[2],
const BasisInfoStruct bis 
)

transform shell block indices to orbital block indices.

IORIDX contains preprocessed information about where given shell begins and ends in given symmetry.

References ShellSpecStruct::noOfBasisFuncs, BasisInfoStruct::shellList, and ShellSpecStruct::startIndexInMatrix.

Referenced by SparsePattern::add(), compute_grid_thread_func(), and dft_integrate().

◆ sync_threads()

int sync_threads ( bool  release,
int  nThreads 
)

creates or destroys a barrier for nThreads.

Parameters
releasetells whether we are to destroy the barrier (true) or just sync (false).
nThreadsinforms the code how many threads are supposed to block on the barrier.

References ergo_barrier_destroy(), ergo_barrier_init(), ergo_barrier_wait(), and PTHREAD_BARRIER_SERIAL_THREAD.

Referenced by dft_integrate(), XCEvaluatorUnrestricted::getXC(), and XCEvaluatorRestricted::getXC().

Variable Documentation

◆ dft_hf_weight

real dft_hf_weight = 0.0
static

◆ dft_thread_count

int dft_thread_count = -1
static

◆ fort_print

int(* fort_print) (const char *format,...) = printf

◆ FOURI

int FOURI = 4

◆ FOURR

real FOURR = 4.0

◆ GET_BLOCKS_FUDGE_FACTOR

const ergo_real GET_BLOCKS_FUDGE_FACTOR = 1.0
static

Referenced by ErgoMolInfo::getBlocks().

◆ ONEI

int ONEI = 1

Referenced by dft_get_uxc(), and dft_get_xc().

◆ ONER

◆ SET_SHELL_RADII_ORBITAL_THR

const ergo_real SET_SHELL_RADII_ORBITAL_THR = 1e-11
static

◆ THREEI

int THREEI = 3

◆ TWOR

real TWOR = 2.0

◆ ZEROI

int ZEROI = 0

◆ ZEROR

real ZEROR = 0.0