MPQC  3.0.0-alpha
g12.h
1 //
2 // g12.h
3 //
4 // Copyright (C) 2001 Edward Valeev
5 //
6 // Author: Edward Valeev <evaleev@vt.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 #include <limits.h>
29 #include <stdexcept>
30 
31 #include <util/ref/ref.h>
32 #include <util/misc/scexception.h>
33 #include <chemistry/qc/basis/basis.h>
34 #include <chemistry/qc/basis/intparams.h>
35 #include <chemistry/qc/basis/intdescr.h>
36 #include <chemistry/qc/libint2/shellpairs.h>
37 #include <chemistry/qc/basis/fjt.h>
38 #include <chemistry/qc/libint2/int2e.h>
39 #include <libint2.h>
40 
41 #if LIBINT2_SUPPORT_G12
42 #ifndef _chemistry_qc_libint2_g12_h
43 #define _chemistry_qc_libint2_g12_h
44 
45 namespace sc {
46 
47 class Integral;
48 
61 class G12Libint2: public Int2eLibint2 {
62  private:
64  static const int num_te_types_ = TwoBodyIntDescrG12::num_intsets;
65 
66  typedef IntParamsG12::PrimitiveGeminal PrimitiveGeminal;
67  typedef IntParamsG12::ContractedGeminal ContractedGeminal;
68  // the geminal in the bra
69  ContractedGeminal geminal_bra_;
70  // the geminal in the ket (can be null)
71  ContractedGeminal geminal_ket_;
72 
73  // Storage for target integrals
74  double *target_ints_buffer_[num_te_types_];
75 
76  /*--- Intermediate scratch arrays (may be used in new[] and delete[]) ---*/
77  double *cart_ints_[num_te_types_]; // cartesian integrals, in by-contraction-quartet order
78  double *sphharm_ints_; // transformed integrals, in by-contraction-quartet order
79  double *perm_ints_; // redundant target integrals in shell quartet order, shells permuted
80 
81  /*--- Pointers to scratch arrays (never used in new[] and delete[]) ---*/
82  double *prim_ints_[num_te_types_]; // this points to the appropriate location for raw integrals
83  double *contr_quartets_[num_te_types_];
84  double *shell_quartet_[num_te_types_];
85 
86  /*--- Precomputed data ---*/
87  Ref<ShellPairsLibint2> shell_pairs12_;
88  Ref<ShellPairsLibint2> shell_pairs34_;
89 
90  /*--- Internally used "interfaces" ---*/
91  struct {
92  int p12, p34, p13p24; // flags indicating if functions were permuted
93  ShellPairLibint2 *shell_pair12, *shell_pair34; // Shell pairs corresponding to the original
94  // (before permutation) order of shell
95  int *op1, *op2, *op3, *op4; // pointers to the primitive indices in the original order
97  double A[3], B[3], C[3], D[3];
98  double AB2, CD2;
99  int gc1, gc2, gc3, gc4;
100  int p1, p2, p3, p4;
101  int am;
102  } quartet_info_;
103  typedef Libint_t prim_data;
104  void g12_quartet_data_(prim_data *Data, double scale, double gamma,
105  double g2_4,
106  bool eri_only = false);
107  /*--- Compute engines ---*/
108  Libint_t Libint_;
109  Ref<Fjt> Fm_Eval_;
110 
111  class ExpensiveMath {
112  public:
113  ExpensiveMath();
114  double fac[4*LIBINT2_MAX_AM_R12kG12+1];
115  double bc[4*LIBINT2_MAX_AM_R12kG12+1][4*LIBINT2_MAX_AM_R12kG12+1];
116  };
117  ExpensiveMath ExpMath_;
118 
119  public:
121  G12Libint2(Integral *,
122  const Ref<GaussianBasisSet>&,
123  const Ref<GaussianBasisSet>&,
124  const Ref<GaussianBasisSet>&,
125  const Ref<GaussianBasisSet>&,
126  size_t storage,
127  const ContractedGeminal& gbra,
128  const ContractedGeminal& gket
129  );
130  ~G12Libint2();
131 
132  double *buffer(unsigned int t) const {
133  return target_ints_buffer_[t];
134  }
135 
136  static size_t storage_required(const Ref<GaussianBasisSet>& b1,
137  const Ref<GaussianBasisSet>& b2 = 0,
138  const Ref<GaussianBasisSet>& b3 = 0,
139  const Ref<GaussianBasisSet>& b4 = 0);
140 
141  // evaluate integrals
142  void compute_quartet(int*, int*, int*, int*);
143 };
144 
145 }
146 
147 #include <chemistry/qc/libint2/g12_quartet_data.h>
148 
149 #endif // header guard
150 #endif // if LIBINT2_SUPPORT_G12
151 
152 // Local Variables:
153 // mode: c++
154 // c-file-style: "CLJ"
155 // End:
sc::IntParamsG12::PrimitiveGeminal
std::pair< double, double > PrimitiveGeminal
std::pair< g, c > as in c * exp( - g*r12^2)
Definition: intparams.h:147
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:23:58 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.