# 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
    00081     void set_desired_value_accuracy(double eps);
    00082
    00083     // Following is a proposed interface to make the meaning of
    00084     // the various transformation matrices less confusing.
    00085 //     /** These members give metrics and basis transformations
    00086 //         using the covariant/contravariant tensor notation. */
    00087 //     //@{
    00088 //     /** Returns the transformation matrix that converts
    00089 //         a contravariant SO tensor index to a contravariant
    00090 //         MO tensor index.
    00091 //      */
    00092 //     RefSCMatrix t_mo_so_I_J();
    00093 //     /** Returns the transformation matrix that converts a covariant SO
    00094 //         tensor index to a covariant MO tensor index.
    00095 //      */
    00096 //     RefSCMatrix t_mo_so_i_j();
    00097 //     /** Returns the transformation matrix that converts
    00098 //         a contravariant MO tensor index to a contravariant
    00099 //         SO tensor index.
    00100 //      */
    00101 //     RefSCMatrix t_mo_so_I_J();
    00102 //     /** Returns the transformation matrix that converts a covariant MO
    00103 //         tensor index to a covariant SO tensor index.
    00104 //      */
    00105 //     RefSCMatrix t_mo_so_i_j();
    00106 //     /** Returns the metric for converting a covariant SO index into
    00107 //         a contravariant one. */
    00108 //     RefSCMatrix g_so_I_j();
    00109 //     /** Returns the metric for converting a contravariant SO index into
    00110 //         a covariant one. */
    00111 //     RefSCMatrix g_so_i_J();
    00112 //     //@}
    00113
    00115     RefSCMatrix so_to_mo();
    00117     RefSCMatrix orthog_so_to_mo();
    00119     RefSCMatrix mo_to_so();
    00122     RefSCMatrix mo_to_orthog_so();
    00123
    00125     RefSCMatrix eigenvectors();
    00128     virtual RefSCMatrix oso_eigenvectors() = 0;
    00130     virtual RefDiagSCMatrix eigenvalues() = 0;
    00133     virtual double occupation(int irrep, int vectornum) = 0;
    00136     double occupation(int vectornum);
    00137
    00139     virtual int spin_unrestricted() = 0;
    00140
    00143     virtual double alpha_occupation(int irrep, int vectornum);
    00146     virtual double beta_occupation(int irrep, int vectornum);
    00149     double alpha_occupation(int vectornum);
    00152     double beta_occupation(int vectornum);
    00153
    00154     // Return alpha and beta electron densities
    00155     virtual RefSCMatrix oso_alpha_eigenvectors();
    00156     virtual RefSCMatrix oso_beta_eigenvectors();
    00157     virtual RefSCMatrix alpha_eigenvectors();
    00158     virtual RefSCMatrix beta_eigenvectors();
    00159     virtual RefDiagSCMatrix alpha_eigenvalues();
    00160     virtual RefDiagSCMatrix beta_eigenvalues();
    00161
    00162     virtual RefDiagSCMatrix
    00163       projected_eigenvalues(const Ref<OneBodyWavefunction>&, int alp=1);
    00166     virtual RefSCMatrix projected_eigenvectors(const Ref<OneBodyWavefunction>&,
    00167                                                int alp=1);
    00170     virtual RefSCMatrix hcore_guess();
    00174     virtual RefSCMatrix hcore_guess(RefDiagSCMatrix &val);
    00175
    00176     void symmetry_changed();
    00177
    00178     double orbital(const SCVector3& r, int iorb);
    00179     double orbital_density(const SCVector3& r, int iorb, double* orbval = 0);
    00180
    00181     void print(std::ostream&o=ExEnv::out0()) const;
    00182 };
    00183
    00184
    00185 // This is useful as an initial guess for other one body wavefunctions
    00186 class HCoreWfn: public OneBodyWavefunction {
    00187   private:
    00188     int nirrep_;
    00189     int *docc_;
    00190     int *socc_;
    00191     int total_charge_;
    00192     int user_occ_;
    00193
    00194     void fill_occ(const RefDiagSCMatrix &evals,
    00195                   int ndocc, int *docc, int nsocc = 0, int *socc = 0);
    00196
    00197     void compute();
    00198
    00199   public:
    00200     HCoreWfn(StateIn&);
    00201     HCoreWfn(const Ref<KeyVal>&);
    00202     ~HCoreWfn();
    00203
    00204     void save_data_state(StateOut&);
    00205
    00206     double occupation(int irrep, int vectornum);
    00207
    00208     RefSCMatrix oso_eigenvectors();
    00209     RefDiagSCMatrix eigenvalues();
    00210     RefSymmSCMatrix density();
    00211     int spin_polarized();
    00212     int spin_unrestricted();
    00213
    00214     int value_implemented() const;
    00215 };
    00216
    00217 }
    00218
    00219 #endif
    00220
    00221 // Local Variables:
    00222 // mode: c++
    00223 // c-file-style: "ETS"
    00224 // End: