MPQC 2.3.1
r12int_eval.h
1//
2// r12int_eval.h
3//
4// Copyright (C) 2004 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_r12inteval_h
33#define _chemistry_qc_mbptr12_r12inteval_h
34
35#include <util/ref/ref.h>
36#include <chemistry/qc/mbptr12/vxb_eval_info.h>
37#include <chemistry/qc/mbptr12/linearr12.h>
38#include <chemistry/qc/mbptr12/r12_amps.h>
39
40namespace sc {
41
46class R12IntEval : virtual public SavableState {
47
48 bool evaluated_;
49
50 // Calculation information (number of basis functions, R12 approximation, etc.)
51 Ref<R12IntEvalInfo> r12info_;
52
53 // Note that intermediate B is symmetric but is stored as a full matrix to simplify the code
54 // that computes asymmetric form of B
55 RefSCMatrix Vaa_, Vab_, Xaa_, Xab_, Baa_, Bab_, Aaa_, Aab_, T2aa_, T2ab_;
56 RefSCMatrix Ac_aa_, Ac_ab_;
57 RefSCMatrix Raa_, Rab_; // Not sure if I'll compute and keep these explicitly later
58 Ref<R12Amplitudes> Amps_; // Amplitudes of various R12-contributed terms in pair functions
59 RefSCVector emp2pair_aa_, emp2pair_ab_;
60 RefSCDimension dim_ij_aa_, dim_ij_ab_, dim_ij_s_, dim_ij_t_;
61 RefSCDimension dim_ab_aa_, dim_ab_ab_;
62
63 bool gbc_;
64 bool ebc_;
65 LinearR12::ABSMethod abs_method_;
66 LinearR12::StandardApproximation stdapprox_;
67 bool spinadapted_;
68 bool include_mp1_;
70 bool follow_ks_ebcfree_;
71 int debug_;
72
73 // Map to TwoBodyMOIntsTransform objects that have been computed previously
74 typedef std::map<std::string, Ref<TwoBodyMOIntsTransform> > TformMap;
75 TformMap tform_map_;
76 // Returns pointer to the appropriate transform.
77 // If the transform is not found then throw runtime_error
78 Ref<TwoBodyMOIntsTransform> get_tform_(const std::string&);
79
81 Ref<MOIndexSpace> focc_space_;
83 void form_focc_space_();
85 Ref<MOIndexSpace> factocc_space_;
87 void form_factocc_space_();
89 Ref<MOIndexSpace> canonvir_space_;
91 void form_canonvir_space_();
92
94 void init_tforms_();
96 void init_intermeds_();
98 void r2_contrib_to_X_orig_();
100 void r2_contrib_to_X_new_();
102 RefSCMatrix compute_r2_(const Ref<MOIndexSpace>& space1, const Ref<MOIndexSpace>& space2);
105 RefSCMatrix fock_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
106 const Ref<MOIndexSpace>& ket_space, double scale_J = 1.0, double scale_K = 1.0);
108 RefSCMatrix coulomb_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
109 const Ref<MOIndexSpace>& ket_space);
111 RefSCMatrix exchange_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
112 const Ref<MOIndexSpace>& ket_space);
113
115 void checkpoint_() const;
116
121 const int tasks_with_ints_(const Ref<R12IntsAcc> ints_acc, vector<int>& map_to_twi);
122
128 void contrib_to_VXB_a_symm_(const std::string& tform_name);
129
135 void contrib_to_VXB_a_asymm_(const std::string& tform_name);
136
138 void obs_contrib_to_VXB_gebc_vbseqobs_();
139
141 void abs1_contrib_to_VXB_gebc_();
142
144 void contrib_to_VXB_gebc_vbsneqobs_();
145
147 void compute_A_simple_();
148
150 void compute_A_via_commutator_();
151
153 void compute_T2_();
154
156 void compute_R_();
157
159 void AT2_contrib_to_V_();
160
162 void AR_contrib_to_B_();
163
166 void compute_B_gbc_1_();
167
170 void compute_B_gbc_2_();
171
173 void compute_dualEmp2_();
174
176 void compute_dualEmp1_();
177
179 void compute_T2_vbsneqobs_();
180
183 void compute_R_vbsneqobs_(const Ref<TwoBodyMOIntsTransform>& ipjq_tform,
184 RefSCMatrix& Raa, RefSCMatrix& Rab);
185
187 void compute_amps_();
188
194 void globally_sum_scmatrix_(RefSCMatrix& A, bool to_all_tasks = false, bool to_average = false);
195
201 void globally_sum_scvector_(RefSCVector& A, bool to_all_tasks = false, bool to_average = false);
202
207 void globally_sum_intermeds_(bool to_all_tasks = false);
208
209public:
213 R12IntEval(const Ref<R12IntEvalInfo>& info, bool gbc = true, bool ebc = true,
214 LinearR12::ABSMethod abs_method = LinearR12::ABS_CABSPlus,
215 LinearR12::StandardApproximation stdapprox = LinearR12::StdApprox_Ap,
216 bool follow_ks_ebcfree = false);
217 ~R12IntEval();
218
220 virtual void obsolete();
221
222 void include_mp1(bool include_mp1);
223 void set_debug(int debug);
224 void set_dynamic(bool dynamic);
225 void set_print_percent(double print_percent);
226 void set_memory(size_t nbytes);
227
228 const bool gbc() const { return gbc_; }
229 const bool ebc() const { return ebc_; }
230 const LinearR12::StandardApproximation stdapprox() const { return stdapprox_; }
231 bool follow_ks_ebcfree() const { return follow_ks_ebcfree_; }
232
233 Ref<R12IntEvalInfo> r12info() const;
234 RefSCDimension dim_oo_aa() const;
235 RefSCDimension dim_oo_ab() const;
236 RefSCDimension dim_oo_s() const;
237 RefSCDimension dim_oo_t() const;
238 RefSCDimension dim_vv_aa() const;
239 RefSCDimension dim_vv_ab() const;
240
242 virtual void compute();
243
274
275 RefDiagSCMatrix evals() const;
276};
277
278}
279
280#endif
281
282// Local Variables:
283// mode: c++
284// c-file-style: "CLJ"
285// End:
286
287
R12IntEval is the top-level class which computes intermediates occuring in linear R12 theories.
Definition: r12int_eval.h:46
RefSCMatrix T2_ab()
Returns alpha-beta block of the MP2 T2 matrix. Returns 0 if EBC is assumed.
RefSCMatrix V_ab()
Returns alpha-beta block of the V intermediate matrix.
R12IntEval(const Ref< R12IntEvalInfo > &info, bool gbc=true, bool ebc=true, LinearR12::ABSMethod abs_method=LinearR12::ABS_CABSPlus, LinearR12::StandardApproximation stdapprox=LinearR12::StdApprox_Ap, bool follow_ks_ebcfree=false)
Constructs R12IntEval.
RefSCMatrix X_ab()
Returns alpha-beta block of the X intermediate matrix.
RefSCMatrix T2_aa()
Returns alpha-alpha block of the MP2 T2 matrix. Returns 0 if EBC is assumed.
RefSCMatrix X_aa()
Returns alpha-alpha block of the X intermediate matrix.
RefSymmSCMatrix B_aa()
Returns alpha-alpha block of the B intermediate matrix.
RefSCMatrix A_aa()
Returns alpha-alpha block of the A intermediate matrix. Returns 0 if EBC is assumed.
RefSCVector emp2_aa()
Returns alpha-alpha MP2 pair energies.
RefSCMatrix A_ab()
Returns alpha-beta block of the A intermediate matrix. Returns 0 if EBC is assumed.
RefSCVector emp2_ab()
Returns alpha-beta MP2 pair energies.
RefSCMatrix Ac_aa()
Returns alpha-alpha block of the A intermediate matrix. Returns 0 if EBC is assumed.
Ref< R12Amplitudes > amps()
Returns amplitudes of pair correlation functions.
RefSymmSCMatrix B_ab()
Returns alpha-beta block of the B intermediate matrix.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
RefSCMatrix V_aa()
Returns alpha-alpha block of the V intermediate matrix.
RefSCMatrix Ac_ab()
Returns alpha-beta block of the A intermediate matrix. Returns 0 if EBC is assumed.
virtual void compute()
This function causes the intermediate matrices to be computed.
The RefDiagSCMatrix class is a smart pointer to an DiagSCMatrix specialization.
Definition: matrix.h:380
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition: dim.h:156
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition: matrix.h:135
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition: matrix.h:55
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition: matrix.h:261
A template class that maintains references counts.
Definition: ref.h:332
Base class for objects that can save/restore state.
Definition: state.h:46
Restores objects that derive from SavableState.
Definition: statein.h:70
Serializes objects that derive from SavableState.
Definition: stateout.h:61

Generated at Thu Jan 20 2022 00:00:00 for MPQC 2.3.1 using the documentation package Doxygen 1.9.4.