| 1 | //
 | 
|---|
| 2 | // mbptr12.h
 | 
|---|
| 3 | //
 | 
|---|
| 4 | // Copyright (C) 2001 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 | #ifndef _chemistry_qc_mbptr12_mbptr12_h
 | 
|---|
| 29 | #define _chemistry_qc_mbptr12_mbptr12_h
 | 
|---|
| 30 | 
 | 
|---|
| 31 | #ifdef __GNUC__
 | 
|---|
| 32 | #pragma interface
 | 
|---|
| 33 | #endif
 | 
|---|
| 34 | 
 | 
|---|
| 35 | #include <string>
 | 
|---|
| 36 | #include <util/misc/compute.h>
 | 
|---|
| 37 | #include <util/group/memory.h>
 | 
|---|
| 38 | #include <util/group/message.h>
 | 
|---|
| 39 | #include <util/group/thread.h>
 | 
|---|
| 40 | #include <chemistry/qc/basis/obint.h>
 | 
|---|
| 41 | #include <chemistry/qc/basis/tbint.h>
 | 
|---|
| 42 | #include <chemistry/qc/scf/scf.h>
 | 
|---|
| 43 | #include <chemistry/qc/mbpt/mbpt.h>
 | 
|---|
| 44 | #include <chemistry/qc/mbptr12/linearr12.h>
 | 
|---|
| 45 | //#include <chemistry/qc/mbptr12/vxb_eval.h>
 | 
|---|
| 46 | #include <chemistry/qc/mbptr12/r12int_eval.h>
 | 
|---|
| 47 | #include <chemistry/qc/mbptr12/vxb_eval_info.h>
 | 
|---|
| 48 | #include <chemistry/qc/mbptr12/mp2r12_energy.h>
 | 
|---|
| 49 | #include <chemistry/qc/mbptr12/twobodygrid.h>
 | 
|---|
| 50 | 
 | 
|---|
| 51 | namespace sc {
 | 
|---|
| 52 | 
 | 
|---|
| 53 | // //////////////////////////////////////////////////////////////////////////
 | 
|---|
| 54 | 
 | 
|---|
| 55 | class R12IntEval;
 | 
|---|
| 56 | class R12IntEvalInfo;
 | 
|---|
| 57 | class MP2R12Energy;
 | 
|---|
| 58 |   
 | 
|---|
| 59 | /** The MBPT2_R12 class implements several linear R12 second-order perturbation theory
 | 
|---|
| 60 | methods. */
 | 
|---|
| 61 | class MBPT2_R12: public MBPT2 {
 | 
|---|
| 62 | 
 | 
|---|
| 63 |     Ref<R12IntEval> r12eval_;           // the R12 intermediates evaluator
 | 
|---|
| 64 | 
 | 
|---|
| 65 |     /** These are MP2-R12 energy objects for each MP2-R12 method, since several different energies
 | 
|---|
| 66 |         can be evaluated with the same set of intermediates */
 | 
|---|
| 67 |     Ref<MP2R12Energy> r12a_energy_;
 | 
|---|
| 68 |     Ref<MP2R12Energy> r12ap_energy_;
 | 
|---|
| 69 |     Ref<MP2R12Energy> r12b_energy_;
 | 
|---|
| 70 | 
 | 
|---|
| 71 |     Ref<GaussianBasisSet> aux_basis_;   // This is the auxiliary basis set (ABS)
 | 
|---|
| 72 |     Ref<GaussianBasisSet> vir_basis_;   // This is the virtuals basis set (VBS)
 | 
|---|
| 73 |     Ref<SCVector> epair_0_, epair_1_;   // Singlet/triplet pair energies if spin-adapted
 | 
|---|
| 74 |                                         // Alpha-beta/alpha-alpha pair energies if spin-orbital
 | 
|---|
| 75 | 
 | 
|---|
| 76 |     Ref<TwoBodyGrid> twopdm_grid_aa_;     // The set of 2 particle positions on which to compute values of alpha-alpha 2-PDM
 | 
|---|
| 77 |     Ref<TwoBodyGrid> twopdm_grid_ab_;     // The set of 2 particle positions on which to compute values of alpha-beta 2-PDM
 | 
|---|
| 78 | 
 | 
|---|
| 79 | #define ref_to_mp2r12_acc_ 100.0
 | 
|---|
| 80 | 
 | 
|---|
| 81 |     double mp2_corr_energy_;
 | 
|---|
| 82 |     double r12_corr_energy_;
 | 
|---|
| 83 |     LinearR12::StandardApproximation stdapprox_;
 | 
|---|
| 84 |     LinearR12::ABSMethod abs_method_;
 | 
|---|
| 85 |     R12IntEvalInfo::StoreMethod r12ints_method_;
 | 
|---|
| 86 |     std::string r12ints_file_;
 | 
|---|
| 87 |     bool gbc_;
 | 
|---|
| 88 |     bool ebc_;
 | 
|---|
| 89 |     bool spinadapted_;
 | 
|---|
| 90 |     bool include_mp1_;
 | 
|---|
| 91 | 
 | 
|---|
| 92 |     void init_variables_();
 | 
|---|
| 93 | 
 | 
|---|
| 94 |     // This checks if the integral factory is suitable for R12 calculations
 | 
|---|
| 95 |     void check_integral_factory_();
 | 
|---|
| 96 | 
 | 
|---|
| 97 |     // calculate the MP2-R12 energy in std approximations A and A'
 | 
|---|
| 98 |     void compute_energy_a_();
 | 
|---|
| 99 | 
 | 
|---|
| 100 |   protected:
 | 
|---|
| 101 |     // implement the Compute::compute() function,
 | 
|---|
| 102 |     // overrides MBPT2::compute()
 | 
|---|
| 103 |     void compute();
 | 
|---|
| 104 | 
 | 
|---|
| 105 |   public:
 | 
|---|
| 106 |     MBPT2_R12(StateIn&);
 | 
|---|
| 107 |     /** The KeyVal constructor.
 | 
|---|
| 108 |         <dl>
 | 
|---|
| 109 | 
 | 
|---|
| 110 |         <dt><tt>gbc</tt><dd> This boolean specifies whether Generalized Brillouin
 | 
|---|
| 111 |         Condition (GBC) is assumed to hold. The default is "true". This keyword is
 | 
|---|
| 112 |         only valid if stdapprox=A'.
 | 
|---|
| 113 |         The effect of setting this keyword to true is rather small --
 | 
|---|
| 114 |         hence it is not recommended to use this keyword.
 | 
|---|
| 115 | 
 | 
|---|
| 116 |         <dt><tt>ebc</tt><dd> This boolean specifies whether Extended Brillouin
 | 
|---|
| 117 |         Condition (EBC) is assumed to hold. The default is "true". This keyword
 | 
|---|
| 118 |         is only valid if stdapprox=A'.
 | 
|---|
| 119 |         The effect of setting this keyword to true is rather small --
 | 
|---|
| 120 |         hence it is not recommended to use this keyword.
 | 
|---|
| 121 |       
 | 
|---|
| 122 |         <dt><tt>stdapprox</tt><dd> This gives a string that must take on one
 | 
|---|
| 123 |         of the values below.  The default is A'.
 | 
|---|
| 124 | 
 | 
|---|
| 125 |         <dl>
 | 
|---|
| 126 | 
 | 
|---|
| 127 |           <dt><tt>A</tt><dd> Use second order Møller-Plesset perturbation theory
 | 
|---|
| 128 |           with linear R12 terms in standard approximation A (MP2-R12/A).
 | 
|---|
| 129 |           Only energies can be computed with the MP2-R12/A method.
 | 
|---|
| 130 | 
 | 
|---|
| 131 |           <dt><tt>A'</tt><dd> Use second order Møller-Plesset perturbation theory
 | 
|---|
| 132 |           with linear R12 terms in standard approximation A' (MP2-R12/A').
 | 
|---|
| 133 |           This will cause MP2-R12/A energies to be computed also.
 | 
|---|
| 134 |           Only energies can be computed with the MP2-R12/A' method.
 | 
|---|
| 135 | 
 | 
|---|
| 136 |           <dt><tt>B</tt><dd> Use second order Møller-Plesset perturbation theory
 | 
|---|
| 137 |           with linear R12 terms in standard approximation B. 
 | 
|---|
| 138 |           This method is not implemented yet.
 | 
|---|
| 139 | 
 | 
|---|
| 140 |         </dl>
 | 
|---|
| 141 |         
 | 
|---|
| 142 | 
 | 
|---|
| 143 |         <dt><tt>spinadapted</tt><dd> This boolean specifies whether to compute spin-adapted
 | 
|---|
| 144 |         or spin-orbital pair energies. Default is to compute spin-adapted energies.
 | 
|---|
| 145 | 
 | 
|---|
| 146 |         <dt><tt>aux_basis</tt><dd> This specifies the auxiliary basis to be used for the resolution
 | 
|---|
| 147 |         of the identity. Default is to use the same basis as for the orbital expansion.
 | 
|---|
| 148 | 
 | 
|---|
| 149 |         <dt><tt>vir_basis</tt><dd> This specifies the basis to be used for the virtual orbitals.
 | 
|---|
| 150 |         Default is to use the same basis as for the orbital expansion.
 | 
|---|
| 151 | 
 | 
|---|
| 152 |         <dt><tt>include_mp1</tt><dd> This specifies whether to compute MP1 correction to
 | 
|---|
| 153 |         the MP2 and MP2-R12 energies. This option only has effect if vir_basis is not the same as basis.
 | 
|---|
| 154 |         MP1 correction is a perturbative estimate of the difference between the HF energy computed
 | 
|---|
| 155 |         in vir_basis and basis. Usually, it is a very poor estimate -- therefore this keyword should
 | 
|---|
| 156 |         be avoided by non-experts. Default is false.
 | 
|---|
| 157 | 
 | 
|---|
| 158 |         <dt><tt>abs_method</tt><dd> This string specifies whether the old ABS method, introduced
 | 
|---|
| 159 |         by Klopper and Samson, or the new ABS variant, CABS, introduced by Valeev, should be used.
 | 
|---|
| 160 |         Valid values are "ABS" (Klopper and Samson), "ABS+", "CABS", and "CABS+", where the "+" labels
 | 
|---|
| 161 |         a method where the union of OBS and ABS is used to construct the RI basis. The default is "ABS".
 | 
|---|
| 162 |         The default in 2.3.0 and later will be "CABS+".
 | 
|---|
| 163 | 
 | 
|---|
| 164 |         <dt><tt>lindep_tol</tt><dd> The tolerance used to detect linearly
 | 
|---|
| 165 |         dependent basis functions in the RI basis set.
 | 
|---|
| 166 |         The precise meaning depends on the
 | 
|---|
| 167 |         orthogonalization method.  The default value is 1e-8.
 | 
|---|
| 168 | 
 | 
|---|
| 169 |         <dt><tt>r12ints</tt><dd> This specifies how to store transformed MO integrals.
 | 
|---|
| 170 |         Valid values are:
 | 
|---|
| 171 | 
 | 
|---|
| 172 |         <dl>
 | 
|---|
| 173 | 
 | 
|---|
| 174 |           <dt><tt>mem-posix</tt><dd> Store integrals in memory for single-pass situations
 | 
|---|
| 175 |           and in a binary file on task 0's node using POSIX I/O for multipass situations.
 | 
|---|
| 176 |           <tt>posix</tt> is usually less efficient than <tt>mpi</tt> for distributed
 | 
|---|
| 177 |           parallel multipass runs since the I/O is performed by one task only. However, this method is guaranteed to
 | 
|---|
| 178 |           work in all types of environments, hence <tt>mem-posix</tt> is the default.
 | 
|---|
| 179 | 
 | 
|---|
| 180 |           <dt><tt>posix</tt><dd> Store integrals in a binary file on task 0's node using POSIX I/O.
 | 
|---|
| 181 |           This method is different from <tt>mem-posix</tt> in that it forces the integrals out to disk
 | 
|---|
| 182 |           even if they could be stored in memory. <tt>posix</tt> should only be used for benchmarking
 | 
|---|
| 183 |           and testing purposes.
 | 
|---|
| 184 | 
 | 
|---|
| 185 |           <dt><tt>mem-mpi</tt><dd> Store integrals in memory for single-pass situations
 | 
|---|
| 186 |           and in a binary file using MPI-I/O for multipass situations. This method
 | 
|---|
| 187 |           assumes the availability of MPI-I/O. <tt>mem-mpi</tt> is the preferred choice
 | 
|---|
| 188 |           in distributed environments which have MPI-I/O available.
 | 
|---|
| 189 | 
 | 
|---|
| 190 |           <dt><tt>mpi</tt><dd> Store integrals in a binary file using MPI-I/O. This method
 | 
|---|
| 191 |           is different from <tt>mem-mpi</tt> in that it forces the integrals out to disk
 | 
|---|
| 192 |           even if they could be stored in memory. <tt>mpi</tt> should only be used for benchmarking
 | 
|---|
| 193 |           and testing purposes.
 | 
|---|
| 194 | 
 | 
|---|
| 195 |           <dt><tt>mem</tt><dd> Store integrals in memory. Can only be used with single-pass
 | 
|---|
| 196 |           transformations for MP2-R12/A and MP2-R12/A' methods.
 | 
|---|
| 197 |           This method should only be used for testing purposes.
 | 
|---|
| 198 | 
 | 
|---|
| 199 |         </dl>
 | 
|---|
| 200 | 
 | 
|---|
| 201 |         If <tt>r12ints</tt> is not specified, then <tt>mem-posix</tt> method will be used.
 | 
|---|
| 202 |         If user wishes to use MPI-I/O, pending its availability, for higher parallel efficiency,
 | 
|---|
| 203 |         <tt>r12ints</tt> should be explicitly set to <tt>mem-mpi</tt>.
 | 
|---|
| 204 | 
 | 
|---|
| 205 |         <dt><tt>r12ints_file</tt><dd> This specifies the prefix for the transformed
 | 
|---|
| 206 |         MO integrals file if <tt>r12ints</tt> is set to <tt>posix</tt>, <tt>mpi</tt>, <tt>mem-posix</tt>
 | 
|---|
| 207 |         or <tt>mem-mpi</tt> is used.
 | 
|---|
| 208 |         Default is "./<i>inputbasename</i>.r12ints", where <i>inputbasename</i> is the name of the input
 | 
|---|
| 209 |         file without ".in". If MPI-I/O is used then it is user's responsibility to ensure
 | 
|---|
| 210 |         that the file resides on a file system that supports MPI-I/O.
 | 
|---|
| 211 | 
 | 
|---|
| 212 |         <dt><tt>twopdm_grid_aa</tt><dd> This optional keyword specifies a TwoBodyGrid object which to
 | 
|---|
| 213 |         use for coordinates at which to compute alpha-alpha part of 2-PDM.
 | 
|---|
| 214 | 
 | 
|---|
| 215 |         <dt><tt>twopdm_grid_ab</tt><dd> This optional keyword specifies a TwoBodyGrid object which to
 | 
|---|
| 216 |         use for coordinates at which to compute alpha-beta part of 2-PDM.
 | 
|---|
| 217 | 
 | 
|---|
| 218 |         </dl> */
 | 
|---|
| 219 |     MBPT2_R12(const Ref<KeyVal>&);
 | 
|---|
| 220 |     ~MBPT2_R12();
 | 
|---|
| 221 | 
 | 
|---|
| 222 |     void save_data_state(StateOut&);
 | 
|---|
| 223 | 
 | 
|---|
| 224 |     Ref<GaussianBasisSet> aux_basis() const;
 | 
|---|
| 225 |     Ref<GaussianBasisSet> vir_basis() const;
 | 
|---|
| 226 |     bool gbc() const;
 | 
|---|
| 227 |     bool ebc() const;
 | 
|---|
| 228 |     LinearR12::ABSMethod abs_method() const;
 | 
|---|
| 229 |     LinearR12::StandardApproximation stdapprox() const;
 | 
|---|
| 230 |     bool spinadapted() const;
 | 
|---|
| 231 |     R12IntEvalInfo::StoreMethod r12ints_method() const;
 | 
|---|
| 232 |     const std::string& r12ints_file() const;
 | 
|---|
| 233 | 
 | 
|---|
| 234 |     double corr_energy();
 | 
|---|
| 235 |     double r12_corr_energy();
 | 
|---|
| 236 | 
 | 
|---|
| 237 |     RefSymmSCMatrix density();
 | 
|---|
| 238 | 
 | 
|---|
| 239 |     void obsolete();
 | 
|---|
| 240 |     int gradient_implemented() const;
 | 
|---|
| 241 |     int value_implemented() const;
 | 
|---|
| 242 | 
 | 
|---|
| 243 |     void print(std::ostream&o=ExEnv::out0()) const;
 | 
|---|
| 244 | };
 | 
|---|
| 245 | 
 | 
|---|
| 246 | }
 | 
|---|
| 247 | 
 | 
|---|
| 248 | #endif
 | 
|---|
| 249 | 
 | 
|---|
| 250 | // Local Variables:
 | 
|---|
| 251 | // mode: c++
 | 
|---|
| 252 | // c-file-style: "CLJ"
 | 
|---|
| 253 | // End:
 | 
|---|