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_wfn_wfn_h
00029 #define _chemistry_qc_wfn_wfn_h
00030
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034
00035 #include <iostream>
00036
00037 #include <util/misc/compute.h>
00038 #include <math/scmat/matrix.h>
00039 #include <math/scmat/vector3.h>
00040 #include <chemistry/molecule/energy.h>
00041 #include <chemistry/qc/basis/basis.h>
00042 #include <chemistry/qc/basis/integral.h>
00043
00045 class Wavefunction: public MolecularEnergy {
00046 public:
00047
00049 enum OrthogMethod { Symmetric=1, Canonical=2, GramSchmidt=3 };
00050
00051 private:
00052 RefSCDimension aodim_;
00053 RefSCDimension sodim_;
00054 Ref<SCMatrixKit> basiskit_;
00055
00056 ResultRefSymmSCMatrix overlap_;
00057 ResultRefSymmSCMatrix hcore_;
00058 ResultRefSCMatrix natural_orbitals_;
00059 ResultRefDiagSCMatrix natural_density_;
00060
00061 double * bs_values;
00062 double * bsg_values;
00063
00064 Ref<GaussianBasisSet> gbs_;
00065 Ref<Integral> integral_;
00066
00067
00068
00069 double lindep_tol_;
00070
00071 OrthogMethod orthog_method_;
00072
00073 RefSCDimension osodim_;
00074
00075 RefSCMatrix orthog_trans_;
00076 RefSCMatrix orthog_trans_inverse_;
00077
00078
00079
00080
00081
00082 double min_orthog_res_;
00083 double max_orthog_res_;
00084
00085 int print_nao_;
00086 int print_npa_;
00087
00088 void compute_overlap_eig(RefSCMatrix& overlap_eigvec,
00089 RefDiagSCMatrix& overlap_isqrt_eigval,
00090 RefDiagSCMatrix& overlap_sqrt_eigval);
00091 void compute_symmetric_orthog();
00092 void compute_canonical_orthog();
00093 void compute_gs_orthog();
00094 void compute_orthog_trans();
00095
00096 protected:
00097
00098 int debug_;
00099
00100 double min_orthog_res() const { return min_orthog_res_; }
00101 double max_orthog_res() const { return max_orthog_res_; }
00102
00103 void copy_orthog_info(const Ref<Wavefunction> &);
00104
00105 public:
00106 Wavefunction(StateIn&);
00139 Wavefunction(const Ref<KeyVal>&);
00140 virtual ~Wavefunction();
00141
00142 void save_data_state(StateOut&);
00143
00144 double density(const SCVector3&);
00145 double density_gradient(const SCVector3&,double*);
00146 double natural_orbital(const SCVector3& r, int iorb);
00147 double natural_orbital_density(const SCVector3& r,
00148 int orb, double* orbval = 0);
00149 double orbital(const SCVector3& r, int iorb, const RefSCMatrix& orbs);
00150
00151 double orbital_density(const SCVector3& r,
00152 int iorb,
00153 const RefSCMatrix& orbs,
00154 double* orbval = 0);
00155
00157 double charge();
00159 virtual int nelectron() = 0;
00160
00162 virtual RefSymmSCMatrix density() = 0;
00164 virtual RefSymmSCMatrix ao_density();
00166 virtual RefSCMatrix natural_orbitals();
00168 virtual RefDiagSCMatrix natural_density();
00169
00171 virtual int spin_polarized() = 0;
00172
00174 virtual RefSymmSCMatrix alpha_density();
00176 virtual RefSymmSCMatrix beta_density();
00178 virtual RefSymmSCMatrix alpha_ao_density();
00180 virtual RefSymmSCMatrix beta_ao_density();
00181
00183 virtual RefSCMatrix nao(double *atom_charges=0);
00184
00186 virtual RefSymmSCMatrix overlap();
00188 virtual RefSymmSCMatrix core_hamiltonian();
00189
00191 RefSCDimension ao_dimension();
00193 RefSCDimension so_dimension();
00195 RefSCDimension oso_dimension();
00197 Ref<SCMatrixKit> basis_matrixkit();
00199 Ref<GaussianBasisSet> basis() const;
00201 Ref<Integral> integral();
00202
00203
00204 void symmetry_changed();
00205
00212 RefSCMatrix so_to_orthog_so();
00213
00216 RefSCMatrix so_to_orthog_so_inverse();
00217
00219 OrthogMethod orthog_method() { return orthog_method_; }
00220
00221 void obsolete();
00222
00223 void print(std::ostream& = ExEnv::out()) const;
00224 };
00225
00226
00227 #endif
00228
00229
00230
00231
00232