ergo
SCF_restricted.h
Go to the documentation of this file.
1 /* Ergo, version 3.7, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2018 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,
59  const SCF::MatOptions& matOpts,
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:
69  void initialize_matrices();
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();
84  void clear_error_matrices();
87  void write_density_to_file();
88  void save_final_potential();
91  void get_expected_values_pos_operator(generalVector &eigVec, const char *vector_name);
92  void output_density_images();
93  void output_density_images_orbital(generalVector &eigVec, const std::string &filename_id);
95  void report_final_results();
97  void update_subspace_diff();
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);
106  void create_homo_eigvec_file() const;
107  void create_lumo_eigvec_file() const;
108  void create_eigenvectors_files() const;
109  void create_eigvec_file(const generalVector &eigVec,
110  const char *vector_name,
111  const char *filename_id) const;
112  void create_gabedit_file() const;
113  void create_gabedit_file_2() const;
114  void compute_dipole_moment();
115  void do_mulliken_pop_stuff();
117 
118  void get_non_ort_err_mat_normalized_in_ort_basis(symmMatrix & randomMatrix, int transform_with_S_also);
119  void transform_with_S(symmMatrix & A);
121 
122  void disturb_dens_matrix_exact_try(const symmMatrix & randomMatrix,
123  const symmMatrix & orgDensMatrix,
124  ergo_real disturbanceFactor,
125  ergo_real & resultSinTheta,
126  symmMatrix & resultDensMatrix);
127 
134  symmMatrix F_ort_prev; // Used by purification
135  symmMatrix D_ort_prev; // Used for computing eigenvectors
139  // The following three matrices are only used when doing sparsity investigation, otherwise they are empty
143 
146 
151 
152 };
153 
154 
155 
156 
157 
158 #endif
#define A
void update_subspace_diff()
Definition: SCF_restricted.cc:1518
double ergo_real
Definition: realtype.h:69
symmMatrix FockMatrix
Definition: SCF_restricted.h:131
void clear_error_matrices()
Definition: SCF_restricted.cc:723
void report_density_difference()
Definition: SCF_restricted.cc:1132
symmMatrix Fxc_matrix
Definition: SCF_restricted.h:142
Normal matrix.
Definition: MatrixBase.h:49
A structure describing the grid settings.
Definition: grid_params.h:59
void calculate_energy()
Definition: SCF_restricted.cc:608
symmMatrix bestFockMatrixSoFar
Definition: SCF_restricted.h:136
SCF_restricted(const Molecule &molecule_, const Molecule &extraCharges_, const BasisInfoStruct &basisInfo_, const IntegralInfo &integralInfo_, const char *guessDmatFileNamePtr, const JK::Params &J_K_paramsPtr, const Dft::GridParams &gridParams_, const SCF::Options &scfopts, const SCF::MatOptions &matOpts, ergo_real threshold_integrals_1el_input)
Definition: SCF_restricted.cc:54
symmMatrix twoel_matrix_core
Definition: SCF_restricted.h:130
void use_diis_to_get_new_fock_matrix()
Definition: SCF_restricted.cc:702
void disturb_dens_matrix_exact_try(const symmMatrix &randomMatrix, const symmMatrix &orgDensMatrix, ergo_real disturbanceFactor, ergo_real &resultSinTheta, symmMatrix &resultDensMatrix)
Definition: SCF_restricted.cc:1642
symmMatrix bestFockMatrixSoFar2
Definition: SCF_restricted.h:137
void do_mulliken_pop_stuff()
Definition: SCF_restricted.cc:1163
void compute_gradient_fixeddens()
Definition: SCF_restricted.cc:1854
void save_density_as_prevdens()
Definition: SCF_restricted.cc:1122
Definition: integrals_2el.h:44
void add_to_DIIS_list()
Definition: SCF_restricted.cc:661
intervalType lumoInterval_Fprev
Definition: SCF_restricted.h:150
const SCF::MatOptions & matOpts
Definition: SCF_general.h:87
Definition: SCF_statistics.h:57
void transform_with_S(symmMatrix &A)
Transform matrix A to S*A*S.
Definition: SCF_restricted.cc:1554
const SCF::Options & scfopts
Definition: SCF_general.h:86
MatrixSymmetric< real, matri > symmMatrix
Definition: test_LanczosSeveralLargestEig.cc:69
void check_params()
Definition: SCF_restricted.cc:133
void get_expected_values_pos_operator(generalVector &eigVec, const char *vector_name)
Definition: SCF_restricted.cc:932
symmMatrix Dprev
Definition: SCF_restricted.h:133
Representation of a molecule as a set of nuclei and total charge.
Definition: molecule.h:87
Definition: SCF_general.h:51
void get_new_density_matrix()
Definition: SCF_restricted.cc:740
void initialize_homo_lumo_limits()
Definition: SCF_restricted.cc:255
void get_density_matrix(symmMatrix &densityMatrix_)
Definition: SCF_restricted.cc:97
void get_2e_part_and_energy()
Definition: SCF_restricted.cc:321
void disturb_dens_matrix(ergo_real subspaceError)
Definition: SCF_restricted.cc:1620
symmMatrix J_matrix
Definition: SCF_restricted.h:140
void output_density_images()
Definition: SCF_restricted.cc:1007
symmMatrix densityMatrix
Definition: SCF_restricted.h:128
Class for self-consistent field (SCF) procedure; base class that can be used for both restricted and ...
intervalType homoInterval_Fprev
Definition: SCF_restricted.h:149
Contains coefficients needed for quick integral evaluation.
Definition: integral_info.h:93
void transform_with_invChol(symmMatrix &A)
Transform matrix A to invCholT*A*invChol.
Definition: SCF_restricted.cc:1573
void create_mtx_files_D(int const scfIter)
Definition: SCF_restricted.cc:1194
void create_eigenvectors_files() const
Definition: SCF_restricted.cc:1253
symmMatrix densityMatrix_core
Definition: SCF_restricted.h:129
void save_final_potential()
Definition: SCF_restricted.cc:891
void add_random_disturbance_to_starting_guess()
Definition: SCF_restricted.cc:237
generalVector eigVecHOMO
Definition: SCF_restricted.h:145
void do_spin_flip(int atomCount)
Definition: SCF_restricted.cc:1116
~SCF_restricted()
Definition: SCF_restricted.cc:83
Definition: SCF_restricted.h:46
void write_density_to_file()
Definition: SCF_restricted.cc:875
void save_full_matrices_for_matlab()
Definition: SCF_restricted.cc:903
symmMatrix D_ort_prev
Definition: SCF_restricted.h:135
void create_homo_eigvec_file() const
Definition: basisinfo.h:112
Definition: scf.h:53
void combine_old_fock_matrices(ergo_real stepLength)
Definition: SCF_restricted.cc:688
void disturb_fock_matrix(ergo_real subspaceError)
Definition: SCF_restricted.cc:1763
void create_gabedit_file_2() const
void save_current_fock_as_fprev()
Definition: SCF_restricted.cc:729
void initialize_matrices()
Definition: SCF_restricted.cc:105
void write_diag_dens_to_file()
Definition: SCF_restricted.cc:1100
void get_Fock_matrix(symmMatrix &FockMatrix_)
Definition: SCF_restricted.cc:89
void clear_diis_list()
Definition: SCF_restricted.cc:717
void output_sparsity_S_F_D(SCF_statistics &stats)
Definition: SCF_restricted.cc:589
void disturb_dens_matrix_exact(ergo_real subspaceError)
Definition: SCF_restricted.cc:1710
void create_lumo_eigvec_file() const
void write_matrices_to_file()
Definition: SCF_restricted.cc:266
void compute_dipole_moment()
Definition: SCF_restricted.cc:1154
void get_error_measure()
Definition: SCF_restricted.cc:650
generalVector eigVecLUMO
Definition: SCF_restricted.h:144
void create_mtx_files_F(int const scfIter)
Definition: SCF_restricted.cc:1180
normalMatrix ErrorMatrix
Definition: SCF_restricted.h:138
void update_best_fock_so_far()
Definition: SCF_restricted.cc:673
void create_eigvec_file(const generalVector &eigVec, const char *vector_name, const char *filename_id) const
Definition: SCF_restricted.cc:1264
void report_final_results()
Definition: SCF_restricted.cc:1111
symmMatrix F_ort_prev
Definition: SCF_restricted.h:134
symmMatrix K_matrix
Definition: SCF_restricted.h:141
symmMatrix Fprev
Definition: SCF_restricted.h:132
void output_density_images_orbital(generalVector &eigVec, const std::string &filename_id)
Definition: SCF_restricted.cc:1044
void get_starting_guess_density()
Definition: SCF_restricted.cc:143
An object respresenting the configuration of the matrix library.
Definition: scf.h:268
void output_expected_values_pos_operator()
Definition: SCF_restricted.cc:924
void get_non_ort_err_mat_normalized_in_ort_basis(symmMatrix &randomMatrix, int transform_with_S_also)
Definition: SCF_restricted.cc:1581
intervalType homoInterval_F_ort_prev
Definition: SCF_restricted.h:147
void get_FDSminusSDF()
Definition: SCF_restricted.cc:629
void create_gabedit_file() const
Definition: SCF_restricted.cc:1384
Routines for getting density matrix from a given Fock matrix.
intervalType lumoInterval_F_ort_prev
Definition: SCF_restricted.h:148