| 1 | // | 
|---|
| 2 | // hsosscf.h --- definition of the high-spin open shell SCF class | 
|---|
| 3 | // | 
|---|
| 4 | // Copyright (C) 1996 Limit Point Systems, Inc. | 
|---|
| 5 | // | 
|---|
| 6 | // Author: Edward Seidl <seidl@janed.com> | 
|---|
| 7 | // Maintainer: LPS | 
|---|
| 8 | // | 
|---|
| 9 | // This file is part of the SC Toolkit. | 
|---|
| 10 | // | 
|---|
| 11 | // The SC Toolkit is free software; you can redistribute it and/or modify | 
|---|
| 12 | // it under the terms of the GNU Library General Public License as published by | 
|---|
| 13 | // the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 14 | // any later version. | 
|---|
| 15 | // | 
|---|
| 16 | // The SC Toolkit is distributed in the hope that it will be useful, | 
|---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 19 | // GNU Library General Public License for more details. | 
|---|
| 20 | // | 
|---|
| 21 | // You should have received a copy of the GNU Library General Public License | 
|---|
| 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to | 
|---|
| 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 
|---|
| 24 | // | 
|---|
| 25 | // The U.S. Government is granted a limited license as per AL 91-7. | 
|---|
| 26 | // | 
|---|
| 27 |  | 
|---|
| 28 | #ifndef _chemistry_qc_scf_hsosscf_h | 
|---|
| 29 | #define _chemistry_qc_scf_hsosscf_h | 
|---|
| 30 |  | 
|---|
| 31 | #ifdef __GNUC__ | 
|---|
| 32 | #pragma interface | 
|---|
| 33 | #endif | 
|---|
| 34 |  | 
|---|
| 35 | #include <chemistry/qc/scf/scf.h> | 
|---|
| 36 |  | 
|---|
| 37 | namespace sc { | 
|---|
| 38 |  | 
|---|
| 39 | // ////////////////////////////////////////////////////////////////////////// | 
|---|
| 40 |  | 
|---|
| 41 | /** The HSOSSCF class is a base for classes implementing a self-consistent | 
|---|
| 42 | procedure for high-spin open-shell molecules. */ | 
|---|
| 43 | class HSOSSCF: public SCF { | 
|---|
| 44 | protected: | 
|---|
| 45 | Ref<PointGroup> most_recent_pg_; | 
|---|
| 46 | int user_occupations_; | 
|---|
| 47 | int tndocc_; | 
|---|
| 48 | int tnsocc_; | 
|---|
| 49 | int nirrep_; | 
|---|
| 50 | int *initial_ndocc_; | 
|---|
| 51 | int *initial_nsocc_; | 
|---|
| 52 | int *ndocc_; | 
|---|
| 53 | int *nsocc_; | 
|---|
| 54 |  | 
|---|
| 55 | ResultRefSymmSCMatrix cl_fock_; | 
|---|
| 56 | ResultRefSymmSCMatrix op_fock_; | 
|---|
| 57 |  | 
|---|
| 58 | public: | 
|---|
| 59 | HSOSSCF(StateIn&); | 
|---|
| 60 | /** The KeyVal constructor. | 
|---|
| 61 | <dl> | 
|---|
| 62 |  | 
|---|
| 63 | <dt><tt>total_charge</tt><dd> This floating point number | 
|---|
| 64 | gives the total charge, | 
|---|
| 65 | \f$c\f$, of the molecule.  The default is 0. | 
|---|
| 66 |  | 
|---|
| 67 | <dt><tt>nsocc</tt><dd> This integer gives the total number of | 
|---|
| 68 | singly occupied orbitals, \f$n_\mathrm{socc}\f$.  If this is not | 
|---|
| 69 | given, then multiplicity will be read. | 
|---|
| 70 |  | 
|---|
| 71 | <dt><tt>multiplicity</tt><dd> This integer gives the multiplicity, | 
|---|
| 72 | \f$m\f$, of the molecule.  The number of singly occupied orbitals | 
|---|
| 73 | is then \f$n_\mathrm{socc} = m - 1\f$.  If neither nsocc nor | 
|---|
| 74 | multiplicity is given, then if, in consideration of total_charge, | 
|---|
| 75 | the number of electrons is even, the default \f$n_\mathrm{socc}\f$ | 
|---|
| 76 | is 2.  Otherwise, it is 1. | 
|---|
| 77 |  | 
|---|
| 78 | <dt><tt>ndocc</tt><dd> This integer gives the total number of | 
|---|
| 79 | doubly occupied orbitals \f$n_\mathrm{docc}\f$.  The default | 
|---|
| 80 | \f$n_\mathrm{docc} = (c - n_\mathrm{socc})/2\f$. | 
|---|
| 81 |  | 
|---|
| 82 | <dt><tt>socc</tt><dd> This vector of integers gives the total | 
|---|
| 83 | number of singly occupied orbitals of each irreducible | 
|---|
| 84 | representation.  By default, the \f$n_\mathrm{socc}\f$ singly | 
|---|
| 85 | occupied orbitals will be distributed according to orbital | 
|---|
| 86 | eigenvalues.  If socc is given, then docc must be given and they | 
|---|
| 87 | override nsocc, multiplicity, ndocc, and total_charge. | 
|---|
| 88 |  | 
|---|
| 89 | <dt><tt>docc</tt><dd> This vector of integers gives the total | 
|---|
| 90 | number of doubly occupied orbitals of each irreducible | 
|---|
| 91 | representation.  By default, the \f$n_\mathrm{docc}\f$ singly | 
|---|
| 92 | occupied orbitals will be distributed according to orbital | 
|---|
| 93 | eigenvalues.  If docc is given, then socc must be given and they | 
|---|
| 94 | override nsocc, multiplicity, ndocc, and total_charge. | 
|---|
| 95 |  | 
|---|
| 96 | <dt><tt>maxiter</tt><dd> This has the same meaning as in the parent | 
|---|
| 97 | class, SCF; however, the default value is 100. | 
|---|
| 98 |  | 
|---|
| 99 | <dt><tt>level_shift</tt><dd> This has the same meaning as in the | 
|---|
| 100 | parent class, SCF; however, the default value is 1.0. | 
|---|
| 101 |  | 
|---|
| 102 | </dl> */ | 
|---|
| 103 | HSOSSCF(const Ref<KeyVal>&); | 
|---|
| 104 | ~HSOSSCF(); | 
|---|
| 105 |  | 
|---|
| 106 | void save_data_state(StateOut&); | 
|---|
| 107 |  | 
|---|
| 108 | void print(std::ostream&o=ExEnv::out0()) const; | 
|---|
| 109 |  | 
|---|
| 110 | double occupation(int irrep, int vectornum); | 
|---|
| 111 | double alpha_occupation(int irrep, int vectornum); | 
|---|
| 112 | double beta_occupation(int irrep, int vectornum); | 
|---|
| 113 |  | 
|---|
| 114 | int n_fock_matrices() const; | 
|---|
| 115 | /** Returns closed-shell (i==0) or open-shell (i==1) Fock matrix in AO basis | 
|---|
| 116 | (excluding XC contribution in KS DFT). | 
|---|
| 117 | Use effective_fock() if you want the full KS Fock matrix. | 
|---|
| 118 | */ | 
|---|
| 119 | RefSymmSCMatrix fock(int i); | 
|---|
| 120 | /** Returns effective Fock matrix in MO basis (including XC contribution for KS DFT). */ | 
|---|
| 121 | RefSymmSCMatrix effective_fock(); | 
|---|
| 122 |  | 
|---|
| 123 | void symmetry_changed(); | 
|---|
| 124 |  | 
|---|
| 125 | // returns 1 | 
|---|
| 126 | int spin_polarized(); | 
|---|
| 127 | RefSymmSCMatrix density(); | 
|---|
| 128 | RefSymmSCMatrix alpha_density(); | 
|---|
| 129 | RefSymmSCMatrix beta_density(); | 
|---|
| 130 |  | 
|---|
| 131 | protected: | 
|---|
| 132 | // these are temporary data, so they should not be checkpointed | 
|---|
| 133 | RefSymmSCMatrix cl_dens_; | 
|---|
| 134 | RefSymmSCMatrix cl_dens_diff_; | 
|---|
| 135 | RefSymmSCMatrix cl_gmat_; | 
|---|
| 136 | RefSymmSCMatrix op_dens_; | 
|---|
| 137 | RefSymmSCMatrix op_dens_diff_; | 
|---|
| 138 | RefSymmSCMatrix op_gmat_; | 
|---|
| 139 |  | 
|---|
| 140 | RefSymmSCMatrix cl_hcore_; | 
|---|
| 141 |  | 
|---|
| 142 | void set_occupations(const RefDiagSCMatrix& evals); | 
|---|
| 143 |  | 
|---|
| 144 | // scf things | 
|---|
| 145 | void init_vector(); | 
|---|
| 146 | void done_vector(); | 
|---|
| 147 | void reset_density(); | 
|---|
| 148 | double new_density(); | 
|---|
| 149 | double scf_energy(); | 
|---|
| 150 |  | 
|---|
| 151 | Ref<SCExtrapData> extrap_data(); | 
|---|
| 152 |  | 
|---|
| 153 | // gradient things | 
|---|
| 154 | void init_gradient(); | 
|---|
| 155 | void done_gradient(); | 
|---|
| 156 |  | 
|---|
| 157 | RefSymmSCMatrix lagrangian(); | 
|---|
| 158 | RefSymmSCMatrix gradient_density(); | 
|---|
| 159 |  | 
|---|
| 160 | // hessian things | 
|---|
| 161 | void init_hessian(); | 
|---|
| 162 | void done_hessian(); | 
|---|
| 163 |  | 
|---|
| 164 | // The Hartree-Fock derivatives | 
|---|
| 165 | void two_body_deriv_hf(double*grad,double exchange_fraction); | 
|---|
| 166 | }; | 
|---|
| 167 |  | 
|---|
| 168 | } | 
|---|
| 169 |  | 
|---|
| 170 | #endif | 
|---|
| 171 |  | 
|---|
| 172 | // Local Variables: | 
|---|
| 173 | // mode: c++ | 
|---|
| 174 | // c-file-style: "ETS" | 
|---|
| 175 | // End: | 
|---|