ergo
|
00001 /* Ergo, version 3.2, a program for linear scaling electronic structure 00002 * calculations. 00003 * Copyright (C) 2012 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 * 00018 * Primary academic reference: 00019 * KohnâSham Density Functional Theory Electronic Structure Calculations 00020 * with Linearly Scaling Computational Time and Memory Usage, 00021 * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek, 00022 * J. Chem. Theory Comput. 7, 340 (2011), 00023 * <http://dx.doi.org/10.1021/ct100611z> 00024 * 00025 * For further information about Ergo, see <http://www.ergoscf.org>. 00026 */ 00027 00028 #ifndef SCF_GENERAL_HEADER 00029 #define SCF_GENERAL_HEADER 00030 00031 #include "molecule.h" 00032 #include "basisinfo.h" 00033 #include "integrals_2el.h" 00034 #include "grid_stream.h" 00035 #include "scf.h" 00036 #include "densityfitting.h" 00037 #include "diis_general.h" 00038 #include "SCF_statistics.h" 00039 00040 00041 class SCF_general 00042 { 00043 public: 00044 00045 // SCF convergence routine 00046 void do_SCF_iterations(); 00047 00048 void get_overlap_matrix(symmMatrix & S); 00049 void get_H_core_matrix(symmMatrix & H_core); 00050 void get_energy(ergo_real & E, ergo_real & E_nuclear); 00051 00052 protected: 00053 // Constructor 00054 SCF_general(const Molecule& molecule_, 00055 const Molecule& extraCharges_, 00056 const BasisInfoStruct & basisInfo_, 00057 const BasisInfoStruct & basisInfoDensFit_, 00058 const IntegralInfo & integralInfo_, 00059 const char* guessDmatFileName_, 00060 const JK::Params& J_K_params_, 00061 const Dft::GridParams& gridParams_, 00062 const SCF::Options& scfopts, 00063 const SCF::MatOptions& matOpts, 00064 ergo_real threshold_integrals_1el_input); 00065 00066 // Destructor 00067 virtual ~SCF_general(); 00068 00069 const Molecule& molecule; 00070 const Molecule& extraCharges; 00071 const BasisInfoStruct & basisInfo; 00072 const BasisInfoStruct & basisInfoDensFit; 00073 const IntegralInfo& integralInfo; 00074 const char* guessDmatFileName; 00075 const JK::Params& J_K_params; 00076 const Dft::GridParams& gridParams; 00077 const SCF::Options& scfopts; 00078 const SCF::MatOptions& matOpts; 00079 ergo_real threshold_integrals_1el; 00080 DensfitData* densfit_data; 00081 00082 //integral_prep_struct* integralPrep; 00083 00084 JK::ExchWeights CAM_params; // range-separated exchange parameters 00085 00086 // nuclearEnergy is nuclear repulsion energy plus contribution from external electric field. 00087 ergo_real nuclearEnergy; 00088 00089 ergo_real energy_2el; 00090 ergo_real energy; 00091 00092 ergo_real errorMeasure; 00093 00094 ergo_real curr_subspace_diff; 00095 00096 symmMatrix S_symm; 00097 triangMatrix invCholFactor; 00098 ergo_real invCholFactor_euclnorm; 00099 symmMatrix H_core_Matrix; 00100 00101 DIISManager* DIIS; // Must be initialized by restricted/unrestricted derived class. 00102 00103 int noOfElectrons; 00104 00105 SCF_statistics* curr_cycle_stats; 00106 00107 ergo_real GetEuclideanNormOfMatrix(const symmMatrix & A); 00108 00109 virtual void initialize_matrices() = 0; 00110 virtual void check_params() = 0; 00111 virtual void get_starting_guess_density() = 0; 00112 virtual void initialize_homo_lumo_limits() = 0; 00113 virtual void write_matrices_to_file() = 0; 00114 virtual void get_2e_part_and_energy() = 0; 00115 virtual void output_sparsity_S_F_D(SCF_statistics & stats) = 0; 00116 virtual void calculate_energy() = 0; 00117 virtual void get_FDSminusSDF() = 0; 00118 virtual void get_error_measure() = 0; 00119 virtual void add_to_DIIS_list() = 0; 00120 virtual void update_best_fock_so_far() = 0; 00121 virtual void combine_old_fock_matrices(ergo_real stepLength) = 0; 00122 virtual void use_diis_to_get_new_fock_matrix() = 0; 00123 virtual void clear_diis_list() = 0; 00124 virtual void clear_error_matrices() = 0; 00125 virtual void save_current_fock_as_fprev() = 0; 00126 virtual void get_new_density_matrix() = 0; 00127 virtual void write_density_to_file() = 0; 00128 virtual void save_final_potential() = 0; 00129 virtual void add_random_disturbance_to_starting_guess() = 0; 00130 virtual void output_density_images() = 0; 00131 virtual void output_csr_matrices_for_gao() = 0; 00132 virtual void do_electron_dynamics() = 0; 00133 virtual void write_diag_dens_to_file() = 0; 00134 virtual void report_final_results() = 0; 00135 virtual void save_density_as_prevdens() = 0; 00136 virtual void update_subspace_diff() = 0; 00137 virtual void disturb_fock_matrix(ergo_real subspaceError) = 0; 00138 virtual void disturb_dens_matrix(ergo_real subspaceError) = 0; 00139 virtual void do_spin_flip(int atomCount) = 0; 00140 virtual void disturb_dens_matrix_exact(ergo_real subspaceError) = 0; 00141 virtual void save_full_matrices_for_matlab() = 0; 00142 virtual void report_density_difference() = 0; 00143 virtual void create_mtx_files_F(int const scfIter) = 0; 00144 virtual void create_mtx_files_D(int const scfIter) = 0; 00145 virtual void create_homo_eigvec_file() const = 0; 00146 virtual void create_lumo_eigvec_file() const = 0; 00147 virtual void create_gabedit_file() const = 0; 00148 virtual void compute_dipole_moment() = 0; 00149 virtual void do_mulliken_pop_stuff() = 0; 00150 }; 00151 00152 00153 00154 00155 00156 #endif