MPQC  3.0.0-alpha
g12nc.h
1 //
2 // g12nc.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 #include <libint2/boys.h>
41 #include <chemistry/qc/libint2/core_ints_engine.h>
42 
43 #ifndef _chemistry_qc_libint2_g12nc_h
44 #define _chemistry_qc_libint2_g12nc_h
45 
46 namespace sc {
47 
48 class Integral;
49 
63 class G12NCLibint2: public Int2eLibint2 {
64  private:
66  static const int num_te_types_ = TwoBodyIntDescrG12NC::num_intsets;
67 
68  typedef IntParamsG12::PrimitiveGeminal PrimitiveGeminal;
69  typedef IntParamsG12::ContractedGeminal ContractedGeminal;
70  // the geminal in the bra
71  ContractedGeminal geminal_bra_;
72  // the geminal in the ket (can be null)
73  ContractedGeminal geminal_ket_;
74 
75  // types of integrals that can be computed
76  enum OperType {coulomb, f12_coulomb, f12, f12_2, f12_T1_f12};
77 
78  // Storage for target integrals
79  double *target_ints_buffer_[num_te_types_];
80 
81  /*--- Intermediate scratch arrays (may be used in new[] and delete[]) ---*/
82  double *cart_ints_[num_te_types_]; // cartesian integrals, in by-contraction-quartet order
83  double *sphharm_ints_; // transformed integrals, in by-contraction-quartet order
84  double *perm_ints_; // redundant target integrals in shell quartet order, shells permuted
85 
86  /*--- Pointers to scratch arrays (never used in new[] and delete[]) ---*/
87  double *prim_ints_[num_te_types_]; // this points to the appropriate location for raw integrals
88  double *contr_quartets_[num_te_types_];
89  double *shell_quartet_[num_te_types_];
90 
91  /*--- Precomputed data ---*/
92  Ref<ShellPairsLibint2> shell_pairs12_;
93  Ref<ShellPairsLibint2> shell_pairs34_;
94 
95  /*--- Internally used "interfaces" ---*/
96  struct {
97  int p12, p34, p13p24; // flags indicating if functions were permuted
98  ShellPairLibint2 *shell_pair12, *shell_pair34; // Shell pairs corresponding to the original
99  // (before permutation) order of shell
100  int *op1, *op2, *op3, *op4; // pointers to the primitive indices in the original order
102  double A[3], B[3], C[3], D[3];
103  double AB2, CD2;
104  int gc1, gc2, gc3, gc4;
105  int p1, p2, p3, p4;
106  int am;
107  } quartet_info_;
108  typedef Libint_t prim_data;
109 
112  void g12nc_quartet_data_(prim_data *Data, double scale, OperType otype,
113  const ContractedGeminal* gbra,
114  const ContractedGeminal* gket);
115  /*--- Compute engines ---*/
116  std::vector<Libint_t> Libint_;
117  typedef ::libint2::FmEval_Chebyshev7<double> _FmEvalType;
119  Ref<FmEvalType> Fm_Eval_;
120  double* Fm_table_;
121 
122  class ExpensiveMath {
123  public:
124  ExpensiveMath();
125  double fac[4*LIBINT2_MAX_AM_eri+1];
126  double bc[4*LIBINT2_MAX_AM_eri+1][4*LIBINT2_MAX_AM_eri+1];
127  };
128  ExpensiveMath ExpMath_;
129 
130  public:
133  const Ref<GaussianBasisSet>&,
134  const Ref<GaussianBasisSet>&,
135  const Ref<GaussianBasisSet>&,
136  const Ref<GaussianBasisSet>&,
137  size_t storage,
138  const ContractedGeminal& gbra,
139  const ContractedGeminal& gket
140  );
141  ~G12NCLibint2();
142 
143  double *buffer(unsigned int t) const {
144  return target_ints_buffer_[t];
145  }
146 
147  static size_t storage_required(const Ref<GaussianBasisSet>& b1,
148  const Ref<GaussianBasisSet>& b2 = 0,
149  const Ref<GaussianBasisSet>& b3 = 0,
150  const Ref<GaussianBasisSet>& b4 = 0);
151 
152  // evaluate integrals
153  void compute_quartet(int*, int*, int*, int*);
154 };
155 
156 }
157 
158 #include <chemistry/qc/libint2/g12nc_quartet_data.h>
159 
160 #endif // header guard
161 
162 // Local Variables:
163 // mode: c++
164 // c-file-style: "CLJ"
165 // End:
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::G12NCLibint2::G12NCLibint2
G12NCLibint2(Integral *, const Ref< GaussianBasisSet > &, const Ref< GaussianBasisSet > &, const Ref< GaussianBasisSet > &, const Ref< GaussianBasisSet > &, size_t storage, const ContractedGeminal &gbra, const ContractedGeminal &gket)
When integrals with 1 geminal are needed, gket should be IntParamsG12::null_geminal.
sc::ShellPairLibint2
ShellPairLibint2 is an interface to PrimPairsLibint2.
Definition: shellpairs.h:40
sc::CoreIntsEngine::Engine
Definition: core_ints_engine.h:50
sc::Integral
The Integral abstract class acts as a factory to provide objects that compute one and two electron in...
Definition: integral.h:111
sc::G12NCLibint2::buffer
double * buffer(unsigned int t) const
Returns the location of the buffer with target integrals.
Definition: g12nc.h:143
sc::IntParamsG12::PrimitiveGeminal
std::pair< double, double > PrimitiveGeminal
std::pair< g, c > as in c * exp( - g*r12^2)
Definition: intparams.h:147
sc::G12NCLibint2::compute_quartet
void compute_quartet(int *, int *, int *, int *)
Evaluate the target quartet of integrals.
sc::G12NCLibint2
G12NCLibint2 is a specialization of Int2eLibint2 that computes two-electron integrals specific to exp...
Definition: g12nc.h:63
sc::Int2eLibint2
Int2eLibint2 is an interface to various specializations of two-electron integral evaluators implement...
Definition: int2e.h:46
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.