ergo
SCF_general.h
Go to the documentation of this file.
1 /* Ergo, version 3.2, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2012 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_GENERAL_HEADER
29 #define SCF_GENERAL_HEADER
30 
31 #include "molecule.h"
32 #include "basisinfo.h"
33 #include "integrals_2el.h"
34 #include "grid_stream.h"
35 #include "scf.h"
36 #include "densityfitting.h"
37 #include "diis_general.h"
38 #include "SCF_statistics.h"
39 
40 
42 {
43  public:
44 
45  // SCF convergence routine
46  void do_SCF_iterations();
47 
49  void get_H_core_matrix(symmMatrix & H_core);
50  void get_energy(ergo_real & E, ergo_real & E_nuclear);
51 
52  protected:
53  // Constructor
54  SCF_general(const Molecule& molecule_,
55  const Molecule& extraCharges_,
56  const BasisInfoStruct & basisInfo_,
57  const BasisInfoStruct & basisInfoDensFit_,
58  const IntegralInfo & integralInfo_,
59  const char* guessDmatFileName_,
60  const JK::Params& J_K_params_,
61  const Dft::GridParams& gridParams_,
62  const SCF::Options& scfopts,
63  const SCF::MatOptions& matOpts,
64  ergo_real threshold_integrals_1el_input);
65 
66  // Destructor
67  virtual ~SCF_general();
68 
74  const char* guessDmatFileName;
81 
82  //integral_prep_struct* integralPrep;
83 
84  JK::ExchWeights CAM_params; // range-separated exchange parameters
85 
86  // nuclearEnergy is nuclear repulsion energy plus contribution from external electric field.
88 
91 
93 
95 
100 
101  DIISManager* DIIS; // Must be initialized by restricted/unrestricted derived class.
102 
104 
106 
108 
109  virtual void initialize_matrices() = 0;
110  virtual void check_params() = 0;
111  virtual void get_starting_guess_density() = 0;
112  virtual void initialize_homo_lumo_limits() = 0;
113  virtual void write_matrices_to_file() = 0;
114  virtual void get_2e_part_and_energy() = 0;
115  virtual void output_sparsity_S_F_D(SCF_statistics & stats) = 0;
116  virtual void calculate_energy() = 0;
117  virtual void get_FDSminusSDF() = 0;
118  virtual void get_error_measure() = 0;
119  virtual void add_to_DIIS_list() = 0;
120  virtual void update_best_fock_so_far() = 0;
121  virtual void combine_old_fock_matrices(ergo_real stepLength) = 0;
122  virtual void use_diis_to_get_new_fock_matrix() = 0;
123  virtual void clear_diis_list() = 0;
124  virtual void clear_error_matrices() = 0;
125  virtual void save_current_fock_as_fprev() = 0;
126  virtual void get_new_density_matrix() = 0;
127  virtual void write_density_to_file() = 0;
128  virtual void save_final_potential() = 0;
129  virtual void add_random_disturbance_to_starting_guess() = 0;
130  virtual void output_density_images() = 0;
131  virtual void output_csr_matrices_for_gao() = 0;
132  virtual void do_electron_dynamics() = 0;
133  virtual void write_diag_dens_to_file() = 0;
134  virtual void report_final_results() = 0;
135  virtual void save_density_as_prevdens() = 0;
136  virtual void update_subspace_diff() = 0;
137  virtual void disturb_fock_matrix(ergo_real subspaceError) = 0;
138  virtual void disturb_dens_matrix(ergo_real subspaceError) = 0;
139  virtual void do_spin_flip(int atomCount) = 0;
140  virtual void disturb_dens_matrix_exact(ergo_real subspaceError) = 0;
141  virtual void save_full_matrices_for_matlab() = 0;
142  virtual void report_density_difference() = 0;
143  virtual void create_mtx_files_F(int const scfIter) = 0;
144  virtual void create_mtx_files_D(int const scfIter) = 0;
145  virtual void create_homo_eigvec_file() const = 0;
146  virtual void create_lumo_eigvec_file() const = 0;
147  virtual void create_gabedit_file() const = 0;
148  virtual void compute_dipole_moment() = 0;
149  virtual void do_mulliken_pop_stuff() = 0;
150 };
151 
152 
153 
154 
155 
156 #endif