wfn.h

00001 //
00002 // wfn.h
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Curtis Janssen <cljanss@limitpt.com>
00007 // Maintainer: LPS
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
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 #include <chemistry/qc/basis/orthog.h>
00044 
00045 namespace sc {
00046 
00048 class Wavefunction: public MolecularEnergy {
00049 
00050     RefSCDimension aodim_;
00051     RefSCDimension sodim_;
00052     Ref<SCMatrixKit> basiskit_;
00053     
00054     ResultRefSymmSCMatrix overlap_;
00055     ResultRefSymmSCMatrix hcore_;
00056     ResultRefSCMatrix natural_orbitals_;
00057     ResultRefDiagSCMatrix natural_density_;
00058 
00059     double * bs_values;
00060     double * bsg_values;
00061 
00062     Ref<GaussianBasisSet> gbs_;
00063     Ref<Integral> integral_;
00064 
00065     Ref<GaussianBasisSet> atom_basis_;
00066     double * atom_basis_coef_;
00067 
00068     double lindep_tol_;
00069     OverlapOrthog::OrthogMethod orthog_method_;
00070     Ref<OverlapOrthog> orthog_;
00071 
00072     int print_nao_;
00073     int print_npa_;
00074 
00075     void init_orthog();
00076 
00077     void set_up_charge_types(std::vector<int> &q_pc,
00078                              std::vector<int> &q_cd,
00079                              std::vector<int> &n_pc,
00080                              std::vector<int> &n_cd);
00081 
00082     double nuc_rep_pc_pc(const std::vector<int>&,const std::vector<int>&,bool);
00083     double nuc_rep_pc_cd(const std::vector<int>&,const std::vector<int>&);
00084     double nuc_rep_cd_cd(const std::vector<int>&,const std::vector<int>&,bool);
00085     void scale_atom_basis_coef();
00086 
00087     void nuc_rep_grad_pc_pc(double **grad,
00088                             const std::vector<int>&c1,
00089                             const std::vector<int>&c2,
00090                             bool uniq);
00091     void nuc_rep_grad_pc_cd(double **grad,
00092                             const std::vector<int>&c1,
00093                             const std::vector<int>&c2);
00094     void nuc_rep_grad_cd_cd(double **grad,
00095                             const std::vector<int>&c1,
00096                             const std::vector<int>&c2,
00097                             bool uniq);
00098 
00099   protected:
00100 
00101     int debug_;
00102 
00103     double min_orthog_res();
00104     double max_orthog_res();
00105 
00106     void copy_orthog_info(const Ref<Wavefunction> &);
00107     
00108   public:
00109     Wavefunction(StateIn&);
00142     Wavefunction(const Ref<KeyVal>&);
00143     virtual ~Wavefunction();
00144 
00145     void save_data_state(StateOut&);
00146 
00147     double density(const SCVector3&);
00148     double density_gradient(const SCVector3&,double*);
00149     double natural_orbital(const SCVector3& r, int iorb);
00150     double natural_orbital_density(const SCVector3& r,
00151                                    int orb, double* orbval = 0);
00152     double orbital(const SCVector3& r, int iorb, const RefSCMatrix& orbs);
00153 
00154     double orbital_density(const SCVector3& r,
00155                            int iorb,
00156                            const RefSCMatrix& orbs,
00157                            double* orbval = 0);
00158 
00160     double charge();
00162     virtual int nelectron() = 0;
00163 
00165     virtual RefSymmSCMatrix density() = 0;
00167     virtual RefSymmSCMatrix ao_density();
00169     virtual RefSCMatrix natural_orbitals();
00171     virtual RefDiagSCMatrix natural_density();
00172 
00174     virtual int spin_polarized() = 0;
00175 
00177     virtual RefSymmSCMatrix alpha_density();
00179     virtual RefSymmSCMatrix beta_density();
00181     virtual RefSymmSCMatrix alpha_ao_density();
00183     virtual RefSymmSCMatrix beta_ao_density();
00184 
00186     virtual RefSCMatrix nao(double *atom_charges=0);
00187 
00189     virtual RefSymmSCMatrix overlap();
00191     virtual RefSymmSCMatrix core_hamiltonian();
00192 
00196     virtual double nuclear_repulsion_energy();
00201     void nuclear_repulsion_energy_gradient(double *g);
00206     virtual void nuclear_repulsion_energy_gradient(double **g);
00207 
00209     RefSCDimension ao_dimension();
00211     RefSCDimension so_dimension();
00213     RefSCDimension oso_dimension();
00215     Ref<SCMatrixKit> basis_matrixkit();
00217     Ref<Molecule> molecule() const;
00219     Ref<GaussianBasisSet> basis() const;
00221     Ref<GaussianBasisSet> atom_basis() const;
00224     const double *atom_basis_coef() const;
00226     Ref<Integral> integral();
00227 
00228     // override symmetry_changed from MolecularEnergy
00229     void symmetry_changed();
00230 
00237     RefSCMatrix so_to_orthog_so();
00238 
00241     RefSCMatrix so_to_orthog_so_inverse();
00242 
00244     OverlapOrthog::OrthogMethod orthog_method() const;
00246     void set_orthog_method(const OverlapOrthog::OrthogMethod&);
00247 
00249     double lindep_tol() const;
00251     void set_lindep_tol(double);
00252 
00253     void obsolete();
00254 
00255     void print(std::ostream& = ExEnv::out0()) const;
00256 };
00257 
00258 }
00259 
00260 #endif
00261 
00262 // Local Variables:
00263 // mode: c++
00264 // c-file-style: "ETS"
00265 // End:

Generated at Mon Dec 3 23:23:42 2007 for MPQC 2.3.1 using the documentation package Doxygen 1.5.2.