| 1 | //
|
|---|
| 2 | // vxb_eval_info.h
|
|---|
| 3 | //
|
|---|
| 4 | // Copyright (C) 2003 Edward Valeev
|
|---|
| 5 | //
|
|---|
| 6 | // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
|
|---|
| 7 | // Maintainer: EV
|
|---|
| 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 | #ifdef __GNUG__
|
|---|
| 29 | #pragma interface
|
|---|
| 30 | #endif
|
|---|
| 31 |
|
|---|
| 32 | #ifndef _chemistry_qc_mbptr12_vxbevalinfo_h
|
|---|
| 33 | #define _chemistry_qc_mbptr12_vxbevalinfo_h
|
|---|
| 34 |
|
|---|
| 35 | #include <string>
|
|---|
| 36 | #include <util/misc/string.h>
|
|---|
| 37 | #include <util/ref/ref.h>
|
|---|
| 38 | #include <math/scmat/abstract.h>
|
|---|
| 39 | #include <util/group/memory.h>
|
|---|
| 40 | #include <chemistry/molecule/energy.h>
|
|---|
| 41 | #include <chemistry/qc/scf/scf.h>
|
|---|
| 42 | #include <chemistry/qc/mbptr12/linearr12.h>
|
|---|
| 43 | #include <chemistry/qc/mbptr12/moindexspace.h>
|
|---|
| 44 | #include <chemistry/qc/mbptr12/transform_factory.h>
|
|---|
| 45 |
|
|---|
| 46 | namespace sc {
|
|---|
| 47 |
|
|---|
| 48 | class MBPT2_R12;
|
|---|
| 49 |
|
|---|
| 50 | /** Class R12IntEvalInfo contains information necessary for R12 intermediate
|
|---|
| 51 | evaluators */
|
|---|
| 52 |
|
|---|
| 53 | class R12IntEvalInfo : virtual public SavableState {
|
|---|
| 54 |
|
|---|
| 55 | public:
|
|---|
| 56 |
|
|---|
| 57 | /// Describes the method of storing transformed MO integrals. See MBPT2_R12.
|
|---|
| 58 | enum StoreMethod { mem_posix = 0, posix = 1, mem_mpi = 2, mpi = 3, mem_only = 4 };
|
|---|
| 59 |
|
|---|
| 60 | private:
|
|---|
| 61 |
|
|---|
| 62 | Wavefunction* wfn_; // Wavefunction that owns this
|
|---|
| 63 | Ref<SCF> ref_;
|
|---|
| 64 | Ref<Integral> integral_;
|
|---|
| 65 | Ref<GaussianBasisSet> bs_;
|
|---|
| 66 | Ref<GaussianBasisSet> bs_aux_;
|
|---|
| 67 | Ref<GaussianBasisSet> bs_vir_;
|
|---|
| 68 | Ref<GaussianBasisSet> bs_ri_;
|
|---|
| 69 | Ref<SCMatrixKit> matrixkit_;
|
|---|
| 70 | Ref<MessageGrp> msg_;
|
|---|
| 71 | Ref<MemoryGrp> mem_;
|
|---|
| 72 | Ref<ThreadGrp> thr_;
|
|---|
| 73 |
|
|---|
| 74 | int nocc_;
|
|---|
| 75 | int nfzc_;
|
|---|
| 76 | int nfzv_;
|
|---|
| 77 |
|
|---|
| 78 | size_t memory_;
|
|---|
| 79 | bool dynamic_;
|
|---|
| 80 | double print_percent_;
|
|---|
| 81 | int debug_;
|
|---|
| 82 | StoreMethod ints_method_;
|
|---|
| 83 | std::string ints_file_;
|
|---|
| 84 | LinearR12::ABSMethod abs_method_;
|
|---|
| 85 |
|
|---|
| 86 | int nlindep_aux_;
|
|---|
| 87 | int nlindep_vir_;
|
|---|
| 88 | int nlindep_ri_;
|
|---|
| 89 |
|
|---|
| 90 | Ref<MOIndexSpace> mo_space_; // symblocked MO space
|
|---|
| 91 | Ref<MOIndexSpace> obs_space_; // energy-sorted MO space
|
|---|
| 92 | Ref<MOIndexSpace> abs_space_;
|
|---|
| 93 | Ref<MOIndexSpace> ribs_space_;
|
|---|
| 94 | Ref<MOIndexSpace> act_occ_space_;
|
|---|
| 95 | Ref<MOIndexSpace> occ_space_;
|
|---|
| 96 | Ref<MOIndexSpace> occ_space_symblk_;
|
|---|
| 97 | Ref<MOIndexSpace> act_vir_space_;
|
|---|
| 98 | Ref<MOIndexSpace> vir_space_;
|
|---|
| 99 | Ref<MOIndexSpace> vir_space_symblk_;
|
|---|
| 100 | Ref<MOIntsTransformFactory> tfactory_;
|
|---|
| 101 |
|
|---|
| 102 | // construct the RI basis based on abs_method
|
|---|
| 103 | void construct_ri_basis_(bool safe);
|
|---|
| 104 | void construct_ri_basis_ks_(bool safe);
|
|---|
| 105 | void construct_ri_basis_ksplus_(bool safe);
|
|---|
| 106 | void construct_ri_basis_ev_(bool safe);
|
|---|
| 107 | void construct_ri_basis_evplus_(bool safe);
|
|---|
| 108 | // Uses ri_basis to construct a basis that spans the orthogonal complement to the OBS
|
|---|
| 109 | void construct_ortho_comp_svd_();
|
|---|
| 110 | // Returns true if ABS spans OBS
|
|---|
| 111 | bool abs_spans_obs_();
|
|---|
| 112 | // Construct eigenvector and eigenvalues sorted by energy
|
|---|
| 113 | void eigen2_();
|
|---|
| 114 | // Construct orthog_aux_
|
|---|
| 115 | void construct_orthog_aux_();
|
|---|
| 116 | // Construct orthog_vir_
|
|---|
| 117 | void construct_orthog_vir_();
|
|---|
| 118 | // Construct orthog_ri_
|
|---|
| 119 | void construct_orthog_ri_();
|
|---|
| 120 |
|
|---|
| 121 | public:
|
|---|
| 122 | R12IntEvalInfo(StateIn&);
|
|---|
| 123 | /// Constructs an R12IntEvalInfo object using data from the MBPT2_R12 object
|
|---|
| 124 | R12IntEvalInfo(MBPT2_R12*);
|
|---|
| 125 | ~R12IntEvalInfo();
|
|---|
| 126 |
|
|---|
| 127 | void save_data_state(StateOut&);
|
|---|
| 128 |
|
|---|
| 129 | /** Sets whether to use dynamic load balancing in parallel MO transformations.
|
|---|
| 130 | Default is no */
|
|---|
| 131 | void set_dynamic(bool dynamic) { dynamic_ = dynamic; };
|
|---|
| 132 | /// Sets how frequently updates of progress are printed out. Default is 10%
|
|---|
| 133 | void set_print_percent(double print_percent) { print_percent_ = print_percent; };
|
|---|
| 134 | /// Set debug level. Default is 0.
|
|---|
| 135 | void set_debug_level(int debug) { debug_ = debug; };
|
|---|
| 136 | /** Sets the method of storing transformed MO integrals. Default depends on
|
|---|
| 137 | how the object was constructed. */
|
|---|
| 138 | void set_ints_method(const StoreMethod method) { ints_method_ = method; };
|
|---|
| 139 | /** Sets name of the file used to store transformed integrals.
|
|---|
| 140 | Default depends on how the object was constructed. */
|
|---|
| 141 | void set_ints_file(const std::string& filename) { ints_file_ = filename; };
|
|---|
| 142 | /** Sets the amount of memory to use for the calculation. Default is
|
|---|
| 143 | determined by DEFAULT_SC_MEMORY. */
|
|---|
| 144 | void set_memory(const size_t nbytes);
|
|---|
| 145 | /** Sets the ABS approach to be used (ABS or CABS).
|
|---|
| 146 | Default depends on how the object was constructed. */
|
|---|
| 147 | void set_absmethod(LinearR12::ABSMethod abs_method);
|
|---|
| 148 |
|
|---|
| 149 | Wavefunction* wfn() const { return wfn_; };
|
|---|
| 150 | Ref<SCF> ref() const { return ref_; };
|
|---|
| 151 | Ref<Integral> integral() const { return integral_; };
|
|---|
| 152 | /// Returns the orbital basis set (OBS) object
|
|---|
| 153 | Ref<GaussianBasisSet> basis() const { return bs_; };
|
|---|
| 154 | /// Returns the virtuals basis set (VBS) object
|
|---|
| 155 | Ref<GaussianBasisSet> basis_vir() const { return bs_vir_; };
|
|---|
| 156 | /// Returns the resolution-of-the-identity basis set (RIBS) object
|
|---|
| 157 | Ref<GaussianBasisSet> basis_ri() const { return bs_ri_; };
|
|---|
| 158 | Ref<SCMatrixKit> matrixkit() const { return matrixkit_; };
|
|---|
| 159 | Ref<MemoryGrp> mem() const { return mem_;};
|
|---|
| 160 | Ref<MessageGrp> msg() const { return msg_;};
|
|---|
| 161 | Ref<ThreadGrp> thr() const { return thr_;};
|
|---|
| 162 |
|
|---|
| 163 | bool dynamic() const { return dynamic_; };
|
|---|
| 164 | double print_percent() const { return print_percent_; };
|
|---|
| 165 | int debug_level() const { return debug_; };
|
|---|
| 166 | const StoreMethod ints_method() const { return ints_method_; };
|
|---|
| 167 | const std::string& ints_file() const;
|
|---|
| 168 | const size_t memory() const { return memory_; };
|
|---|
| 169 |
|
|---|
| 170 | const int nocc() const { return nocc_;};
|
|---|
| 171 | const int nocc_act() const { return nocc_ - nfzc_;};
|
|---|
| 172 | const int nfzc() const { return nfzc_;};
|
|---|
| 173 | const int nvir() const { return vir_space_->rank();};
|
|---|
| 174 | const int nvir_act() const { return act_vir_space_->rank();};
|
|---|
| 175 | const int nfzv() const { return nfzv_;};
|
|---|
| 176 |
|
|---|
| 177 | LinearR12::ABSMethod abs_method() const { return abs_method_; };
|
|---|
| 178 |
|
|---|
| 179 | /// Returns the MOIndexSpace object for symmetry-blocked MOs in OBS
|
|---|
| 180 | Ref<MOIndexSpace> mo_space() const { return mo_space_; };
|
|---|
| 181 | /// Returns the MOIndexSpace object for energy-sorted MOs in OBS
|
|---|
| 182 | Ref<MOIndexSpace> obs_space() const { return obs_space_; };
|
|---|
| 183 | /// Returns the MOIndexSpace object for the active occupied MOs
|
|---|
| 184 | Ref<MOIndexSpace> act_occ_space() const { return act_occ_space_; };
|
|---|
| 185 | /// Returns the MOIndexSpace object for the active unoccupied MOs
|
|---|
| 186 | Ref<MOIndexSpace> act_vir_space() const { return act_vir_space_; };
|
|---|
| 187 | /// Returns the MOIndexSpace object for all occupied MOs sorted by energy
|
|---|
| 188 | Ref<MOIndexSpace> occ_space() const { return occ_space_; };
|
|---|
| 189 | /// Returns the MOIndexSpace object for all occupied MOs symmetry-blocked
|
|---|
| 190 | Ref<MOIndexSpace> occ_space_symblk() const { return occ_space_symblk_; };
|
|---|
| 191 | /// Returns the MOIndexSpace object for all unoccupied MOs ordered by energy
|
|---|
| 192 | Ref<MOIndexSpace> vir_space() const { return vir_space_; };
|
|---|
| 193 | /// Returns the MOIndexSpace object for all unoccupied MOs ordered by symmetry
|
|---|
| 194 | Ref<MOIndexSpace> vir_space_symblk() const { return vir_space_symblk_; };
|
|---|
| 195 | /// Returns the MOIndexSpace object for ABS
|
|---|
| 196 | Ref<MOIndexSpace> abs_space() const { return abs_space_; };
|
|---|
| 197 | /// Returns the MOIndexSpace object for RI-BS
|
|---|
| 198 | Ref<MOIndexSpace> ribs_space() const { return ribs_space_; };
|
|---|
| 199 | /// Returns the MOIntsTransformFactory object
|
|---|
| 200 | Ref<MOIntsTransformFactory> tfactory() const { return tfactory_; };
|
|---|
| 201 |
|
|---|
| 202 | /// Compute subspace of space2 which is orthogonal complement to space1
|
|---|
| 203 | static Ref<MOIndexSpace> orthog_comp(const Ref<MOIndexSpace>& space1, const Ref<MOIndexSpace>& space2,
|
|---|
| 204 | const std::string& name, double lindep_tol);
|
|---|
| 205 | /** Compute span of bs and create corresponding mospace referred to by name. Number
|
|---|
| 206 | linear dependencies is returned in nlindep */
|
|---|
| 207 | static Ref<MOIndexSpace> orthogonalize(const std::string& name, const Ref<GaussianBasisSet>& bs, const Ref<Integral>& integral,
|
|---|
| 208 | OverlapOrthog::OrthogMethod orthog_method, double lindep_tol,
|
|---|
| 209 | int& nlindep);
|
|---|
| 210 |
|
|---|
| 211 | /** Project space1 on space2. This routine computes X2 such that C1.S12.X2 = I,
|
|---|
| 212 | where I is identity matrix and X2 spans subspace of space2. X2 is returned. */
|
|---|
| 213 | static Ref<MOIndexSpace> gen_project(const Ref<MOIndexSpace>& space1, const Ref<MOIndexSpace>& space2,
|
|---|
| 214 | const std::string& name, double lindep_tol);
|
|---|
| 215 |
|
|---|
| 216 | /// Compute overlap matrices in the basis of space1 and space2
|
|---|
| 217 | static void compute_overlap_ints(const Ref<MOIndexSpace>& space1,
|
|---|
| 218 | const Ref<MOIndexSpace>& space2,
|
|---|
| 219 | RefSCMatrix& S);
|
|---|
| 220 | /// Compute electric dipole and quadrupole moment matrices in the basis of space1 and space2
|
|---|
| 221 | static void compute_multipole_ints(const Ref<MOIndexSpace>& space1,
|
|---|
| 222 | const Ref<MOIndexSpace>& space2,
|
|---|
| 223 | RefSCMatrix& MX,
|
|---|
| 224 | RefSCMatrix& MY,
|
|---|
| 225 | RefSCMatrix& MZ,
|
|---|
| 226 | RefSCMatrix& MXX,
|
|---|
| 227 | RefSCMatrix& MYY,
|
|---|
| 228 | RefSCMatrix& MZZ);
|
|---|
| 229 |
|
|---|
| 230 | };
|
|---|
| 231 |
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | #endif
|
|---|
| 235 |
|
|---|
| 236 | // Local Variables:
|
|---|
| 237 | // mode: c++
|
|---|
| 238 | // c-file-style: "CLJ"
|
|---|
| 239 | // End:
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|