ergo
SCF_unrestricted.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_UNRESTRICTED_HEADER
39 #define SCF_UNRESTRICTED_HEADER
40 
41 #include "SCF_general.h"
42 
43 
45 {
46  public:
47 
48  // Constructor
49  SCF_unrestricted(const Molecule& molecule_,
50  const Molecule& extraCharges_,
51  const BasisInfoStruct & basisInfo_,
52  const IntegralInfo & integralInfo_,
53  const char* guessDmatFileName_,
54  const JK::Params& J_K_params_,
55  const Dft::GridParams& gridParams_,
56  const SCF::Options& scfopts,
57  const SCF::MatOptions& matOpts,
58  ergo_real threshold_integrals_1el_input,
59  int alpha_beta_diff_input);
60 
61  // Destructor
63 
64  void get_Fock_matrices(symmMatrix & FockMatrix_a, symmMatrix & FockMatrix_b);
65  void get_no_of_electrons(int & noOfElectrons_a, int & noOfElectrons_b);
66 
67  private:
68  void initialize_matrices();
69  void check_params();
75  void calculate_energy();
76  void get_FDSminusSDF();
77  void get_error_measure();
78  void add_to_DIIS_list();
80  void combine_old_fock_matrices(ergo_real stepLength);
82  void clear_diis_list();
83  void clear_error_matrices();
86  void write_density_to_file();
87  void save_final_potential();
90  void output_density_images();
91  void output_density_images_orbital(generalVector &eigVec, const std::string &filename_id);
93  void report_final_results();
95  void update_subspace_diff();
96  void disturb_fock_matrix(ergo_real subspaceError);
97  void disturb_dens_matrix(ergo_real subspaceError);
98  void do_spin_flip(int atomCount);
99  void disturb_dens_matrix_exact(ergo_real subspaceError);
102  void create_mtx_files_F(int const scfIter);
103  void create_mtx_files_D(int const scfIter);
104  void create_eigenvalues_files() const;
105  void create_eigenvectors_files() const;
106  void create_eigvec_file(const generalVector &eigVec_alpha,
107  const generalVector &eigVec_beta,
108  const char *vector_name,
109  const char *filename_id) const;
110  void create_gabedit_file() const;
111  void compute_dipole_moment();
112  void do_mulliken_pop_stuff();
114 
115  void get_S2(ergo_real & S2_exact, ergo_real & S2);
116 
125  symmMatrix F_ort_prev_alpha; // Used by purification
126  symmMatrix F_ort_prev_beta; // Used by purification
127  symmMatrix D_ort_prev_alpha; // Used for computing eigenvectors
128  symmMatrix D_ort_prev_beta; // Used for computing eigenvectors
137 
138  // HOMO/LUMO info
147 
151 
152  std::vector<generalVector> eigVecOCC_alpha;
153  std::vector<generalVector> eigVecUNOCC_alpha;
154  std::vector<ergo_real> eigValOCC_alpha;
155  std::vector<ergo_real> eigValUNOCC_alpha;
156  std::vector<generalVector> eigVecOCC_beta;
157  std::vector<generalVector> eigVecUNOCC_beta;
158  std::vector<ergo_real> eigValOCC_beta;
159  std::vector<ergo_real> eigValUNOCC_beta;
160 };
161 
162 
163 
164 
165 
166 #endif
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_statistics.h:57
Definition: SCF_unrestricted.h:45
void do_mulliken_pop_stuff()
Definition: SCF_unrestricted.cc:1226
symmMatrix Fprev_alpha
Definition: SCF_unrestricted.h:121
void create_mtx_files_F(int const scfIter)
Definition: SCF_unrestricted.cc:1256
normalMatrix ErrorMatrix_alpha
Definition: SCF_unrestricted.h:133
symmMatrix densityMatrix_alpha
Definition: SCF_unrestricted.h:117
void output_expected_values_pos_operator()
Definition: SCF_unrestricted.cc:956
void save_final_potential()
Definition: SCF_unrestricted.cc:948
void calculate_energy()
Definition: SCF_unrestricted.cc:539
void create_eigenvectors_files() const
Definition: SCF_unrestricted.cc:1347
symmMatrix F_ort_prev_beta
Definition: SCF_unrestricted.h:126
symmMatrix bestFockMatrixSoFar2_beta
Definition: SCF_unrestricted.h:132
void write_matrices_to_file()
Definition: SCF_unrestricted.cc:329
symmMatrix bestFockMatrixSoFar_alpha
Definition: SCF_unrestricted.h:129
void save_current_fock_as_fprev()
Definition: SCF_unrestricted.cc:737
void create_eigenvalues_files() const
Definition: SCF_unrestricted.cc:1304
symmMatrix Dprev_beta
Definition: SCF_unrestricted.h:124
normalMatrix ErrorMatrix_beta
Definition: SCF_unrestricted.h:134
void create_mtx_files_D(int const scfIter)
Definition: SCF_unrestricted.cc:1279
std::vector< ergo_real > eigValOCC_beta
Definition: SCF_unrestricted.h:158
~SCF_unrestricted()
Definition: SCF_unrestricted.cc:88
intervalType lumoInterval_F_ort_prev_beta
Definition: SCF_unrestricted.h:142
symmMatrix F_ort_prev_alpha
Definition: SCF_unrestricted.h:125
void save_full_matrices_for_matlab()
Definition: SCF_unrestricted.cc:1121
void create_gabedit_file() const
Definition: SCF_unrestricted.cc:1496
void disturb_fock_matrix(ergo_real subspaceError)
Definition: SCF_unrestricted.cc:1672
void save_density_as_prevdens()
Definition: SCF_unrestricted.cc:1172
intervalType lumoInterval_Fprev_beta
Definition: SCF_unrestricted.h:146
std::vector< generalVector > eigVecUNOCC_alpha
Definition: SCF_unrestricted.h:153
symmMatrix G_alpha
Definition: SCF_unrestricted.h:135
void initialize_matrices()
Definition: SCF_unrestricted.cc:112
void check_params()
Definition: SCF_unrestricted.cc:154
intervalType homoInterval_Fprev_alpha
Definition: SCF_unrestricted.h:143
void combine_old_fock_matrices(ergo_real stepLength)
Definition: SCF_unrestricted.cc:668
std::vector< ergo_real > eigValUNOCC_beta
Definition: SCF_unrestricted.h:159
void output_sparsity_S_F_D(SCF_statistics &stats)
Definition: SCF_unrestricted.cc:516
void clear_error_matrices()
Definition: SCF_unrestricted.cc:728
void get_no_of_electrons(int &noOfElectrons_a, int &noOfElectrons_b)
Definition: SCF_unrestricted.cc:105
void use_diis_to_get_new_fock_matrix()
Definition: SCF_unrestricted.cc:695
std::vector< ergo_real > eigValUNOCC_alpha
Definition: SCF_unrestricted.h:155
void get_S2(ergo_real &S2_exact, ergo_real &S2)
Definition: SCF_unrestricted.cc:1135
int noOfElectrons_beta
Definition: SCF_unrestricted.h:150
void do_spin_flip(int atomCount)
Definition: SCF_unrestricted.cc:1015
int noOfElectrons_alpha
Definition: SCF_unrestricted.h:149
void disturb_dens_matrix_exact(ergo_real subspaceError)
Definition: SCF_unrestricted.cc:1682
intervalType homoInterval_F_ort_prev_beta
Definition: SCF_unrestricted.h:141
symmMatrix D_ort_prev_alpha
Definition: SCF_unrestricted.h:127
symmMatrix Dprev_alpha
Definition: SCF_unrestricted.h:123
void update_subspace_diff()
Definition: SCF_unrestricted.cc:1666
void add_random_disturbance_to_starting_guess()
Definition: SCF_unrestricted.cc:286
void disturb_dens_matrix(ergo_real subspaceError)
Definition: SCF_unrestricted.cc:1677
std::vector< generalVector > eigVecOCC_alpha
Definition: SCF_unrestricted.h:152
SCF_unrestricted(const Molecule &molecule_, const Molecule &extraCharges_, const BasisInfoStruct &basisInfo_, const IntegralInfo &integralInfo_, const char *guessDmatFileName_, const JK::Params &J_K_params_, const Dft::GridParams &gridParams_, const SCF::Options &scfopts, const SCF::MatOptions &matOpts, ergo_real threshold_integrals_1el_input, int alpha_beta_diff_input)
Definition: SCF_unrestricted.cc:54
void get_new_density_matrix()
Definition: SCF_unrestricted.cc:756
intervalType homoInterval_F_ort_prev_alpha
Definition: SCF_unrestricted.h:139
intervalType homoInterval_Fprev_beta
Definition: SCF_unrestricted.h:145
void get_2e_part_and_energy()
Definition: SCF_unrestricted.cc:369
intervalType lumoInterval_F_ort_prev_alpha
Definition: SCF_unrestricted.h:140
void output_density_images()
Definition: SCF_unrestricted.cc:971
symmMatrix FockMatrix_beta
Definition: SCF_unrestricted.h:120
void compute_dipole_moment()
Definition: SCF_unrestricted.cc:1214
void clear_diis_list()
Definition: SCF_unrestricted.cc:720
symmMatrix Fprev_beta
Definition: SCF_unrestricted.h:122
void initialize_homo_lumo_limits()
Definition: SCF_unrestricted.cc:314
std::vector< ergo_real > eigValOCC_alpha
Definition: SCF_unrestricted.h:154
void get_starting_guess_density()
Definition: SCF_unrestricted.cc:161
int alpha_beta_diff
Definition: SCF_unrestricted.h:148
symmMatrix bestFockMatrixSoFar_beta
Definition: SCF_unrestricted.h:130
void add_to_DIIS_list()
Definition: SCF_unrestricted.cc:619
symmMatrix FockMatrix_alpha
Definition: SCF_unrestricted.h:119
void get_Fock_matrices(symmMatrix &FockMatrix_a, symmMatrix &FockMatrix_b)
Definition: SCF_unrestricted.cc:94
symmMatrix bestFockMatrixSoFar2_alpha
Definition: SCF_unrestricted.h:131
void update_best_fock_so_far()
Definition: SCF_unrestricted.cc:639
std::vector< generalVector > eigVecOCC_beta
Definition: SCF_unrestricted.h:156
void get_FDSminusSDF()
Definition: SCF_unrestricted.cc:558
void report_density_difference()
Definition: SCF_unrestricted.cc:1190
void compute_gradient_fixeddens()
Definition: SCF_unrestricted.cc:1687
void get_error_measure()
Definition: SCF_unrestricted.cc:599
symmMatrix G_beta
Definition: SCF_unrestricted.h:136
void write_diag_dens_to_file()
Definition: SCF_unrestricted.cc:1105
void create_eigvec_file(const generalVector &eigVec_alpha, const generalVector &eigVec_beta, const char *vector_name, const char *filename_id) const
Definition: SCF_unrestricted.cc:1387
std::vector< generalVector > eigVecUNOCC_beta
Definition: SCF_unrestricted.h:157
intervalType lumoInterval_Fprev_alpha
Definition: SCF_unrestricted.h:144
void output_density_images_orbital(generalVector &eigVec, const std::string &filename_id)
Definition: SCF_unrestricted.cc:964
symmMatrix D_ort_prev_beta
Definition: SCF_unrestricted.h:128
symmMatrix densityMatrix_beta
Definition: SCF_unrestricted.h:118
void report_final_results()
Definition: SCF_unrestricted.cc:1127
void write_density_to_file()
Definition: SCF_unrestricted.cc:900
Normal matrix.
Definition: MatrixGeneral.h:59
Definition: VectorGeneral.h:48
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