ergo
SCF_restricted.h
Go to the documentation of this file.
1/* Ergo, version 3.8.2, a program for linear scaling electronic structure
2 * calculations.
3 * Copyright (C) 2023 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_RESTRICTED_HEADER
39#define SCF_RESTRICTED_HEADER
40
41#include "SCF_general.h"
42
43#include "GetDensFromFock.h"
44
45
47{
48 public:
49
50 // Constructor
51 SCF_restricted(const Molecule& molecule_,
52 const Molecule& extraCharges_,
53 const BasisInfoStruct & basisInfo_,
54 const IntegralInfo& integralInfo_,
55 const char* guessDmatFileNamePtr, // FIXME ELIAS: use std::string for this instead?
56 const JK::Params& J_K_paramsPtr,
57 const Dft::GridParams& gridParams_,
58 const SCF::Options& scfopts,
60 ergo_real threshold_integrals_1el_input);
61
62 // Destructor
64
65 void get_Fock_matrix(symmMatrix & FockMatrix_);
66 void get_density_matrix(symmMatrix & densityMatrix_);
67
68 private:
70 void check_params();
76 void calculate_energy();
77 void get_FDSminusSDF();
78 void get_error_measure();
79 void add_to_DIIS_list();
81 void combine_old_fock_matrices(ergo_real stepLength);
83 void clear_diis_list();
91 void get_expected_values_pos_operator(generalVector &eigVec, const char *vector_name);
93 void output_density_images_orbital(generalVector &eigVec, const std::string &filename_id);
98 void disturb_fock_matrix(ergo_real subspaceError);
99 void disturb_dens_matrix(ergo_real subspaceError);
100 void do_spin_flip(int atomCount);
101 void disturb_dens_matrix_exact(ergo_real subspaceError);
104 void create_mtx_files_F(int const scfIter);
105 void create_mtx_files_D(int const scfIter);
108 void create_eigenvectors_files() const;
109 void create_eigenvalues_files() const;
110 void create_eigvec_file(const generalVector &eigVec,
111 const char *vector_name,
112 const char *filename_id) const;
113 void create_gabedit_file() const;
118
119 void get_non_ort_err_mat_normalized_in_ort_basis(symmMatrix & randomMatrix, int transform_with_S_also);
122
123 void disturb_dens_matrix_exact_try(const symmMatrix & randomMatrix,
124 const symmMatrix & orgDensMatrix,
125 ergo_real disturbanceFactor,
126 ergo_real & resultSinTheta,
127 symmMatrix & resultDensMatrix);
128
135 symmMatrix F_ort_prev; // Used by purification
136 symmMatrix D_ort_prev; // Used for computing eigenvectors
140 // The following three matrices are only used when doing sparsity investigation, otherwise they are empty
144
145 std::vector<generalVector> eigVecOCC;
146 std::vector<generalVector> eigVecUNOCC;
147 std::vector<ergo_real> eigValOCC;
148 std::vector<ergo_real> eigValUNOCC;
149
154
155};
156
157
158
159
160
161#endif
Routines for getting density matrix from a given Fock matrix.
Class for self-consistent field (SCF) procedure; base class that can be used for both restricted and ...
Contains coefficients needed for quick integral evaluation.
Definition: integral_info.h:94
Representation of a molecule as a set of nuclei and total charge.
Definition: molecule.h:87
Definition: SCF_general.h:52
const SCF::Options & scfopts
Definition: SCF_general.h:86
const SCF::MatOptions & matOpts
Definition: SCF_general.h:87
Definition: SCF_restricted.h:47
void save_density_as_prevdens()
Definition: SCF_restricted.cc:1142
void output_sparsity_S_F_D(SCF_statistics &stats)
Definition: SCF_restricted.cc:589
void get_density_matrix(symmMatrix &densityMatrix_)
Definition: SCF_restricted.cc:97
void create_lumo_eigvec_file() const
symmMatrix K_matrix
Definition: SCF_restricted.h:142
symmMatrix FockMatrix
Definition: SCF_restricted.h:132
symmMatrix densityMatrix_core
Definition: SCF_restricted.h:130
symmMatrix F_ort_prev
Definition: SCF_restricted.h:135
void get_new_density_matrix()
Definition: SCF_restricted.cc:740
symmMatrix J_matrix
Definition: SCF_restricted.h:141
void update_best_fock_so_far()
Definition: SCF_restricted.cc:673
symmMatrix bestFockMatrixSoFar
Definition: SCF_restricted.h:137
void output_density_images()
Definition: SCF_restricted.cc:1027
symmMatrix twoel_matrix_core
Definition: SCF_restricted.h:131
std::vector< ergo_real > eigValUNOCC
Definition: SCF_restricted.h:148
intervalType homoInterval_F_ort_prev
Definition: SCF_restricted.h:150
void save_current_fock_as_fprev()
Definition: SCF_restricted.cc:729
void clear_error_matrices()
Definition: SCF_restricted.cc:723
void initialize_matrices()
Definition: SCF_restricted.cc:105
symmMatrix D_ort_prev
Definition: SCF_restricted.h:136
void get_non_ort_err_mat_normalized_in_ort_basis(symmMatrix &randomMatrix, int transform_with_S_also)
Definition: SCF_restricted.cc:1634
symmMatrix bestFockMatrixSoFar2
Definition: SCF_restricted.h:138
void add_to_DIIS_list()
Definition: SCF_restricted.cc:661
void transform_with_S(symmMatrix &A)
Transform matrix A to S*A*S.
Definition: SCF_restricted.cc:1607
std::vector< generalVector > eigVecOCC
Definition: SCF_restricted.h:145
symmMatrix Dprev
Definition: SCF_restricted.h:134
void create_mtx_files_D(int const scfIter)
Definition: SCF_restricted.cc:1214
void report_final_results()
Definition: SCF_restricted.cc:1131
void create_eigvec_file(const generalVector &eigVec, const char *vector_name, const char *filename_id) const
Definition: SCF_restricted.cc:1291
void write_diag_dens_to_file()
Definition: SCF_restricted.cc:1120
void compute_gradient_fixeddens()
Definition: SCF_restricted.cc:1907
intervalType lumoInterval_Fprev
Definition: SCF_restricted.h:153
void create_eigenvectors_files() const
Definition: SCF_restricted.cc:1252
void write_matrices_to_file()
Definition: SCF_restricted.cc:266
std::vector< generalVector > eigVecUNOCC
Definition: SCF_restricted.h:146
void do_spin_flip(int atomCount)
Definition: SCF_restricted.cc:1136
std::vector< ergo_real > eigValOCC
Definition: SCF_restricted.h:147
void disturb_dens_matrix(ergo_real subspaceError)
Definition: SCF_restricted.cc:1673
void use_diis_to_get_new_fock_matrix()
Definition: SCF_restricted.cc:702
void report_density_difference()
Definition: SCF_restricted.cc:1152
void get_starting_guess_density()
Definition: SCF_restricted.cc:143
void create_mtx_files_F(int const scfIter)
Definition: SCF_restricted.cc:1200
void get_Fock_matrix(symmMatrix &FockMatrix_)
Definition: SCF_restricted.cc:89
void write_density_to_file()
Definition: SCF_restricted.cc:880
void output_density_images_orbital(generalVector &eigVec, const std::string &filename_id)
Definition: SCF_restricted.cc:1064
void add_random_disturbance_to_starting_guess()
Definition: SCF_restricted.cc:237
void create_gabedit_file_2() const
normalMatrix ErrorMatrix
Definition: SCF_restricted.h:139
intervalType lumoInterval_F_ort_prev
Definition: SCF_restricted.h:151
symmMatrix densityMatrix
Definition: SCF_restricted.h:129
intervalType homoInterval_Fprev
Definition: SCF_restricted.h:152
void disturb_fock_matrix(ergo_real subspaceError)
Definition: SCF_restricted.cc:1816
symmMatrix Fxc_matrix
Definition: SCF_restricted.h:143
void create_homo_eigvec_file() const
void initialize_homo_lumo_limits()
Definition: SCF_restricted.cc:255
void disturb_dens_matrix_exact(ergo_real subspaceError)
Definition: SCF_restricted.cc:1763
void check_params()
Definition: SCF_restricted.cc:133
void clear_diis_list()
Definition: SCF_restricted.cc:717
symmMatrix Fprev
Definition: SCF_restricted.h:133
~SCF_restricted()
Definition: SCF_restricted.cc:83
void combine_old_fock_matrices(ergo_real stepLength)
Definition: SCF_restricted.cc:688
void get_FDSminusSDF()
Definition: SCF_restricted.cc:629
void output_expected_values_pos_operator()
Definition: SCF_restricted.cc:929
void compute_dipole_moment()
Definition: SCF_restricted.cc:1174
void calculate_energy()
Definition: SCF_restricted.cc:608
void save_final_potential()
Definition: SCF_restricted.cc:896
void transform_with_invChol(symmMatrix &A)
Transform matrix A to invCholT*A*invChol.
Definition: SCF_restricted.cc:1626
void disturb_dens_matrix_exact_try(const symmMatrix &randomMatrix, const symmMatrix &orgDensMatrix, ergo_real disturbanceFactor, ergo_real &resultSinTheta, symmMatrix &resultDensMatrix)
Definition: SCF_restricted.cc:1695
void update_subspace_diff()
Definition: SCF_restricted.cc:1571
void save_full_matrices_for_matlab()
Definition: SCF_restricted.cc:908
void do_mulliken_pop_stuff()
Definition: SCF_restricted.cc:1183
void create_eigenvalues_files() const
Definition: SCF_restricted.cc:1228
void get_2e_part_and_energy()
Definition: SCF_restricted.cc:321
void create_gabedit_file() const
Definition: SCF_restricted.cc:1411
void get_expected_values_pos_operator(generalVector &eigVec, const char *vector_name)
Definition: SCF_restricted.cc:952
void get_error_measure()
Definition: SCF_restricted.cc:650
Definition: SCF_statistics.h:57
Normal matrix.
Definition: MatrixGeneral.h:59
Definition: VectorGeneral.h:48
#define A
double ergo_real
Definition: realtype.h:69
Definition: basisinfo.h:112
A structure describing the grid settings.
Definition: grid_params.h:59
Definition: integrals_2el.h:45
An object respresenting the configuration of the matrix library.
Definition: scf.h:276
Definition: scf.h:53
MatrixSymmetric< real, matri > symmMatrix
Definition: test_LanczosSeveralLargestEig.cc:69