ergo
SCF_restricted.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 SCF_RESTRICTED_HEADER
29 #define SCF_RESTRICTED_HEADER
30 
31 #include "SCF_general.h"
32 
33 
35 {
36  public:
37 
38  // Constructor
39  SCF_restricted(const Molecule& molecule_,
40  const Molecule& extraCharges_,
41  const BasisInfoStruct & basisInfo_,
42  const BasisInfoStruct & basisInfoDensFit_,
43  const IntegralInfo& integralInfo_,
44  const char* guessDmatFileNamePtr,
45  const JK::Params& J_K_paramsPtr,
46  const Dft::GridParams& gridParams_,
47  const SCF::Options& scfopts,
48  const SCF::MatOptions& matOpts,
49  ergo_real threshold_integrals_1el_input);
50 
51  // Destructor
53 
54  void get_Fock_matrix(symmMatrix & FockMatrix_);
55  void get_density_matrix(symmMatrix & densityMatrix_);
56 
57  private:
58  void initialize_matrices();
59  void check_params();
65  void calculate_energy();
66  void get_FDSminusSDF();
67  void get_error_measure();
68  void add_to_DIIS_list();
70  void combine_old_fock_matrices(ergo_real stepLength);
72  void clear_diis_list();
73  void clear_error_matrices();
76  void write_density_to_file();
77  void save_final_potential();
79  void output_density_images();
83  void report_final_results();
85  void update_subspace_diff();
86  void disturb_fock_matrix(ergo_real subspaceError);
87  void disturb_dens_matrix(ergo_real subspaceError);
88  void do_spin_flip(int atomCount);
89  void disturb_dens_matrix_exact(ergo_real subspaceError);
92  void create_mtx_files_F(int const scfIter);
93  void create_mtx_files_D(int const scfIter);
94  void create_homo_eigvec_file() const;
95  void create_lumo_eigvec_file() const;
96  void create_gabedit_file() const;
97  void compute_dipole_moment();
98  void do_mulliken_pop_stuff();
100 
101  void get_non_ort_err_mat_normalized_in_ort_basis(symmMatrix & randomMatrix, int transform_with_S_also);
102  void transform_with_S(symmMatrix & A);
104 
105  void disturb_dens_matrix_exact_try(const symmMatrix & randomMatrix,
106  const symmMatrix & orgDensMatrix,
107  ergo_real disturbanceFactor,
108  ergo_real & resultSinTheta,
109  symmMatrix & resultDensMatrix);
110 
117  symmMatrix F_ort_prev; // Used by purification
121  // The following three matrices are only used when doing sparsity investigation, otherwise they are empty
125 
128 
133 
134  std::vector< std::vector<ergo_real> > stochastic_orbitals;
135 
136 };
137 
138 
139 
140 
141 
142 #endif
#define A
void update_subspace_diff()
Definition: SCF_restricted.cc:1626
double ergo_real
Definition: realtype.h:53
symmMatrix FockMatrix
Definition: SCF_restricted.h:114
void clear_error_matrices()
Definition: SCF_restricted.cc:791
void report_density_difference()
Definition: SCF_restricted.cc:1368
symmMatrix Fxc_matrix
Definition: SCF_restricted.h:124
A structure describing the grid settings.
Definition: grid_params.h:49
void calculate_energy()
Definition: SCF_restricted.cc:680
symmMatrix bestFockMatrixSoFar
Definition: SCF_restricted.h:118
symmMatrix twoel_matrix_core
Definition: SCF_restricted.h:113
void use_diis_to_get_new_fock_matrix()
Definition: SCF_restricted.cc:771
void disturb_dens_matrix_exact_try(const symmMatrix &randomMatrix, const symmMatrix &orgDensMatrix, ergo_real disturbanceFactor, ergo_real &resultSinTheta, symmMatrix &resultDensMatrix)
Definition: SCF_restricted.cc:1748
symmMatrix bestFockMatrixSoFar2
Definition: SCF_restricted.h:119
void prepare_stochastic_orbitals()
Definition: SCF_restricted.cc:1285
void do_mulliken_pop_stuff()
Definition: SCF_restricted.cc:1396
void compute_gradient_fixeddens()
Definition: SCF_restricted.cc:1985
void save_density_as_prevdens()
Definition: SCF_restricted.cc:1358
Definition: integrals_2el.h:36
void add_to_DIIS_list()
Definition: SCF_restricted.cc:730
intervalType lumoInterval_Fprev
Definition: SCF_restricted.h:132
const SCF::MatOptions & matOpts
Definition: SCF_general.h:79
Definition: SCF_statistics.h:47
void transform_with_S(symmMatrix &A)
Transform matrix A to S*A*S.
Definition: SCF_restricted.cc:1662
const SCF::Options & scfopts
Definition: SCF_general.h:78
void output_csr_matrices_for_gao()
Definition: SCF_restricted.cc:1314
void check_params()
Definition: SCF_restricted.cc:120
symmMatrix Dprev
Definition: SCF_restricted.h:116
Representation of a molecule as a set of nuclei and total charge.
Definition: molecule.h:76
Definition: SCF_general.h:41
void get_new_density_matrix()
Definition: SCF_restricted.cc:808
void initialize_homo_lumo_limits()
Definition: SCF_restricted.cc:267
void get_density_matrix(symmMatrix &densityMatrix_)
Definition: SCF_restricted.cc:86
void get_2e_part_and_energy()
Definition: SCF_restricted.cc:306
void disturb_dens_matrix(ergo_real subspaceError)
Definition: SCF_restricted.cc:1726
symmMatrix J_matrix
Definition: SCF_restricted.h:122
void output_density_images()
Definition: SCF_restricted.cc:1061
symmMatrix densityMatrix
Definition: SCF_restricted.h:111
intervalType homoInterval_Fprev
Definition: SCF_restricted.h:131
Contains coefficients needed for quick integral evaluation.
Definition: integral_info.h:81
void transform_with_invChol(symmMatrix &A)
Transform matrix A to invCholT*A*invChol.
Definition: SCF_restricted.cc:1681
void create_mtx_files_D(int const scfIter)
Definition: SCF_restricted.cc:1424
symmMatrix densityMatrix_core
Definition: SCF_restricted.h:112
void save_final_potential()
Definition: SCF_restricted.cc:1029
void add_random_disturbance_to_starting_guess()
Definition: SCF_restricted.cc:251
generalVector eigVecHOMO
Definition: SCF_restricted.h:127
void do_spin_flip(int atomCount)
Definition: SCF_restricted.cc:1352
~SCF_restricted()
Definition: SCF_restricted.cc:72
Definition: SCF_restricted.h:34
void write_density_to_file()
Definition: SCF_restricted.cc:1018
void save_full_matrices_for_matlab()
Definition: SCF_restricted.cc:1040
void create_homo_eigvec_file() const
Definition: SCF_restricted.cc:1437
Definition: basisinfo.h:111
Definition: scf.h:43
void combine_old_fock_matrices(ergo_real stepLength)
Definition: SCF_restricted.cc:757
void disturb_fock_matrix(ergo_real subspaceError)
Definition: SCF_restricted.cc:1881
void save_current_fock_as_fprev()
Definition: SCF_restricted.cc:797
void initialize_matrices()
Definition: SCF_restricted.cc:94
void write_diag_dens_to_file()
Definition: SCF_restricted.cc:1336
void get_Fock_matrix(symmMatrix &FockMatrix_)
Definition: SCF_restricted.cc:78
void clear_diis_list()
Definition: SCF_restricted.cc:785
void output_sparsity_S_F_D(SCF_statistics &stats)
Definition: SCF_restricted.cc:662
void disturb_dens_matrix_exact(ergo_real subspaceError)
Definition: SCF_restricted.cc:1835
void create_lumo_eigvec_file() const
Definition: SCF_restricted.cc:1459
void write_matrices_to_file()
Definition: SCF_restricted.cc:277
void compute_dipole_moment()
Definition: SCF_restricted.cc:1388
void get_error_measure()
Definition: SCF_restricted.cc:720
generalVector eigVecLUMO
Definition: SCF_restricted.h:126
void create_mtx_files_F(int const scfIter)
Definition: SCF_restricted.cc:1412
normalMatrix ErrorMatrix
Definition: SCF_restricted.h:120
void update_best_fock_so_far()
Definition: SCF_restricted.cc:742
SCF_restricted(const Molecule &molecule_, const Molecule &extraCharges_, const BasisInfoStruct &basisInfo_, const BasisInfoStruct &basisInfoDensFit_, 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:45
void report_final_results()
Definition: SCF_restricted.cc:1346
symmMatrix F_ort_prev
Definition: SCF_restricted.h:117
symmMatrix K_matrix
Definition: SCF_restricted.h:123
symmMatrix Fprev
Definition: SCF_restricted.h:115
std::vector< std::vector< ergo_real > > stochastic_orbitals
Definition: SCF_restricted.h:134
void get_starting_guess_density()
Definition: SCF_restricted.cc:130
An object respresenting the configuration of the matrix library.
Definition: scf.h:241
void get_non_ort_err_mat_normalized_in_ort_basis(symmMatrix &randomMatrix, int transform_with_S_also)
Definition: SCF_restricted.cc:1689
intervalType homoInterval_F_ort_prev
Definition: SCF_restricted.h:129
void get_FDSminusSDF()
Definition: SCF_restricted.cc:700
void create_gabedit_file() const
Definition: SCF_restricted.cc:1523
intervalType lumoInterval_F_ort_prev
Definition: SCF_restricted.h:130