00001 // 00002 // uscf.h --- definition of the UnrestrictedSCF abstract base class 00003 // 00004 // Copyright (C) 1997 Limit Point Systems, Inc. 00005 // 00006 // Author: Edward Seidl <seidl@janed.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_scf_uscf_h 00029 #define _chemistry_qc_scf_uscf_h 00030 00031 #ifdef __GNUC__ 00032 #pragma interface 00033 #endif 00034 00035 #include <chemistry/qc/scf/scf.h> 00036 00037 // ////////////////////////////////////////////////////////////////////////// 00038 00040 class UnrestrictedSCF: public SCF { 00041 protected: 00042 int user_occupations_; 00043 int tnalpha_; 00044 int tnbeta_; 00045 int nirrep_; 00046 int *nalpha_; 00047 int *nbeta_; 00048 00049 AccResultRefSCMatrix oso_eigenvectors_beta_; 00050 AccResultRefDiagSCMatrix eigenvalues_beta_; 00051 ResultRefSymmSCMatrix focka_; 00052 ResultRefSymmSCMatrix fockb_; 00053 00054 protected: 00055 Ref<SCExtrapError> extrap_error(); 00056 // calculate the scf vector, returning the accuracy 00057 double compute_vector(double&); 00058 void initial_vector(int needv=1); 00059 00060 public: 00061 UnrestrictedSCF(StateIn&); 00062 UnrestrictedSCF(const Ref<KeyVal>&); 00063 ~UnrestrictedSCF(); 00064 00065 void save_data_state(StateOut&); 00066 00067 RefSCMatrix eigenvectors(); 00068 RefDiagSCMatrix eigenvalues(); 00069 00070 RefSCMatrix oso_alpha_eigenvectors(); 00071 RefSCMatrix alpha_eigenvectors(); 00072 RefDiagSCMatrix alpha_eigenvalues(); 00073 RefSCMatrix oso_beta_eigenvectors(); 00074 RefSCMatrix beta_eigenvectors(); 00075 RefDiagSCMatrix beta_eigenvalues(); 00076 00077 RefSymmSCMatrix alpha_density(); 00078 RefSymmSCMatrix beta_density(); 00079 RefSymmSCMatrix density(); 00080 00081 double occupation(int, int); 00082 double alpha_occupation(int, int); 00083 double beta_occupation(int, int); 00084 00085 // both return 1 00086 int spin_polarized(); 00087 int spin_unrestricted(); 00088 00089 void print(std::ostream&o=ExEnv::out()) const; 00090 00091 int n_fock_matrices() const; 00092 RefSymmSCMatrix fock(int); 00093 RefSymmSCMatrix effective_fock(); 00094 00095 protected: 00096 // these are temporary data, so they should not be checkpointed 00097 Ref<TwoBodyInt> tbi_; 00098 00099 RefSymmSCMatrix densa_; 00100 RefSymmSCMatrix densb_; 00101 RefSymmSCMatrix gmata_; 00102 RefSymmSCMatrix gmatb_; 00103 RefSymmSCMatrix diff_densa_; 00104 RefSymmSCMatrix diff_densb_; 00105 00106 void set_occupations(const RefDiagSCMatrix&); 00107 void set_occupations(const RefDiagSCMatrix&, const RefDiagSCMatrix&); 00108 00109 void init_vector(); 00110 void done_vector(); 00111 double new_density(); 00112 void reset_density(); 00113 double scf_energy(); 00114 Ref<SCExtrapData> extrap_data(); 00115 00116 void init_gradient(); 00117 void done_gradient(); 00118 RefSymmSCMatrix lagrangian(); 00119 RefSymmSCMatrix gradient_density(); 00120 00121 void init_hessian(); 00122 void done_hessian(); 00123 00124 // The Hartree-Fock derivatives 00125 void two_body_deriv_hf(double*grad,double exchange_fraction); 00126 }; 00127 00128 00129 #endif 00130 00131 // Local Variables: 00132 // mode: c++ 00133 // c-file-style: "ETS" 00134 // End: