ergo
dft_common.cc File Reference

Common DFT routines. 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 _XOPEN_SOURCE   500
 
#define _XOPEN_SOURCE_EXTENDED   1
 
#define _BSD_SOURCE   1
 
#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.

(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

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

Function Documentation

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

References dft_hf_weight.

Referenced by dft_setfunc().

EXTERN_C void dft_init ( void  )

References ergo_fort_print(), fort_print, and fun_printf.

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

static void dft_set_hf_weight ( real  w)
static

References dft_hf_weight.

Referenced by dft_setfunc().

EXTERN_C void dft_set_num_threads ( int  nThreads)

References dft_thread_count.

Referenced by es_set_nthreads().

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

References do_voutput(), LOG_AREA_DFT, and LOG_CAT_INFO.

Referenced by dft_init().

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

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(), XCEvaluatorRestricted::getXC(), and XCEvaluatorUnrestricted::getXC().

Variable Documentation

real dft_hf_weight = 0.0
static
int dft_thread_count = -1
static
int(* fort_print) (const char *format,...) = printf
int FOURI = 4
real FOURR = 4.0
const ergo_real GET_BLOCKS_FUDGE_FACTOR = 1.0
static

Referenced by ErgoMolInfo::getBlocks().

int ONEI = 1

Referenced by dft_get_uxc(), and dft_get_xc().

const ergo_real SET_SHELL_RADII_ORBITAL_THR = 1e-11
static
int THREEI = 3
real TWOR = 2.0
int ZEROI = 0

Referenced by hessianCb().

real ZEROR = 0.0