ergo
|
00001 /* Ergo, version 3.2, a program for linear scaling electronic structure 00002 * calculations. 00003 * Copyright (C) 2012 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 * 00018 * Primary academic reference: 00019 * KohnâSham Density Functional Theory Electronic Structure Calculations 00020 * with Linearly Scaling Computational Time and Memory Usage, 00021 * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek, 00022 * J. Chem. Theory Comput. 7, 340 (2011), 00023 * <http://dx.doi.org/10.1021/ct100611z> 00024 * 00025 * For further information about Ergo, see <http://www.ergoscf.org>. 00026 */ 00027 00028 /*-*-mode: C; c-indentation-style: "bsd"; c-basic-offset: 4; -*-*/ 00035 #ifndef _GENERAL_H_ 00036 #define _GENERAL_H_ 00037 00038 #include <stdlib.h> 00039 00040 #ifdef __cplusplus 00041 #define EXTERN_C extern "C" 00042 #else 00043 #define EXTERN_C 00044 #endif 00045 00046 #if defined(__cplusplus) 00047 #define RESTRICT 00048 #else 00049 /* We really do want to take advantage of the restrict keyword... */ 00050 #define RESTRICT restrict 00051 #endif 00052 00053 #if !defined(__CVERSION) 00054 #define __CVERSION__ 00055 #endif 00056 00057 #include "functionals.h" 00058 00059 #include "basisinfo.h" 00060 #include "molecule.h" 00061 #include "grid_reader.h" 00062 00063 /* Match Fortran name mangling. If the Fortran compiler does not 00064 * mangle names, define NO_UNDERSCORE in CFLAGS. g77 and compaq fort 00065 * (cryptically referred to with HAVE_GCPP below) for linux-alpha both 00066 * insert a second underscore if routine name contains at least one 00067 * underscore /hjaaj Oct04 */ 00068 #ifdef NO_UNDERSCORE 00069 #define FSYM(a) a 00070 #define FSYM2(a) a 00071 #else 00072 #define FSYM(a) a ## _ 00073 #if defined(VAR_G77) || defined(HAVE_GCPP) 00074 #define FSYM2(a) a ## __ 00075 #else 00076 #define FSYM2(a) a ## _ 00077 #endif 00078 #endif 00079 00080 #if defined(VAR_PGF77) 00081 #define __FUNCTION__ "PGI_does_not_define__FUNCTION__" 00082 #endif 00083 #if defined(SYS_SUN) 00084 #define __FUNCTION__ "SUNs CC compiler_does_not_define__FUNCTION__" 00085 #endif 00086 #if defined(SYS_IRIX) 00087 #define __FUNCTION__ "SGIs CC compiler_does_not_define__FUNCTION__" 00088 #endif 00089 #if defined(SYS_DEC) 00090 #define __FUNCTION__ "DEC CC compiler does not define __FUNCTION__" 00091 #endif 00092 00093 #define ELEMENTS(arr) (sizeof(arr)/sizeof(arr[0])) 00094 00095 00096 EXTERN_C void dftpot0_(FirstDrv *ds, const real* weight, const FunDensProp* dp); 00097 EXTERN_C void dftpot1_(SecondDrv *ds, const real* w, const FunDensProp* dp, 00098 const int* triplet); 00099 00100 EXTERN_C int dft_setfunc(const char *line); 00101 EXTERN_C void grid_set_tmpdir(const char *tmpdir); 00102 00103 00104 EXTERN_C real dft_get_xc(int nElectrons, const real* dmat, 00105 const BasisInfoStruct *bis, const Molecule *mol, 00106 const Dft::GridParams& gss, 00107 real* ksm, real* edfty, 00108 int nThreads); 00109 EXTERN_C real dft_get_uxc(int nElectrons, 00110 const real* dmata, const real *dmatb, 00111 const BasisInfoStruct *bis, const Molecule *mol, 00112 const Dft::GridParams& gss, 00113 real* xca, real *xcb, real* edfty, 00114 int nThreads); 00115 00116 /* Property evaluators */ 00117 typedef void (*DFTPropEvalMaster)(void); 00118 typedef void (*DFTPropEvalSlave)(real* work, int* lwork, const int* iprint); 00119 00120 extern int (*fort_print)(const char* format, ...); 00121 00122 00123 #if !defined __inline__ 00124 /* inline some stuff whenever possible */ 00125 #define __inline__ 00126 #endif 00127 00128 #endif