LIBINT  2.6.0
comp_11_tig12_11.h
1 /*
2  * Copyright (C) 2004-2019 Edward F. Valeev
3  *
4  * This file is part of Libint.
5  *
6  * Libint is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Libint is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Libint. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef _libint2_src_bin_libint_cr11tig1211_h_
22 #define _libint2_src_bin_libint_cr11tig1211_h_
23 
24 #include <generic_rr.h>
25 #include <tig12_11_11.h>
26 #include <gaussoper.h>
27 
28 using namespace std;
29 
30 namespace libint2 {
31 
34  template <class BFSet>
35  class CR_11_TiG12_11 : public GenericRecurrenceRelation< CR_11_TiG12_11<BFSet>,
36  BFSet,
37  GenIntegralSet_11_11<BFSet,TiG12,mType> >
38  {
39  public:
40  typedef CR_11_TiG12_11 ThisType;
41  typedef BFSet BasisFunctionType;
45  static const unsigned int max_nchildren = 8;
46 
47  using ParentType::Instance;
48 
50  static bool directional() { return false; }
51 
52  private:
53  using ParentType::RecurrenceRelation::expr_;
54  using ParentType::RecurrenceRelation::nflops_;
55  using ParentType::target_;
56  using ParentType::is_simple;
57  template<class RR, class C> friend class ChildFactory;
58 
60  CR_11_TiG12_11(const SafePtr<TargetType>&, unsigned int dir);
61  static std::string descr() { return "CR"; }
62 
63  };
64 
65  template <class F>
66  CR_11_TiG12_11<F>::CR_11_TiG12_11(const SafePtr<TargetType>& Tint,
67  unsigned int dir) :
68  ParentType(Tint,dir)
69  {
70  if (dir != 0)
71  return;
72  using namespace libint2::algebra;
73  using namespace libint2::prefactor;
74  using namespace libint2::braket;
75  // kinetic energy of which electron?
76  const int i = target_->oper()->descr().K();
77  const R12kG12 G0(R12_k_G12_Descr(0));
78  const R12kG12 G2(R12_k_G12_Descr(2));
79 
80  F a(Tint->bra(0,0));
81  F b(Tint->ket(0,0));
82  F c(Tint->bra(1,0));
83  F d(Tint->ket(1,0));
84 
85  if (i == 0) {
86  if (b.contracted() || target_->oper()->descr().contracted())
87  return;
88  }
89  if (i == 1) {
90  if (d.contracted() || target_->oper()->descr().contracted())
91  return;
92  }
93 
94  // [T1,G12]
95  if (i == 0) {
96  typedef GenIntegralSet_11_11<BasisFunctionType,R12kR12lG12,EmptySet> ChildType;
97  ChildFactory<ThisType,ChildType> factory(this);
98  for(int xyz=0; xyz<3; ++xyz) {
99  R12k_R12l_G12_Descr descr(IntVec3(),unit_intvec3(xyz));
100  factory.wedge(_pbra(a,c) , Nabla1(_pket(b,d),xyz), EmptySet(), R12kR12lG12(descr));
101  }
102  if (is_simple()) expr_ *= Scalar(2.0) * Scalar("gamma");
103  }
104  // [T2,G12]
105  if (i == 1) {
106  typedef GenIntegralSet_11_11<BasisFunctionType,R12kR12lG12,EmptySet> ChildType;
107  ChildFactory<ThisType,ChildType> factory(this);
108  for(int xyz=0; xyz<3; ++xyz) {
109  R12k_R12l_G12_Descr descr(IntVec3(),unit_intvec3(xyz));
110  factory.wedge(_pbra(a,c) , Nabla2(_pket(b,d),xyz), EmptySet(), R12kR12lG12(descr));
111  }
112  if (is_simple()) expr_ *= Scalar(-2.0) * Scalar("gamma");
113  }
114 
115  {
116  typedef GenIntegralSet_11_11<BasisFunctionType,R12kG12,mType> ChildType;
117  ChildFactory<ThisType,ChildType> factory(this);
118  auto ab_G0_cd = factory.make_child(a,b,c,d,0u,G0);
119  if (is_simple())
120  expr_ += Scalar(3.0) * Scalar("gamma") * ab_G0_cd;
121 
122  auto ab_G2_cd = factory.make_child(a,b,c,d,0u,G2);
123  if (is_simple())
124  expr_ += Scalar(-2.0) * Scalar("gamma") * Scalar("gamma") * ab_G2_cd;
125  }
126 
127  }
128 
129 };
130 
131 #endif
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24
BraketPair< F, PKet > _pket(const F &f1, const F &f2)
Physicists ket.
Definition: braket.h:276
bool is_simple() const
Implementation of RecurrenceRelation::is_simple()
Definition: generic_rr.h:81
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > Nabla1(const BraketPair< F, BKType > &bkt, int xyz)
Applies Nabla1 to a physicists' braket.
Definition: gaussoper.h:132
Generic integral over a two-body operator with one bfs for each particle in bra and ket.
Definition: integral_11_11.h:33
Compute relation for 2-e integrals of the Ti_G12 operators.
Definition: comp_11_tig12_11.h:35
RRImpl must inherit GenericRecurrenceRelation<RRImpl>
Definition: generic_rr.h:49
these objects help to construct BraketPairs
Definition: braket.h:270
Set of basis functions.
Definition: bfset.h:42
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > Nabla2(const BraketPair< F, BKType > &bkt, int xyz)
Applies Nabla2 to a physicists' braket.
Definition: gaussoper.h:165
static bool directional()
This relation is not directional.
Definition: comp_11_tig12_11.h:50
BraketPair< F, PBra > _pbra(const F &f1, const F &f2)
Physicists bra.
Definition: braket.h:272
Helps GenericRecurrenceRelation to work around the compiler problem with make_child.
Definition: generic_rr.h:149
DefaultQuantumNumbers< int, 0 >::Result EmptySet
EmptySet is the type that describes null set of auxiliary indices.
Definition: quanta.h:407