ergo
scf.h
Go to the documentation of this file.
1 /* Ergo, version 3.4, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2014 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 #ifndef SCFHEADER
29 #define SCFHEADER
30 
31 #include <string.h>
32 
33 #include "molecule.h"
34 #include "basisinfo.h"
35 #include "integrals_2el.h"
36 #include "matrix_typedefs.h"
37 
38 
39 namespace SCF {
40 
41 static const int DISTURB_ELEMENT_MAX_COUNT = 60;
42 
43 struct Options {
45  std::string method_and_basis_set;
67  int use_dft;
133 
138 
140  Options() : calculation_identifier("N/A"),
141  method_and_basis_set("N/A"),
142  electric_field(0,0,0),
143  electronic_temperature(0),
144  sparse_threshold_for_S(1e-9),
145  sparse_threshold_for_Z(1e-8),
146  convergence_threshold(2e-7),
147  step_length_giveup(0.00005),
148  step_length_start(0.4),
149  puri_eig_acc_factor_for_guess(1e-2),
150  purification_conv_limit(0.1),
151  purification_eigvalue_err_limit(1e-8),
152  purification_subspace_err_limit(1e-6),
153  gap_expected_lower_bound(0.05),
154  purification_truncation_norm(mat::euclNorm),
155  subspace_factor_fock(0.1),
156  subspace_factor_dens(0.1),
157  use_artificial_subspace_disturbances(0),
158  no_of_threads_for_V(1),
159  purification_maxmul(100),
160  purification_create_m_files(0),
161  purification_ignore_failure(0),
162  purification_use_rand_perturbation_for_alleigsint(0),
163  use_dft(0),
164  use_simple_starting_guess(0),
165  use_diag_guess_from_file(0),
166  write_diag_dens_to_file(0),
167  starting_guess_disturbance(0.0),
168  sg_disturb_specific_elements(0),
169  shift_using_prev_density_matrix(0.0),
170  skip_H_core(0),
171  use_simple_dense_H_core(0),
172  break_on_energy_increase(0),
173  force_restricted(0),
174  force_unrestricted(0),
175  spin_flip_atom_count(0),
176  starting_guess_spin_diff(0),
177  max_no_of_diis_matrices(10),
178  max_restart_count(2),
179  no_of_impr_req_for_diis(4),
180  use_diis_always(0),
181  do_f_thresh_verification(0),
182  do_comparison_to_simple_purification(0),
183  do_puri_mmul_tests(0),
184  output_statistics_mfiles(0),
185  do_sparsity_investigation(0),
186  do_sparsity_investigation_reppuri(0),
187  sparsity_plots_resolution_r(100),
188  sparsity_plots_resolution_m(100),
189  no_of_careful_first_scf_steps(0),
190  do_report_density_diff(1),
191  error_maxabs_for_diis(0.5),
192  min_number_of_iterations(),
193  max_number_of_iterations(),
194  output_density_at_every_step(1),
195  output_csr_matrices_for_gao(0),
196  output_density_images(0),
197  output_density_images_only(0),
198  write_guess_density_only(0),
199  compute_core_density(0),
200  no_of_core_electrons(0),
201  output_density_images_boxwidth(0.5),
202  image_view_axis(),
203  save_final_potential(0),
204  use_diagonalization(0),
205  use_diag_on_error(1),
206  use_diag_on_error_guess(1),
207  write_overlap_matrix(0),
208  save_full_matrices_for_matlab(0),
209  analyze_result_after_scf(0),
210  do_acc_scan_J(0),
211  do_acc_scan_K(0),
212  do_acc_scan_Vxc(0),
213  scan_do_invcholfactor_transf(1),
214  scan_no_of_steps(16),
215  scan_start_thresh(1e-9),
216  scan_step_factor(sqrt((ergo_real)10)),
217  create_mtx_file_S(0),
218  create_mtx_file_H_core(0),
219  create_mtx_files_F(0),
220  create_mtx_files_D(0),
221  create_mtx_files_dipole(0),
222  create_2el_integral_m_file(0),
223  create_basis_func_coord_file(0),
224  output_homo_and_lumo_eigenvectors(0),
225  output_mulliken_pop(0),
226  compute_gradient_fixeddens(0),
227  verify_gradient_fixeddens(0),
228  use_stochastic_orbs(0),
229  stochastic_orbs_no_of_vectors(100),
230  stochastic_orbs_use_unit_vectors(0),
231  stochastic_orbs_rand_param(1)
232  {
233  memset(disturbedElementIndexVector, 0,
234  sizeof(disturbedElementIndexVector));
235  }
236 };
237 
241 struct MatOptions {
243  std::vector<int> permutationHML;
244  std::vector<int> inversePermutationHML;
252  int threads;
255 
257  sparse_threshold(1e-8),
258  threshold_inch(0),
259  sparse_matrix_block_size(32),
260  sparse_matrix_block_factor_3(8),
261  sparse_matrix_block_factor_2(8),
262  sparse_matrix_block_factor_1(32),
263  threads(1),
264  parallelLevel(1),
265  /* FIXME: there should be a param to set no_of_buffers_per_allocator, for large calculations it needs to be larger, e.g. 10 x larger seems to give much better performance of matrix operations for large cases.
266  This is also connected to blocksize, maybe the best solution would be to have a param determining the number of MegaBytes per allocator or something like that. */
267  no_of_buffers_per_allocator(20000)
268  {};
270  }
273  void prepare(const BasisInfoStruct& basisInfo);
274 };
275 
278  {}
279 
280 };
281 
282 } /* end of SCF name space */
283 
284 
285 
286 #endif
int min_number_of_iterations
Definition: scf.h:97
int use_simple_dense_H_core
Definition: scf.h:76
int output_density_images_only
Definition: scf.h:102
int sparsity_plots_resolution_m
Definition: scf.h:93
int purification_create_m_files
Definition: scf.h:64
int max_no_of_diis_matrices
Definition: scf.h:82
ergo_real subspace_factor_dens
Definition: scf.h:60
double ergo_real
Definition: realtype.h:53
int do_acc_scan_Vxc
Definition: scf.h:117
int no_of_impr_req_for_diis
Definition: scf.h:84
int create_mtx_file_S
Definition: scf.h:122
int compute_core_density
Definition: scf.h:104
int create_mtx_file_H_core
Definition: scf.h:123
Definition: scf.h:276
OutputOptions()
Definition: scf.h:277
ergo_real sparse_threshold_for_Z
Definition: scf.h:49
static const int DISTURB_ELEMENT_MAX_COUNT
Definition: scf.h:41
ergo_real error_maxabs_for_diis
Definition: scf.h:96
std::vector< int > inversePermutationHML
Definition: scf.h:244
ergo_real starting_guess_disturbance
Definition: scf.h:71
int do_f_thresh_verification
Definition: scf.h:86
int use_diis_always
Definition: scf.h:85
int output_csr_matrices_for_gao
Definition: scf.h:100
int no_of_careful_first_scf_steps
Definition: scf.h:94
ergo_real gap_expected_lower_bound
Definition: scf.h:57
std::vector< int > permutationHML
Definition: scf.h:243
int do_acc_scan_K
Definition: scf.h:116
int no_of_threads_for_V
Definition: scf.h:62
int sparse_matrix_block_factor_2
Definition: scf.h:250
A representation of Vector or point in cartesian space.
Definition: molecule.h:49
int no_of_core_electrons
Definition: scf.h:105
int do_puri_mmul_tests
Definition: scf.h:88
int stochastic_orbs_use_unit_vectors
Definition: scf.h:136
int write_diag_dens_to_file
Definition: scf.h:70
ergo_real puri_eig_acc_factor_for_guess
Definition: scf.h:53
ergo_real scan_step_factor
Definition: scf.h:121
int sparse_matrix_block_factor_3
Definition: scf.h:249
Definition: allocate.cc:30
Describes dimensions of matrix and its blocks on all levels.
Definition: SizesAndBlocks.h:37
int do_comparison_to_simple_purification
Definition: scf.h:87
ergo_real step_length_giveup
Definition: scf.h:51
ergo_real purification_conv_limit
Definition: scf.h:54
int use_stochastic_orbs
Definition: scf.h:134
int disturbedElementIndexVector[DISTURB_ELEMENT_MAX_COUNT]
Definition: scf.h:73
~MatOptions()
Definition: scf.h:269
mat::normType purification_truncation_norm
Definition: scf.h:58
int max_number_of_iterations
Definition: scf.h:98
int create_basis_func_coord_file
Definition: scf.h:128
int force_unrestricted
use an unrestricted det.
Definition: scf.h:79
ergo_real purification_subspace_err_limit
Definition: scf.h:56
int scan_do_invcholfactor_transf
Definition: scf.h:118
int save_final_potential
Definition: scf.h:108
ergo_real step_length_start
Definition: scf.h:52
int use_artificial_subspace_disturbances
Definition: scf.h:61
int write_overlap_matrix
Definition: scf.h:112
int create_mtx_files_dipole
Definition: scf.h:126
int do_sparsity_investigation
Definition: scf.h:90
int save_full_matrices_for_matlab
Definition: scf.h:113
Vector3D electric_field
Definition: scf.h:46
int parallelLevel
Definition: scf.h:253
Definition: matInclude.h:135
int use_diagonalization
Definition: scf.h:109
int do_sparsity_investigation_reppuri
Definition: scf.h:91
std::string calculation_identifier
Definition: scf.h:44
int force_restricted
use a restricted determinant for open shell.
Definition: scf.h:78
ergo_real threshold_inch
Truncation threshold in INCH function.
Definition: scf.h:247
int create_mtx_files_F
Definition: scf.h:124
int purification_use_rand_perturbation_for_alleigsint
Definition: scf.h:66
int skip_H_core
Definition: scf.h:75
ergo_real sparse_threshold
threshold value for sparse matrix truncation.
Definition: scf.h:245
int stochastic_orbs_rand_param
Definition: scf.h:137
Options()
Initializes all the fields to sane values.
Definition: scf.h:140
int verify_gradient_fixeddens
Definition: scf.h:132
int no_of_buffers_per_allocator
Definition: scf.h:254
int stochastic_orbs_no_of_vectors
Definition: scf.h:135
int use_diag_on_error_guess
Definition: scf.h:111
int output_statistics_mfiles
Definition: scf.h:89
int starting_guess_spin_diff
Definition: scf.h:81
int sparse_matrix_block_size
Definition: scf.h:248
int do_acc_scan_J
Definition: scf.h:115
int analyze_result_after_scf
Definition: scf.h:114
MatOptions()
Definition: scf.h:256
ergo_real purification_eigvalue_err_limit
Definition: scf.h:55
int output_mulliken_pop
Definition: scf.h:130
int output_density_at_every_step
Definition: scf.h:99
int break_on_energy_increase
Definition: scf.h:77
int image_view_axis
Definition: scf.h:107
ergo_real scan_start_thresh
Definition: scf.h:120
Definition: basisinfo.h:111
Definition: scf.h:43
int use_dft
Definition: scf.h:67
int sg_disturb_specific_elements
Definition: scf.h:72
int threads
Definition: scf.h:252
int scan_no_of_steps
Definition: scf.h:119
Header file with typedefs for matrix and vector types.
ergo_real electronic_temperature
Definition: scf.h:47
int output_homo_and_lumo_eigenvectors
Definition: scf.h:129
int purification_maxmul
Definition: scf.h:63
ergo_real output_density_images_boxwidth
Definition: scf.h:106
std::string method_and_basis_set
Definition: scf.h:45
int use_simple_starting_guess
Definition: scf.h:68
ergo_real shift_using_prev_density_matrix
Definition: scf.h:74
int max_restart_count
Definition: scf.h:83
int purification_ignore_failure
Definition: scf.h:65
ergo_real sparse_threshold_for_S
Definition: scf.h:48
int use_diag_on_error
Definition: scf.h:110
int create_2el_integral_m_file
Definition: scf.h:127
int write_guess_density_only
Definition: scf.h:103
int output_density_images
Definition: scf.h:101
int sparse_matrix_block_factor_1
Definition: scf.h:251
ergo_real subspace_factor_fock
Definition: scf.h:59
Definition: scf.h:39
An object respresenting the configuration of the matrix library.
Definition: scf.h:241
int sparsity_plots_resolution_r
Definition: scf.h:92
int use_diag_guess_from_file
Definition: scf.h:69
int spin_flip_atom_count
Definition: scf.h:80
int create_mtx_files_D
Definition: scf.h:125
int do_report_density_diff
Definition: scf.h:95
mat::SizesAndBlocks size_block_info
Definition: scf.h:242
int compute_gradient_fixeddens
Definition: scf.h:131
normType
Definition: matInclude.h:135
ergo_real convergence_threshold
Definition: scf.h:50