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 Ref<PointGroup> most_recent_pg_; 00043 int user_occupations_; 00044 int tnalpha_; 00045 int tnbeta_; 00046 int nirrep_; 00047 int *nalpha_; 00048 int *nbeta_; 00049 int *initial_nalpha_; 00050 int *initial_nbeta_; 00051 00052 AccResultRefSCMatrix oso_eigenvectors_beta_; 00053 AccResultRefDiagSCMatrix eigenvalues_beta_; 00054 ResultRefSymmSCMatrix focka_; 00055 ResultRefSymmSCMatrix fockb_; 00056 00057 protected: 00058 Ref<SCExtrapError> extrap_error(); 00059 // calculate the scf vector, returning the accuracy 00060 double compute_vector(double&); 00061 void initial_vector(int needv=1); 00062 00063 public: 00064 UnrestrictedSCF(StateIn&); 00065 UnrestrictedSCF(const Ref<KeyVal>&); 00066 ~UnrestrictedSCF(); 00067 00068 void save_data_state(StateOut&); 00069 00070 RefSCMatrix eigenvectors(); 00071 RefDiagSCMatrix eigenvalues(); 00072 00073 RefSCMatrix oso_alpha_eigenvectors(); 00074 RefSCMatrix alpha_eigenvectors(); 00075 RefDiagSCMatrix alpha_eigenvalues(); 00076 RefSCMatrix oso_beta_eigenvectors(); 00077 RefSCMatrix beta_eigenvectors(); 00078 RefDiagSCMatrix beta_eigenvalues(); 00079 00080 RefSymmSCMatrix alpha_density(); 00081 RefSymmSCMatrix beta_density(); 00082 RefSymmSCMatrix density(); 00083 00084 void symmetry_changed(); 00085 00086 double occupation(int, int); 00087 double alpha_occupation(int, int); 00088 double beta_occupation(int, int); 00089 00090 // both return 1 00091 int spin_polarized(); 00092 int spin_unrestricted(); 00093 00094 void print(std::ostream&o=ExEnv::out()) const; 00095 00096 int n_fock_matrices() const; 00097 RefSymmSCMatrix fock(int); 00098 RefSymmSCMatrix effective_fock(); 00099 00100 protected: 00101 // these are temporary data, so they should not be checkpointed 00102 Ref<TwoBodyInt> tbi_; 00103 00104 RefSymmSCMatrix densa_; 00105 RefSymmSCMatrix densb_; 00106 RefSymmSCMatrix gmata_; 00107 RefSymmSCMatrix gmatb_; 00108 RefSymmSCMatrix diff_densa_; 00109 RefSymmSCMatrix diff_densb_; 00110 00111 void set_occupations(const RefDiagSCMatrix&); 00112 void set_occupations(const RefDiagSCMatrix&, const RefDiagSCMatrix&); 00113 00114 void init_vector(); 00115 void done_vector(); 00116 double new_density(); 00117 void reset_density(); 00118 double scf_energy(); 00119 Ref<SCExtrapData> extrap_data(); 00120 00121 void init_gradient(); 00122 void done_gradient(); 00123 RefSymmSCMatrix lagrangian(); 00124 RefSymmSCMatrix gradient_density(); 00125 00126 void init_hessian(); 00127 void done_hessian(); 00128 00129 // The Hartree-Fock derivatives 00130 void two_body_deriv_hf(double*grad,double exchange_fraction); 00131 }; 00132 00133 00134 #endif 00135 00136 // Local Variables: 00137 // mode: c++ 00138 // c-file-style: "ETS" 00139 // End: