ergo
dft.h
Go to the documentation of this file.
1 /* Ergo, version 3.2, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2012 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Primary academic reference:
19  * Kohn−Sham Density Functional Theory Electronic Structure Calculations
20  * with Linearly Scaling Computational Time and Memory Usage,
21  * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek,
22  * J. Chem. Theory Comput. 7, 340 (2011),
23  * <http://dx.doi.org/10.1021/ct100611z>
24  *
25  * For further information about Ergo, see <http://www.ergoscf.org>.
26  */
27 
28 /*-*-mode: C; c-indentation-style: "bsd"; c-basic-offset: 4; -*-*/
35 #ifndef _GENERAL_H_
36 #define _GENERAL_H_
37 
38 #include <stdlib.h>
39 
40 #ifdef __cplusplus
41 #define EXTERN_C extern "C"
42 #else
43 #define EXTERN_C
44 #endif
45 
46 #if defined(__cplusplus)
47 #define RESTRICT
48 #else
49 /* We really do want to take advantage of the restrict keyword... */
50 #define RESTRICT restrict
51 #endif
52 
53 #if !defined(__CVERSION)
54 #define __CVERSION__
55 #endif
56 
57 #include "functionals.h"
58 
59 #include "basisinfo.h"
60 #include "molecule.h"
61 #include "grid_reader.h"
62 
63 /* Match Fortran name mangling. If the Fortran compiler does not
64  * mangle names, define NO_UNDERSCORE in CFLAGS. g77 and compaq fort
65  * (cryptically referred to with HAVE_GCPP below) for linux-alpha both
66  * insert a second underscore if routine name contains at least one
67  * underscore /hjaaj Oct04 */
68 #ifdef NO_UNDERSCORE
69 #define FSYM(a) a
70 #define FSYM2(a) a
71 #else
72 #define FSYM(a) a ## _
73 #if defined(VAR_G77) || defined(HAVE_GCPP)
74 #define FSYM2(a) a ## __
75 #else
76 #define FSYM2(a) a ## _
77 #endif
78 #endif
79 
80 #if defined(VAR_PGF77)
81 #define __FUNCTION__ "PGI_does_not_define__FUNCTION__"
82 #endif
83 #if defined(SYS_SUN)
84 #define __FUNCTION__ "SUNs CC compiler_does_not_define__FUNCTION__"
85 #endif
86 #if defined(SYS_IRIX)
87 #define __FUNCTION__ "SGIs CC compiler_does_not_define__FUNCTION__"
88 #endif
89 #if defined(SYS_DEC)
90 #define __FUNCTION__ "DEC CC compiler does not define __FUNCTION__"
91 #endif
92 
93 #define ELEMENTS(arr) (sizeof(arr)/sizeof(arr[0]))
94 
95 
96 EXTERN_C void dftpot0_(FirstDrv *ds, const real* weight, const FunDensProp* dp);
97 EXTERN_C void dftpot1_(SecondDrv *ds, const real* w, const FunDensProp* dp,
98  const int* triplet);
99 
100 EXTERN_C int dft_setfunc(const char *line);
101 EXTERN_C void grid_set_tmpdir(const char *tmpdir);
102 
103 
104 EXTERN_C real dft_get_xc(int nElectrons, const real* dmat,
105  const BasisInfoStruct *bis, const Molecule *mol,
106  const Dft::GridParams& gss,
107  real* ksm, real* edfty,
108  int nThreads);
109 EXTERN_C real dft_get_uxc(int nElectrons,
110  const real* dmata, const real *dmatb,
111  const BasisInfoStruct *bis, const Molecule *mol,
112  const Dft::GridParams& gss,
113  real* xca, real *xcb, real* edfty,
114  int nThreads);
115 
116 /* Property evaluators */
117 typedef void (*DFTPropEvalMaster)(void);
118 typedef void (*DFTPropEvalSlave)(real* work, int* lwork, const int* iprint);
119 
120 extern int (*fort_print)(const char* format, ...);
121 
122 
123 #if !defined __inline__
124 /* inline some stuff whenever possible */
125 #define __inline__
126 #endif
127 
128 #endif