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     int dk_; // 0, 1, 2, or 3
00076     Ref<GaussianBasisSet> momentum_basis_;
00077 
00078     void init_orthog();
00079 
00080     void set_up_charge_types(std::vector<int> &q_pc,
00081                              std::vector<int> &q_cd,
00082                              std::vector<int> &n_pc,
00083                              std::vector<int> &n_cd);
00084 
00085     double nuc_rep_pc_pc(const std::vector<int>&,const std::vector<int>&,bool);
00086     double nuc_rep_pc_cd(const std::vector<int>&,const std::vector<int>&);
00087     double nuc_rep_cd_cd(const std::vector<int>&,const std::vector<int>&,bool);
00088     void scale_atom_basis_coef();
00089 
00090     void nuc_rep_grad_pc_pc(double **grad,
00091                             const std::vector<int>&c1,
00092                             const std::vector<int>&c2,
00093                             bool uniq);
00094     void nuc_rep_grad_pc_cd(double **grad,
00095                             const std::vector<int>&c1,
00096                             const std::vector<int>&c2);
00097     void nuc_rep_grad_cd_cd(double **grad,
00098                             const std::vector<int>&c1,
00099                             const std::vector<int>&c2,
00100                             bool uniq);
00101 
00102     // Compute the dk relativistic core hamiltonian.
00103     RefSymmSCMatrix core_hamiltonian_dk(
00104       int dk,
00105       const Ref<GaussianBasisSet> &bas,
00106       const Ref<GaussianBasisSet> &pbas = 0);
00107     void core_hamiltonian_dk2_contrib(const RefSymmSCMatrix &h_pbas,
00108                                       const RefDiagSCMatrix &E,
00109                                       const RefDiagSCMatrix &K,
00110                                       const RefDiagSCMatrix &p2,
00111                                       const RefDiagSCMatrix &p2K2,
00112                                       const RefDiagSCMatrix &p2K2_inv,
00113                                       const RefSymmSCMatrix &AVA_pbas,
00114                                       const RefSymmSCMatrix &BpVpB_pbas);
00115     void core_hamiltonian_dk3_contrib(const RefSymmSCMatrix &h_pbas,
00116                                       const RefDiagSCMatrix &E,
00117                                       const RefDiagSCMatrix &B,
00118                                       const RefDiagSCMatrix &p2K2_inv,
00119                                       const RefSCMatrix &so_to_p,
00120                                       const RefSymmSCMatrix &pxVp);
00121     // Compute the non-relativistic core hamiltonian.
00122     RefSymmSCMatrix core_hamiltonian_nr(
00123       const Ref<GaussianBasisSet> &bas);
00124 
00125   protected:
00126 
00127     int debug_;
00128 
00129     double min_orthog_res();
00130     double max_orthog_res();
00131 
00132     void copy_orthog_info(const Ref<Wavefunction> &);
00133     
00134   public:
00135     Wavefunction(StateIn&);
00168     Wavefunction(const Ref<KeyVal>&);
00169     virtual ~Wavefunction();
00170 
00171     void save_data_state(StateOut&);
00172 
00173     double density(const SCVector3&);
00174     double density_gradient(const SCVector3&,double*);
00175     double natural_orbital(const SCVector3& r, int iorb);
00176     double natural_orbital_density(const SCVector3& r,
00177                                    int orb, double* orbval = 0);
00178     double orbital(const SCVector3& r, int iorb, const RefSCMatrix& orbs);
00179 
00180     double orbital_density(const SCVector3& r,
00181                            int iorb,
00182                            const RefSCMatrix& orbs,
00183                            double* orbval = 0);
00184 
00186     double charge();
00188     virtual int nelectron() = 0;
00189 
00191     virtual RefSymmSCMatrix density() = 0;
00193     virtual RefSymmSCMatrix ao_density();
00195     virtual RefSCMatrix natural_orbitals();
00197     virtual RefDiagSCMatrix natural_density();
00198 
00200     virtual int spin_polarized() = 0;
00201 
00203     int dk() const { return dk_; }
00204 
00206     virtual RefSymmSCMatrix alpha_density();
00208     virtual RefSymmSCMatrix beta_density();
00210     virtual RefSymmSCMatrix alpha_ao_density();
00212     virtual RefSymmSCMatrix beta_ao_density();
00213 
00215     virtual RefSCMatrix nao(double *atom_charges=0);
00216 
00218     virtual RefSymmSCMatrix overlap();
00222     virtual RefSymmSCMatrix core_hamiltonian_for_basis(
00223       const Ref<GaussianBasisSet> &bas,
00224       const Ref<GaussianBasisSet> &pbas = 0);
00226     virtual RefSymmSCMatrix core_hamiltonian();
00227 
00231     virtual double nuclear_repulsion_energy();
00236     void nuclear_repulsion_energy_gradient(double *g);
00241     virtual void nuclear_repulsion_energy_gradient(double **g);
00242 
00244     RefSCDimension ao_dimension();
00246     RefSCDimension so_dimension();
00248     RefSCDimension oso_dimension();
00250     Ref<SCMatrixKit> basis_matrixkit();
00252     Ref<Molecule> molecule() const;
00254     Ref<GaussianBasisSet> basis() const;
00256     Ref<GaussianBasisSet> momentum_basis() const;
00258     Ref<GaussianBasisSet> atom_basis() const;
00261     const double *atom_basis_coef() const;
00263     Ref<Integral> integral();
00264 
00265     // override symmetry_changed from MolecularEnergy
00266     void symmetry_changed();
00267 
00274     RefSCMatrix so_to_orthog_so();
00275 
00278     RefSCMatrix so_to_orthog_so_inverse();
00279 
00281     OverlapOrthog::OrthogMethod orthog_method() const;
00283     void set_orthog_method(const OverlapOrthog::OrthogMethod&);
00284 
00286     double lindep_tol() const;
00288     void set_lindep_tol(double);
00289 
00290     void obsolete();
00291 
00292     void print(std::ostream& = ExEnv::out0()) const;
00293 };
00294 
00295 }
00296 
00297 #endif
00298 
00299 // Local Variables:
00300 // mode: c++
00301 // c-file-style: "ETS"
00302 // End:

Generated at Wed Sep 5 14:02:31 2007 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.5.2.
These pages are hosted on SourceForge.net