00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _chemistry_qc_scf_scf_h
00029 #define _chemistry_qc_scf_scf_h
00030
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034
00035 #include <util/group/thread.h>
00036
00037 #include <math/optimize/scextrap.h>
00038
00039 #include <chemistry/qc/basis/tbint.h>
00040 #include <chemistry/qc/wfn/accum.h>
00041 #include <chemistry/qc/wfn/obwfn.h>
00042
00043
00044
00047 class SCF: public OneBodyWavefunction {
00048 protected:
00049 int need_vec_;
00050 int compute_guess_;
00051
00052 Ref<OneBodyWavefunction> guess_wfn_;
00053
00054 Ref<SelfConsistentExtrapolation> extrap_;
00055
00056 Ref<AccumH> accumdih_;
00057 Ref<AccumH> accumddh_;
00058
00059 int maxiter_;
00060 int dens_reset_freq_;
00061 int reset_occ_;
00062 int local_dens_;
00063 int storage_;
00064 int print_all_evals_;
00065 int print_occ_evals_;
00066
00067 double level_shift_;
00068
00069 Ref<MessageGrp> scf_grp_;
00070 Ref<ThreadGrp> threadgrp_;
00071 int local_;
00072
00073 Ref<TwoBodyInt>* tbis_;
00074 virtual void init_threads();
00075 virtual void done_threads();
00076
00077
00078 virtual void compute();
00079
00080
00081 virtual double compute_vector(double&);
00082
00083
00084 virtual Ref<SCExtrapError> extrap_error();
00085
00086
00087 virtual void compute_gradient(const RefSCVector&);
00088
00089
00090 virtual void compute_hessian(const RefSymmSCMatrix&);
00091
00092
00093 signed char * init_pmax(double *);
00094
00095
00096
00097
00098 enum Access { Read, Write, Accum };
00099 RefSymmSCMatrix get_local_data(const RefSymmSCMatrix&, double*&, Access);
00100
00101
00102
00103
00104
00105 virtual void initial_vector(int needv=1);
00106
00107
00108
00109
00110 void init_mem(int);
00111
00112 void so_density(const RefSymmSCMatrix& d, double occ, int alp=1);
00113
00114
00115
00116 int *read_occ(const Ref<KeyVal> &, const char *name, int nirrep);
00117 public:
00118 SCF(StateIn&);
00155 SCF(const Ref<KeyVal>&);
00156 ~SCF();
00157
00158 void save_data_state(StateOut&);
00159
00160 RefSCMatrix oso_eigenvectors();
00161 RefDiagSCMatrix eigenvalues();
00162
00163 int spin_unrestricted();
00164
00165
00166 virtual int n_fock_matrices() const =0;
00167
00168
00169 virtual RefSymmSCMatrix fock(int) =0;
00170
00171
00172 virtual RefSymmSCMatrix effective_fock() =0;
00173
00174 virtual double one_body_energy();
00175 virtual void two_body_energy(double &ec, double &ex);
00176
00177 void print(std::ostream&o=ExEnv::out()) const;
00178
00179 protected:
00180
00181 RefSCMatrix oso_scf_vector_;
00182 RefSCMatrix oso_scf_vector_beta_;
00183 RefSymmSCMatrix hcore_;
00184
00185
00186
00187
00188
00189 virtual void set_occupations(const RefDiagSCMatrix&) =0;
00190
00191
00192
00193 virtual void init_vector() =0;
00194 virtual void done_vector() =0;
00195
00196
00197 virtual double new_density() =0;
00198
00199
00200 virtual void reset_density() =0;
00201
00202
00203 virtual double scf_energy() =0;
00204
00205
00206 virtual Ref<SCExtrapData> extrap_data() =0;
00207
00208
00209 virtual void ao_fock(double accuracy) =0;
00210
00211
00212
00213 virtual void init_gradient() =0;
00214 virtual void done_gradient() =0;
00215
00216 virtual RefSymmSCMatrix lagrangian() =0;
00217 virtual RefSymmSCMatrix gradient_density() =0;
00218 virtual void two_body_deriv(double*) =0;
00219
00220
00221
00222 virtual void init_hessian() =0;
00223 virtual void done_hessian() =0;
00224 };
00225
00226
00227 #endif
00228
00229
00230
00231
00232