# obwfn.h

    00001 //
    00002 // obwfn.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_obwfn_h
    00029 #define _chemistry_qc_wfn_obwfn_h
    00030
    00031 #ifdef __GNUC__
    00032 #pragma interface
    00033 #endif
    00034
    00035 #include <chemistry/qc/wfn/wfn.h>
    00036
    00037 namespace sc {
    00038
    00041 class OneBodyWavefunction: public Wavefunction {
    00042  protected:
    00043     ResultRefSymmSCMatrix density_;
    00044     AccResultRefSCMatrix oso_eigenvectors_;
    00045     AccResultRefDiagSCMatrix eigenvalues_;
    00046     int nirrep_;
    00047     int *nvecperirrep_;
    00048     double *occupations_;
    00049     double *alpha_occupations_;
    00050     double *beta_occupations_;
    00051
    00052     void init_sym_info();
    00053
    00054     // oldocc is converted to newocc using the correlation
    00055     // table between initial_pg_ and the current point group
    00056     // returns 1 if successful and 0 otherwise.  newocc is
    00057     // delete[]'ed and new'ed.
    00058     int form_occupations(int *&newocc, const int *oldocc);
    00059
    00060  public:
    00061     OneBodyWavefunction(StateIn&);
    00072     OneBodyWavefunction(const Ref<KeyVal>&);
    00073     ~OneBodyWavefunction();
    00074
    00075     void save_data_state(StateOut&);
    00076
    00077     int nelectron();
    00078
    00080     RefSCMatrix so_to_mo();
    00082     RefSCMatrix orthog_so_to_mo();
    00084     RefSCMatrix mo_to_so();
    00087     RefSCMatrix mo_to_orthog_so();
    00088
    00090     RefSCMatrix eigenvectors();
    00092     virtual RefSCMatrix oso_eigenvectors() = 0;
    00094     virtual RefDiagSCMatrix eigenvalues() = 0;
    00097     virtual double occupation(int irrep, int vectornum) = 0;
    00100     double occupation(int vectornum);
    00101
    00103     virtual int spin_unrestricted() = 0;
    00104
    00107     virtual double alpha_occupation(int irrep, int vectornum);
    00110     virtual double beta_occupation(int irrep, int vectornum);
    00113     double alpha_occupation(int vectornum);
    00116     double beta_occupation(int vectornum);
    00117
    00118     // Return alpha and beta electron densities
    00119     virtual RefSCMatrix oso_alpha_eigenvectors();
    00120     virtual RefSCMatrix oso_beta_eigenvectors();
    00121     virtual RefSCMatrix alpha_eigenvectors();
    00122     virtual RefSCMatrix beta_eigenvectors();
    00123     virtual RefDiagSCMatrix alpha_eigenvalues();
    00124     virtual RefDiagSCMatrix beta_eigenvalues();
    00125
    00126     virtual RefDiagSCMatrix
    00127       projected_eigenvalues(const Ref<OneBodyWavefunction>&, int alp=1);
    00130     virtual RefSCMatrix projected_eigenvectors(const Ref<OneBodyWavefunction>&,
    00131                                                int alp=1);
    00134     virtual RefSCMatrix hcore_guess();
    00138     virtual RefSCMatrix hcore_guess(RefDiagSCMatrix &val);
    00139
    00140     void symmetry_changed();
    00141
    00142     double orbital(const SCVector3& r, int iorb);
    00143     double orbital_density(const SCVector3& r, int iorb, double* orbval = 0);
    00144
    00145     void print(std::ostream&o=ExEnv::out0()) const;
    00146 };
    00147
    00148
    00149 // This is useful as an initial guess for other one body wavefunctions
    00150 class HCoreWfn: public OneBodyWavefunction {
    00151   private:
    00152     int nirrep_;
    00153     int *docc_;
    00154     int *socc_;
    00155     int total_charge_;
    00156     int user_occ_;
    00157
    00158     void fill_occ(const RefDiagSCMatrix &evals,
    00159                   int ndocc, int *docc, int nsocc = 0, int *socc = 0);
    00160
    00161     void compute();
    00162
    00163   public:
    00164     HCoreWfn(StateIn&);
    00165     HCoreWfn(const Ref<KeyVal>&);
    00166     ~HCoreWfn();
    00167
    00168     void save_data_state(StateOut&);
    00169
    00170     double occupation(int irrep, int vectornum);
    00171
    00172     RefSCMatrix oso_eigenvectors();
    00173     RefDiagSCMatrix eigenvalues();
    00174     RefSymmSCMatrix density();
    00175     int spin_polarized();
    00176     int spin_unrestricted();
    00177
    00178     int value_implemented() const;
    00179 };
    00180
    00181 }
    00182
    00183 #endif
    00184
    00185 // Local Variables:
    00186 // mode: c++
    00187 // c-file-style: "ETS"
    00188 // End: