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 /** @file grid_params.h
31 
32     @brief Code organizing various settings related to grids used for
33     numerical integration.
34 
35     @author: Pawel Salek <em>responsible</em>
36 */
37 
38 #if !defined(_GRID_PARAMS_H_)
39 #define _GRID_PARAMS_H_ 1
40 
41 #include "grid_atomic.h"
42 
43 namespace Dft {
44 
45 /** A structure describing the HiCu grid settings. */
46 struct HiCuGridParams {
47   ergo_real maxError;
48   ergo_real box_size;
49   ergo_real start_box_size_debug;
50   int use_error_per_volume;
51   int do_double_checking;
52   int compare_to_refined;
53   int use_energy_criterion;
54   int use_energy_criterion_only;
55   int do_variation_checking;
56 };
57 
58 /** A structure describing the grid settings. */
59 struct GridParams {
60   /** All the dimensions of the smallest box must be below this
61       threshold.  The time goes quickly up as a function of box
62       size. Tweak it with an uttermost caution. */
63   ergo_real boxSize;
64   ergo_real radint;
65   int angmin;
66   int angmax;
67   typedef enum { GC2, LMG, TURBO } RadialScheme;
68   typedef enum { TYPE_STANDARD, TYPE_HICU } GridType;
69   RadialScheme radialGridScheme;
70   GridType  gridType;
71   bool cubicBoxes; /**< whether cubic grid boxes should be enforced.
72 		      Not needed apart from testing. */
73   /* The following are HiCu grid parameters. */
74   HiCuGridParams hicuParams;
75 explicit GridParams(ergo_real r_ = 1e-9, int a1 = 6, int a2 = 30,
76 	   ergo_real bs = 5.0, bool cubic = false,
77 	   ergo_real hicume = 1e-7,
78 	   ergo_real hicubs = 1.5, ergo_real hicusbsd = 0,
79 	   int hicuerrpervol = 0,
80 	   int hicudodoublecheck = 1,
81 	   int hicuctr = 0, int hicuuec = 0,int hicuueco = 0,
82 	   int hicudovarcheck = 0)
boxSizeGridParams83 : boxSize(bs), radint(r_), angmin(a1), angmax(a2), radialGridScheme(LMG),
84     gridType(TYPE_STANDARD), cubicBoxes(cubic)
85   {
86     hicuParams.maxError = hicume;
87     hicuParams.box_size = hicubs;
88     hicuParams.start_box_size_debug = hicusbsd;
89     hicuParams.use_error_per_volume = hicuerrpervol;
90     hicuParams.do_double_checking = hicudodoublecheck;
91     hicuParams.compare_to_refined = hicuctr;
92     hicuParams.use_energy_criterion = hicuuec;
93     hicuParams.use_energy_criterion_only = hicuueco;
94     hicuParams.do_variation_checking = hicudovarcheck;
95   }
96 };
97 
98 }
99 #endif /* _GRID_PARAMS_H_ */
100