File: SCF_unrestricted.h

package info (click to toggle)
ergo 3.8.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 17,568 kB
  • sloc: cpp: 94,763; ansic: 17,785; sh: 10,701; makefile: 1,403; yacc: 127; lex: 116; awk: 23
file content (166 lines) | stat: -rw-r--r-- 5,582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/* Ergo, version 3.8.2, a program for linear scaling electronic structure
 * calculations.
 * Copyright (C) 2023 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
 * and Anastasia Kruchinina.
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Primary academic reference:
 * Ergo: An open-source program for linear-scaling electronic structure
 * calculations,
 * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
 * Kruchinina,
 * SoftwareX 7, 107 (2018),
 * <http://dx.doi.org/10.1016/j.softx.2018.03.005>
 * 
 * For further information about Ergo, see <http://www.ergoscf.org>.
 */

/** @file SCF_unrestricted.h

    @brief Class for self-consistent field (SCF) procedure;
    spin-unrestricted case.

    @author: Elias Rudberg <em>responsible</em>.
*/

#ifndef SCF_UNRESTRICTED_HEADER
#define SCF_UNRESTRICTED_HEADER

#include "SCF_general.h"


class SCF_unrestricted : public SCF_general
{
 public:  

  // Constructor
  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);

  // Destructor
  ~SCF_unrestricted();

  void get_Fock_matrices(symmMatrix & FockMatrix_a, symmMatrix & FockMatrix_b);
  void get_no_of_electrons(int & noOfElectrons_a, int & noOfElectrons_b);

 private:
  void initialize_matrices();
  void check_params();
  void get_starting_guess_density();
  void initialize_homo_lumo_limits();
  void write_matrices_to_file();
  void get_2e_part_and_energy();
  void output_sparsity_S_F_D(SCF_statistics & stats);
  void calculate_energy();
  void get_FDSminusSDF();
  void get_error_measure();
  void add_to_DIIS_list();
  void update_best_fock_so_far();
  void combine_old_fock_matrices(ergo_real stepLength);
  void use_diis_to_get_new_fock_matrix();
  void clear_diis_list();
  void clear_error_matrices();
  void save_current_fock_as_fprev();
  void get_new_density_matrix();
  void write_density_to_file();
  void save_final_potential();
  void add_random_disturbance_to_starting_guess();
  void output_expected_values_pos_operator();
  void output_density_images();
  void output_density_images_orbital(generalVector &eigVec, const std::string &filename_id);
  void write_diag_dens_to_file();
  void report_final_results();
  void save_density_as_prevdens();
  void update_subspace_diff();
  void disturb_fock_matrix(ergo_real subspaceError);
  void disturb_dens_matrix(ergo_real subspaceError);
  void do_spin_flip(int atomCount);
  void disturb_dens_matrix_exact(ergo_real subspaceError);
  void save_full_matrices_for_matlab();
  void report_density_difference();
  void create_mtx_files_F(int const scfIter);
  void create_mtx_files_D(int const scfIter);
  void create_eigenvalues_files() const;
  void create_eigenvectors_files() const;
  void create_eigvec_file(const generalVector &eigVec_alpha, 
			  const generalVector &eigVec_beta,
			  const char *vector_name, 
			  const char *filename_id) const;
  void create_gabedit_file() const;
  void compute_dipole_moment();
  void do_mulliken_pop_stuff();
  void compute_gradient_fixeddens();

  void get_S2(ergo_real & S2_exact, ergo_real & S2);

  symmMatrix densityMatrix_alpha;
  symmMatrix densityMatrix_beta;
  symmMatrix FockMatrix_alpha;
  symmMatrix FockMatrix_beta;
  symmMatrix Fprev_alpha;
  symmMatrix Fprev_beta;
  symmMatrix Dprev_alpha;
  symmMatrix Dprev_beta;
  symmMatrix F_ort_prev_alpha; // Used by purification
  symmMatrix F_ort_prev_beta; // Used by purification
  symmMatrix D_ort_prev_alpha; // Used for computing eigenvectors
  symmMatrix D_ort_prev_beta; // Used for computing eigenvectors
  symmMatrix bestFockMatrixSoFar_alpha;
  symmMatrix bestFockMatrixSoFar_beta;
  symmMatrix bestFockMatrixSoFar2_alpha;
  symmMatrix bestFockMatrixSoFar2_beta;
  normalMatrix ErrorMatrix_alpha;
  normalMatrix ErrorMatrix_beta;
  symmMatrix G_alpha;
  symmMatrix G_beta;

  // HOMO/LUMO info
  intervalType homoInterval_F_ort_prev_alpha;
  intervalType lumoInterval_F_ort_prev_alpha;
  intervalType homoInterval_F_ort_prev_beta;
  intervalType lumoInterval_F_ort_prev_beta;
  intervalType homoInterval_Fprev_alpha;
  intervalType lumoInterval_Fprev_alpha;
  intervalType homoInterval_Fprev_beta;
  intervalType lumoInterval_Fprev_beta;

  int alpha_beta_diff;
  int noOfElectrons_alpha;
  int noOfElectrons_beta;

  std::vector<generalVector> eigVecOCC_alpha;
  std::vector<generalVector> eigVecUNOCC_alpha;
  std::vector<ergo_real> eigValOCC_alpha; 
  std::vector<ergo_real> eigValUNOCC_alpha;
  std::vector<generalVector> eigVecOCC_beta;
  std::vector<generalVector> eigVecUNOCC_beta;
  std::vector<ergo_real> eigValOCC_beta; 
  std::vector<ergo_real> eigValUNOCC_beta;
};





#endif