ERKALE
ERKALE - DFT from Hel
 All Classes Functions Variables Friends Pages
global.h
1 /*
2  * This source code is part of
3  *
4  * E R K A L E
5  * -
6  * DFT from Hel
7  *
8  * Written by Susi Lehtola, 2010-2013
9  * Copyright (c) 2010-2013, Susi Lehtola
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  */
16 
65 #ifndef ERKALE_GLOBAL
66 #define ERKALE_GLOBAL
67 
68 // Disable bounds checking in Armadillo.
69 #define ARMA_NO_DEBUG
70 // Don't use Armadillo wrapper library
71 #define ARMA_DONT_USE_WRAPPER
72 // We need BLAS
73 #define ARMA_USE_BLAS
74 // and LAPACK
75 #define ARMA_USE_LAPACK
76 
77 // Ångström in atomic units
78 #define ANGSTROMINBOHR 1.8897261
79 // Atomic unit in eV, http://physics.nist.gov/cgi-bin/cuu/Value?threv
80 #define HARTREEINEV 27.21138505
81 // Atomic unit in debye, http://en.wikipedia.org/wiki/Debye
82 #define AUINDEBYE 0.393430307
83 // Fine structure constant
84 #define FINESTRUCT 7.2973525540510957E-3
85 
86 // Degree in radians
87 #define DEGINRAD (M_PI/180.0)
88 
89 // Initial tolerance, when density-based screening is used
90 #define ROUGHTOL 1e-9
91 // Fine tolance after initial convergence has been achieved (minimum)
92 #define FINETOL 1e-10
93 // When to switch to FINETOL (wrt. rms difference of density matrices)
94 #define TOLCHANGE 1e-5
95 
96 // Tolerance when screening is only wrt absolute value of integrals
97 #define STRICTTOL 1e-16
98 
99 // Threshold for linear independence
100 #define LINTHRES 1e-5
101 
102 // Shorthands
103 #define COMPLEX1 std::complex<double>(1.0,0.0)
104 #define COMPLEXI std::complex<double>(0.0,1.0)
105 
106 // Error info
107 #define ERROR_INFO() printf("\nError in function %s (file %s, near line %i)\n",__FUNCTION__,__FILE__,__LINE__);
108 // Print out location
109 #define LOC_INFO() {printf("Hello from function %s (file %s, near line %i)\n",__FUNCTION__,__FILE__,__LINE__); fflush(stdout);}
110 
111 // Check that matrix is of wanted size
112 #define MAT_SIZE_CHECK(M,NR,NC) if(M.n_rows != NR || M.n_cols != NC) { \
113  std::ostringstream oss; \
114  oss << #M << " should be " << NR << " x " << NC << " but is " << M.n_rows << " x " << M.n_cols << "!\n"; \
115  throw std::runtime_error(oss.str());}
116 // Resize matrix if necessary
117 #define MAT_RESIZE(M,NR,NC) if(M.n_rows != NR || M.n_cols != NC) { M.zeros(NR,NC);}
118 
119 #define fprint_copyright(file) \
120  fprintf(file,"(c) Susi Lehtola, 2010-2016.\n");
121 #define print_copyright() fprint_copyright(stdout)
122 
123 #define fprint_license(file) \
124  fprintf(file,"\n%s%s%s%s\n", \
125  "This program is free software; you can redistribute it and/or modify\n", \
126  "it under the terms of the GNU General Public License as published by\n", \
127  "the Free Software Foundation; either version 2 of the License, or\n", \
128  "(at your option) any later version.\n")
129 #define print_license() fprint_license(stdout)
130 
131 #define fprint_hostname(file) \
132  {char _hname[4096]; \
133  int _herr=gethostname(_hname,4096); \
134  if(! _herr) fprintf(file,"Running on host %s.\n\n",_hname); \
135  else fprintf(file,"Error: couldn't get hostname.\n");}
136 #define print_hostname() fprint_hostname(stdout)
137 
138 #endif