ergo
scf.h
Go to the documentation of this file.
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 
38 #ifndef SCF_HEADER
39 #define SCF_HEADER
40 
41 #include <string.h>
42 
43 #include "molecule.h"
44 #include "basisinfo.h"
45 #include "integrals_2el.h"
46 #include "matrix_typedefs.h"
47 
48 
49 namespace SCF {
50 
51 static const int DISTURB_ELEMENT_MAX_COUNT = 60;
52 
53 struct Options {
55  std::string method_and_basis_set;
66  std::string checkpoint_IDstr;
85  int use_dft;
153  std::string eigenvectors_method;
160 
163  method_and_basis_set("N/A"),
164  electric_field(0,0,0),
168  convergence_threshold(2e-7),
169  step_length_giveup(0.00005),
170  step_length_start(0.4),
174  checkpoint_IDstr(""),
182  cht_leavesSizeMax(1024),
183  cht_blocksize(64),
189  purification_maxmul(100),
193  use_dft(0),
200  skip_H_core(0),
203  force_restricted(0),
210  use_diis_always(0),
226  image_view_axis(),
239  do_acc_scan_J(0),
240  do_acc_scan_K(0),
241  do_acc_scan_Vxc(0),
243  scan_no_of_steps(16),
244  scan_start_thresh(1e-9),
260  eigenvectors_method("square"),
263  eigensolver_maxiter(200),
267  {
268  memset(disturbedElementIndexVector, 0,
270  }
271 };
272 
276 struct MatOptions {
278  std::vector<int> permutationHML;
279  std::vector<int> inversePermutationHML;
287  int threads;
291 
293  sparse_threshold(1e-8),
294  threshold_inch(1e-10),
299  threads(1),
300  parallelLevel(1),
301  /* 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.
302  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. */
305  {};
307  }
310  void prepare(const BasisInfoStruct& basisInfo);
311 };
312 
315  {}
316 
317 };
318 
319 } /* end of SCF name space */
320 
321 
322 
323 #endif
SCF::Options::store_all_eigenvalues_to_file
int store_all_eigenvalues_to_file
Definition: scf.h:124
template_blas_sqrt
Treal template_blas_sqrt(Treal x)
SCF::Options::scan_step_factor
ergo_real scan_step_factor
Definition: scf.h:138
mat::mixedNorm
@ mixedNorm
Definition: matInclude.h:139
SCF::Options::number_of_unoccupied_eigenvectors
int number_of_unoccupied_eigenvectors
Definition: scf.h:150
SCF::Options::output_expected_values_pos_operator
int output_expected_values_pos_operator
Definition: scf.h:112
SCF::Options::purification_truncation_norm
mat::normType purification_truncation_norm
Definition: scf.h:72
Vector3D
A representation of Vector or point in cartesian space.
Definition: molecule.h:60
SCF::MatOptions::sparse_threshold
ergo_real sparse_threshold
threshold value for sparse matrix truncation.
Definition: scf.h:280
SCF::Options::do_acc_scan_J
int do_acc_scan_J
Definition: scf.h:132
SCF::Options::starting_guess_disturbance
ergo_real starting_guess_disturbance
Definition: scf.h:89
SCF::Options::step_length_start
ergo_real step_length_start
Definition: scf.h:62
SCF::DISTURB_ELEMENT_MAX_COUNT
static const int DISTURB_ELEMENT_MAX_COUNT
Definition: scf.h:51
BasisInfoStruct::noOfBasisFuncs
int noOfBasisFuncs
Definition: basisinfo.h:120
SCF::Options::verify_gradient_fixeddens
int verify_gradient_fixeddens
Definition: scf.h:159
SCF::Options::eigensolver_maxiter
int eigensolver_maxiter
Definition: scf.h:156
SCF::Options::image_view_axis
int image_view_axis
Definition: scf.h:119
SCF::Options::force_unrestricted
int force_unrestricted
use an unrestricted det.
Definition: scf.h:97
AllocatorManager.h
Code for AllocatorManager class used for memory allocation/deallocation in matrix library....
SCF::Options::save_permuted_F_matrix_in_bin
int save_permuted_F_matrix_in_bin
Definition: scf.h:128
SCF::Options::create_mtx_file_H_core
int create_mtx_file_H_core
Definition: scf.h:140
SCF::Options::disturbedElementIndexVector
int disturbedElementIndexVector[DISTURB_ELEMENT_MAX_COUNT]
Definition: scf.h:91
LOG_CAT_ERROR
#define LOG_CAT_ERROR
Definition: output.h:47
SCF::Options::write_overlap_matrix
int write_overlap_matrix
Definition: scf.h:129
SCF::MatOptions::prepare
void prepare(const BasisInfoStruct &basisInfo)
after the parameters are called, this routine is to be called to figure out the basis set permutation...
Definition: scf.cc:53
SCF::OutputOptions
Definition: scf.h:313
mat::AllocatorManager::init
void init(size_t noOfRealsPerBuffer_, size_t noOfBuffers_)
Definition: AllocatorManager.h:58
ergo_real
double ergo_real
Definition: realtype.h:69
SCF::Options::eigensolver_accuracy
ergo_real eigensolver_accuracy
Definition: scf.h:155
SCF::Options::create_mtx_file_S
int create_mtx_file_S
Definition: scf.h:139
SCF::Options::use_simple_dense_H_core
int use_simple_dense_H_core
Definition: scf.h:94
SCF::Options::calculation_identifier
std::string calculation_identifier
Definition: scf.h:54
SCF::Options::output_density_images_only
int output_density_images_only
Definition: scf.h:114
SCF::Options::purification_maxmul
int purification_maxmul
Definition: scf.h:81
mat::Params::setNProcs
static void setNProcs(unsigned int const nP)
Definition: matInclude.h:112
SCF::Options::min_number_of_iterations
int min_number_of_iterations
Definition: scf.h:109
SCF::Options::shift_using_prev_density_matrix
ergo_real shift_using_prev_density_matrix
Definition: scf.h:92
mat::Params::getMatrixParallelLevel
static unsigned int getMatrixParallelLevel()
Definition: matInclude.h:120
SCF::Options::purification_stop_crit_norm
mat::normType purification_stop_crit_norm
Definition: scf.h:73
SCF::MatOptions::parallelLevel
int parallelLevel
Definition: scf.h:288
SCF::Options::electric_field
Vector3D electric_field
Definition: scf.h:56
SCF::Options::purification_ignore_failure
int purification_ignore_failure
Definition: scf.h:83
BasisInfoStruct
Definition: basisinfo.h:112
SCF::Options::no_of_threads_for_V
int no_of_threads_for_V
Definition: scf.h:79
SCF::Options::max_number_of_iterations
int max_number_of_iterations
Definition: scf.h:110
SCF::Options::purification_use_rand_perturbation_for_alleigsint
int purification_use_rand_perturbation_for_alleigsint
Definition: scf.h:84
SCF::Options::compute_core_density
int compute_core_density
Definition: scf.h:116
SCF::Options::step_length_giveup
ergo_real step_length_giveup
Definition: scf.h:61
SCF::Options::sparse_threshold_for_Z
ergo_real sparse_threshold_for_Z
Definition: scf.h:59
SCF::Options::eigenvectors_iterative_method
std::string eigenvectors_iterative_method
Definition: scf.h:154
SCF::Options::break_on_energy_increase
int break_on_energy_increase
Definition: scf.h:95
scf.h
Code for classes containing various options related to self-consistent field (SCF) calculations.
mat::Params::setMatrixParallelLevel
static void setMatrixParallelLevel(unsigned int const mPL)
Definition: matInclude.h:129
SCF::MatOptions
An object respresenting the configuration of the matrix library.
Definition: scf.h:276
SCF::MatOptions::~MatOptions
~MatOptions()
Definition: scf.h:306
SCF::Options::write_diag_dens_to_file
int write_diag_dens_to_file
Definition: scf.h:88
SCF::Options::puri_eig_acc_factor_for_guess
ergo_real puri_eig_acc_factor_for_guess
Definition: scf.h:63
SCF::Options::use_diag_on_error_guess
int use_diag_on_error_guess
Definition: scf.h:123
SCF::Options::gap_expected_lower_bound
ergo_real gap_expected_lower_bound
Definition: scf.h:71
SCF::Options::cht_blocksize
int cht_blocksize
Definition: scf.h:75
SCF::Options::create_checkpoints
int create_checkpoints
Definition: scf.h:65
SCF::Options::do_f_thresh_verification
int do_f_thresh_verification
Definition: scf.h:104
prepareMatrixSizesAndBlocks
mat::SizesAndBlocks prepareMatrixSizesAndBlocks(int n_basis_functions, int sparse_block_size, int factor1, int factor2, int factor3)
Definition: matrix_utilities.cc:47
SCF::Options::number_of_occupied_eigenvectors
int number_of_occupied_eigenvectors
Definition: scf.h:149
SCF::Options::skip_H_core
int skip_H_core
Definition: scf.h:93
SCF::Options::do_report_density_diff
int do_report_density_diff
Definition: scf.h:107
SCF::Options::create_mtx_files_S_and_quit
int create_mtx_files_S_and_quit
Definition: scf.h:144
SCF::Options::output_mulliken_pop
int output_mulliken_pop
Definition: scf.h:157
SCF::MatOptions::threads
int threads
Definition: scf.h:287
getMatrixPermutation
void getMatrixPermutation(const BasisInfoStruct &basisInfo, int sparse_block_size, int factor1, int factor2, int factor3, std::vector< int > &permutation, std::vector< int > &inversePermutation)
Definition: matrix_utilities.cc:187
SCF::Options::subspace_factor_fock
ergo_real subspace_factor_fock
Definition: scf.h:76
SCF::Options::electronic_temperature
ergo_real electronic_temperature
Definition: scf.h:57
SCF::MatOptions::inversePermutationHML
std::vector< int > inversePermutationHML
Definition: scf.h:279
SCF::MatOptions::sparse_matrix_block_factor_2
int sparse_matrix_block_factor_2
Definition: scf.h:285
SCF::Options::output_density_images
int output_density_images
Definition: scf.h:113
mat::Params::getNProcs
static unsigned int getNProcs()
Definition: matInclude.h:103
SCF::Options::no_of_core_electrons
int no_of_core_electrons
Definition: scf.h:117
SCF::Options::compute_gradient_fixeddens
int compute_gradient_fixeddens
Definition: scf.h:158
SCF::Options::create_mtx_files_dipole
int create_mtx_files_dipole
Definition: scf.h:143
SCF::Options::checkpoint_IDstr
std::string checkpoint_IDstr
Definition: scf.h:66
mat::getMachineEpsilon
static Treal getMachineEpsilon()
Definition: matInclude.h:147
SCF::Options::use_diag_guess_from_file
int use_diag_guess_from_file
Definition: scf.h:87
SCF::Options::purification_create_m_files
int purification_create_m_files
Definition: scf.h:82
SCF::MatOptions::sparse_matrix_block_size
int sparse_matrix_block_size
Definition: scf.h:283
SCF::Options::analyze_result_after_scf
int analyze_result_after_scf
Definition: scf.h:131
matrix_utilities.h
Utilities related to the hierarchical matrix library (HML), including functions for setting up permut...
SCF::Options::purification_with_acceleration
int purification_with_acceleration
Definition: scf.h:69
SCF::Options::force_restricted
int force_restricted
use a restricted determinant for open shell.
Definition: scf.h:96
SCF::MatOptions::use_allocator_manager
int use_allocator_manager
Definition: scf.h:290
SCF::Options::create_mtx_files_F
int create_mtx_files_F
Definition: scf.h:141
SCF::Options::output_homo_and_lumo_eigenvectors
int output_homo_and_lumo_eigenvectors
Definition: scf.h:148
SCF::Options::starting_guess_spin_diff
int starting_guess_spin_diff
Definition: scf.h:99
utilities.h
Basic OS access utilities.
SCF::Options::sg_disturb_specific_elements
int sg_disturb_specific_elements
Definition: scf.h:90
mat
Definition: allocate.cc:39
SCF::Options::create_mtx_files_D
int create_mtx_files_D
Definition: scf.h:142
LOG_CAT_INFO
#define LOG_CAT_INFO
Definition: output.h:49
SCF::Options::use_diag_on_error
int use_diag_on_error
Definition: scf.h:122
SCF::Options::purification_conv_limit
ergo_real purification_conv_limit
Definition: scf.h:64
SCF::Options::try_eigv_on_next_iteration_if_fail
int try_eigv_on_next_iteration_if_fail
Definition: scf.h:125
SCF::OutputOptions::OutputOptions
OutputOptions()
Definition: scf.h:314
SCF::MatOptions::permutationHML
std::vector< int > permutationHML
Definition: scf.h:278
SCF::MatOptions::threshold_inch
ergo_real threshold_inch
Truncation threshold in INCH function.
Definition: scf.h:282
matrix_typedefs.h
Header file with typedefs for matrix and vector types. The levels of hierarchic matrices are defined ...
SCF::Options::use_simple_starting_guess
int use_simple_starting_guess
Definition: scf.h:86
LOG_AREA_MAIN
#define LOG_AREA_MAIN
Definition: output.h:57
basisinfo.h
Code for setting up basis functions starting from shells.
SCF::Options::jump_over_X_iter_proj_method
int jump_over_X_iter_proj_method
Definition: scf.h:151
mat::normType
normType
Definition: matInclude.h:139
SCF::Options::save_full_matrices_for_matlab
int save_full_matrices_for_matlab
Definition: scf.h:130
integrals_2el.h
Parameters related to integral evaluation.
SCF::Options::method_and_basis_set
std::string method_and_basis_set
Definition: scf.h:55
SCF::MatOptions::no_of_buffers_per_allocator
int no_of_buffers_per_allocator
Definition: scf.h:289
SCF::Options::run_shift_and_square_method_on_F
int run_shift_and_square_method_on_F
Definition: scf.h:127
SCF::Options::no_of_impr_req_for_diis
int no_of_impr_req_for_diis
Definition: scf.h:102
SCF::Options::purification_subspace_err_limit
ergo_real purification_subspace_err_limit
Definition: scf.h:68
SCF::Options::output_density_at_every_step
int output_density_at_every_step
Definition: scf.h:111
SCF::Options::use_dft
int use_dft
Definition: scf.h:85
SCF::Options::subspace_factor_dens
ergo_real subspace_factor_dens
Definition: scf.h:77
SCF::Options::box_size_for_V_and_T
ergo_real box_size_for_V_and_T
Definition: scf.h:80
SCF::Options::eigenvectors_method
std::string eigenvectors_method
Definition: scf.h:153
SCF::Options::spin_flip_atom_count
int spin_flip_atom_count
Definition: scf.h:98
SCF::Options::max_restart_count
int max_restart_count
Definition: scf.h:101
SCF::Options::use_new_stopping_criterion
int use_new_stopping_criterion
Definition: scf.h:70
SCF::Options::create_basis_func_coord_file
int create_basis_func_coord_file
Definition: scf.h:146
SCF::Options::scan_do_invcholfactor_transf
int scan_do_invcholfactor_transf
Definition: scf.h:135
molecule.h
Class representing a molecule as a set of atoms with assiciated coordinates and charges of the atomic...
SCF::Options::go_back_X_iter_proj_method
int go_back_X_iter_proj_method
Definition: scf.h:152
SCF::MatOptions::sparse_matrix_block_factor_3
int sparse_matrix_block_factor_3
Definition: scf.h:284
SCF::Options::Options
Options()
Initializes all the fields to sane values.
Definition: scf.h:162
SCF::Options::write_guess_density_only
int write_guess_density_only
Definition: scf.h:115
SCF::Options::create_2el_integral_m_file
int create_2el_integral_m_file
Definition: scf.h:145
SCF::Options::output_density_images_boxwidth
ergo_real output_density_images_boxwidth
Definition: scf.h:118
SCF::Options::do_acc_scan_Vxc
int do_acc_scan_Vxc
Definition: scf.h:134
SCF::Options::use_diis_always
int use_diis_always
Definition: scf.h:103
SCF::Options::puri_compute_eigv_in_each_iteration
int puri_compute_eigv_in_each_iteration
Definition: scf.h:126
SCF::Options::use_diagonalization
int use_diagonalization
Definition: scf.h:121
mat::SizesAndBlocks
Describes dimensions of matrix and its blocks on all levels.
Definition: SizesAndBlocks.h:45
mat::AllocatorManager::instance
static AllocatorManager & instance()
SCF::Options::use_prev_vector_as_initial_guess
int use_prev_vector_as_initial_guess
Definition: scf.h:147
SCF::Options
Definition: scf.h:53
SCF::MatOptions::size_block_info
mat::SizesAndBlocks size_block_info
Definition: scf.h:277
SCF::Options::max_no_of_diis_matrices
int max_no_of_diis_matrices
Definition: scf.h:100
SCF::Options::use_artificial_subspace_disturbances
int use_artificial_subspace_disturbances
Definition: scf.h:78
SCF::MatOptions::sparse_matrix_block_factor_1
int sparse_matrix_block_factor_1
Definition: scf.h:286
SCF::Options::convergence_threshold
ergo_real convergence_threshold
Definition: scf.h:60
SCF::Options::cht_leavesSizeMax
int cht_leavesSizeMax
Definition: scf.h:74
SCF::Options::no_of_careful_first_scf_steps
int no_of_careful_first_scf_steps
Definition: scf.h:106
SCF::Options::output_statistics_mfiles
int output_statistics_mfiles
Definition: scf.h:105
SCF
Definition: scf.h:49
do_output
void do_output(int logCategory, int logArea, const char *format,...)
Definition: output.cc:53
SCF::MatOptions::MatOptions
MatOptions()
Definition: scf.h:292
SCF::Options::sparse_threshold_for_S
ergo_real sparse_threshold_for_S
Definition: scf.h:58
SCF::Options::save_final_potential
int save_final_potential
Definition: scf.h:120
SCF::Options::do_acc_scan_K
int do_acc_scan_K
Definition: scf.h:133
SCF::Options::purification_eigvalue_err_limit
ergo_real purification_eigvalue_err_limit
Definition: scf.h:67
output.h
Functionality for writing output messages to a text file.
SCF::Options::scan_start_thresh
ergo_real scan_start_thresh
Definition: scf.h:137
SCF::Options::error_maxabs_for_diis
ergo_real error_maxabs_for_diis
Definition: scf.h:108
SCF::Options::scan_no_of_steps
int scan_no_of_steps
Definition: scf.h:136