ergo
dft.h
Go to the documentation of this file.
1 /* Ergo, version 3.8, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2019 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
4  * and Anastasia Kruchinina.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Primary academic reference:
20  * Ergo: An open-source program for linear-scaling electronic structure
21  * calculations,
22  * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
23  * Kruchinina,
24  * SoftwareX 7, 107 (2018),
25  * <http://dx.doi.org/10.1016/j.softx.2018.03.005>
26  *
27  * For further information about Ergo, see <http://www.ergoscf.org>.
28  */
29 
30 /*-*-mode: C; c-indentation-style: "bsd"; c-basic-offset: 4; -*-*/
37 #ifndef _GENERAL_H_
38 #define _GENERAL_H_
39 
40 #include <stdlib.h>
41 
42 #ifdef __cplusplus
43 #define EXTERN_C extern "C"
44 #else
45 #define EXTERN_C
46 #endif
47 
48 #if defined(__cplusplus)
49 #define RESTRICT
50 #else
51 /* We really do want to take advantage of the restrict keyword... */
52 #define RESTRICT restrict
53 #endif
54 
55 #if !defined(__CVERSION)
56 #define __CVERSION__
57 #endif
58 
59 #include "functionals.h"
60 
61 #include "basisinfo.h"
62 #include "molecule.h"
63 #include "grid_reader.h"
64 
65 /* Match Fortran name mangling. If the Fortran compiler does not
66  * mangle names, define NO_UNDERSCORE in CFLAGS. g77 and compaq fort
67  * (cryptically referred to with HAVE_GCPP below) for linux-alpha both
68  * insert a second underscore if routine name contains at least one
69  * underscore /hjaaj Oct04 */
70 #ifdef NO_UNDERSCORE
71 #define FSYM(a) a
72 #define FSYM2(a) a
73 #else
74 #define FSYM(a) a ## _
75 #if defined(VAR_G77) || defined(HAVE_GCPP)
76 #define FSYM2(a) a ## __
77 #else
78 #define FSYM2(a) a ## _
79 #endif
80 #endif
81 
82 #if defined(VAR_PGF77)
83 #define __FUNCTION__ "PGI_does_not_define__FUNCTION__"
84 #endif
85 #if defined(SYS_SUN)
86 #define __FUNCTION__ "SUNs CC compiler_does_not_define__FUNCTION__"
87 #endif
88 #if defined(SYS_IRIX)
89 #define __FUNCTION__ "SGIs CC compiler_does_not_define__FUNCTION__"
90 #endif
91 #if defined(SYS_DEC)
92 #define __FUNCTION__ "DEC CC compiler does not define __FUNCTION__"
93 #endif
94 
95 #define ELEMENTS(arr) (sizeof(arr)/sizeof(arr[0]))
96 
97 
98 EXTERN_C void dftpot0_(FirstDrv *ds, const real* weight, const FunDensProp* dp);
99 EXTERN_C void dftpot1_(SecondDrv *ds, const real* w, const FunDensProp* dp,
100  const int* triplet);
101 
102 EXTERN_C int dft_setfunc(const char *line);
103 EXTERN_C void grid_set_tmpdir(const char *tmpdir);
104 
105 
106 EXTERN_C real dft_get_xc(int nElectrons, const real* dmat,
107  const BasisInfoStruct *bis, const Molecule *mol,
108  const Dft::GridParams& gss,
109  real* ksm, real* edfty,
110  int nThreads);
111 EXTERN_C real dft_get_uxc(int nElectrons,
112  const real* dmata, const real *dmatb,
113  const BasisInfoStruct *bis, const Molecule *mol,
114  const Dft::GridParams& gss,
115  real* xca, real *xcb, real* edfty,
116  int nThreads);
117 
118 /* Property evaluators */
119 typedef void (*DFTPropEvalMaster)(void);
120 typedef void (*DFTPropEvalSlave)(real* work, int* lwork, const int* iprint);
121 
122 extern int (*fort_print)(const char* format, ...);
123 
124 
125 #if !defined __inline__
126 /* inline some stuff whenever possible */
127 #define __inline__
128 #endif
129 
130 #endif
dft_get_uxc
EXTERN_C real dft_get_uxc(int nElectrons, const real *dmata, const real *dmatb, const BasisInfoStruct *bis, const Molecule *mol, const Dft::GridParams &gss, real *xca, real *xcb, real *edfty, int nThreads)
SecondDrv
Definition: dft_common.h:70
FunDensProp_
Definition: functionals.h:375
dft_get_xc
EXTERN_C real dft_get_xc(int nElectrons, const real *dmat, const BasisInfoStruct *bis, const Molecule *mol, const Dft::GridParams &gss, real *ksm, real *edfty, int nThreads)
DFTPropEvalMaster
void(* DFTPropEvalMaster)(void)
Definition: dft.h:119
fort_print
int(* fort_print)(const char *format,...)
Definition: dft_common.cc:180
dftpot0_
EXTERN_C void dftpot0_(FirstDrv *ds, const real *weight, const FunDensProp *dp)
Definition: dft_common.cc:766
BasisInfoStruct
Definition: basisinfo.h:112
real
ergo_real real
Definition: test.cc:46
FirstDrv
A vector of first order derivatives with respect to two parameters: density rho and SQUARE of the gra...
Definition: dft_common.h:60
Dft::GridParams
A structure describing the grid settings.
Definition: grid_params.h:59
DFTPropEvalSlave
void(* DFTPropEvalSlave)(real *work, int *lwork, const int *iprint)
Definition: dft.h:120
basisinfo.h
Code for setting up basis functions starting from shells.
molecule.h
Class representing a molecule as a set of atoms with assiciated coordinates and charges of the atomic...
grid_set_tmpdir
EXTERN_C void grid_set_tmpdir(const char *tmpdir)
Definition: grid_reader.cc:116
Molecule
Representation of a molecule as a set of nuclei and total charge.
Definition: molecule.h:87
EXTERN_C
#define EXTERN_C
Definition: dft.h:45
dftpot1_
EXTERN_C void dftpot1_(SecondDrv *ds, const real *w, const FunDensProp *dp, const int *triplet)
Definition: dft_common.cc:776
grid_reader.h
Grid Generator interface. Functions for opening grid file, reading chunks from it,...
functionals.h
dft_setfunc
EXTERN_C int dft_setfunc(const char *line)
Definition: dft_common.cc:277