LIBINT  2.6.0
comp_11_r12kr12lg12_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_cr11r12kr12lg1211_h_
22 #define _libint2_src_bin_libint_cr11r12kr12lg1211_h_
23 
24 #include <generic_rr.h>
25 #include <integral_11_11.h>
26 #include <gaussoper.h>
27 
28 using namespace std;
29 
30 namespace libint2 {
31 
36  template <class BFSet>
38  public GenericRecurrenceRelation< CR_11_R12kR12lG12_11<BFSet>,
39  BFSet,
40  GenIntegralSet_11_11<BFSet,R12kR12lG12,EmptySet> >
41  {
42  public:
44  typedef BFSet BasisFunctionType;
48  static const unsigned int max_nchildren = 3;
49 
50  using ParentType::Instance;
51 
53  static bool directional() { return false; }
54 
55  private:
56  using ParentType::RecurrenceRelation::expr_;
57  using ParentType::RecurrenceRelation::nflops_;
58  using ParentType::target_;
59  using ParentType::is_simple;
60  template<class RR, class C> friend class ChildFactory;
61 
63  CR_11_R12kR12lG12_11(const SafePtr<TargetType>&, unsigned int dir);
64  static std::string descr() { return "CR"; }
65 
66  };
67 
68  template <class F>
69  CR_11_R12kR12lG12_11<F>::CR_11_R12kR12lG12_11(const SafePtr<TargetType>& Tint,
70  unsigned int dir) :
71  ParentType(Tint,dir)
72  {
73  using namespace libint2::algebra;
74  using namespace libint2::prefactor;
75  using namespace libint2::braket;
76 
77  //std::cout << "CR_11_R12kR12lG12_11<F> -- applying to "
78  // << Tint->label() << std::endl;
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  const IntVec3& r12pbra = Tint->oper()->descr().K();
86  const IntVec3& r12pket = Tint->oper()->descr().L();
87  const int norm = r12pbra.norm1() + r12pket.norm1();
88 
89  // Try reducing r12pbra
90  for(int xyz=0; xyz<3; ++xyz) {
91 
92  const IntVec3& _1 = unit_intvec3(xyz);
93  const IntVec3 r12pbra_m1 = r12pbra - _1;
94 
95  if (!ltzero(r12pbra_m1)) {
96  if (norm == 1) {
97  typedef GenIntegralSet_11_11<BasisFunctionType,R12kG12,mType> ChildType;
98  ChildFactory<ThisType,ChildType> factory(this);
99  factory.wedge( R12v(_pbra(a,c),xyz) , _pket(b,d), mType(0u), R12kG12(R12_k_G12_Descr(0)));
100  }
101  else {
102  typedef GenIntegralSet_11_11<BasisFunctionType,R12kR12lG12,EmptySet> ChildType;
103  ChildFactory<ThisType,ChildType> factory(this);
104  R12k_R12l_G12_Descr odescr(r12pbra_m1,r12pket);
105  factory.wedge( R12v(_pbra(a,c),xyz) , _pket(b,d), EmptySet(), R12kR12lG12(odescr));
106  }
107  return;
108  }
109  }
110 
111  // Try reducing r12pket
112  for(int xyz=0; xyz<3; ++xyz) {
113 
114  const IntVec3& _1 = unit_intvec3(xyz);
115  const IntVec3 r12pket_m1 = r12pket - _1;
116 
117  if (!ltzero(r12pket_m1)) {
118  if (norm == 1) {
119  typedef GenIntegralSet_11_11<BasisFunctionType,R12kG12,mType> ChildType;
120  ChildFactory<ThisType,ChildType> factory(this);
121  factory.wedge( _pbra(a,c) , R12v(_pket(b,d),xyz), mType(0u), R12kG12(R12_k_G12_Descr(0)));
122  }
123  else {
124  typedef GenIntegralSet_11_11<BasisFunctionType,R12kR12lG12,EmptySet> ChildType;
125  ChildFactory<ThisType,ChildType> factory(this);
126  R12k_R12l_G12_Descr odescr(r12pbra,r12pket_m1);
127  factory.wedge( _pbra(a,c) , R12v(_pket(b,d),xyz), EmptySet(), R12kR12lG12(odescr));
128  }
129  return;
130  }
131  }
132 
133  }
134 
135 };
136 
137 
138 #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
static bool directional()
This relation is not directional.
Definition: comp_11_r12kr12lg12_11.h:53
Compute relation for integrals of operator R12k_R12l_G12.
Definition: comp_11_r12kr12lg12_11.h:37
Generic integral over a two-body operator with one bfs for each particle in bra and ket.
Definition: integral_11_11.h:33
DefaultQuantumNumbers< unsigned int, 1 >::Result mType
mType is the type that describes the auxiliary index of standard 2-body repulsion integrals
Definition: quanta.h:411
RRImpl must inherit GenericRecurrenceRelation<RRImpl>
Definition: generic_rr.h:49
bool ltzero(const IntVec3 &a)
return true if has elements < 0
Definition: vectorn.h:91
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > R12v(const BraketPair< F, BKType > &bkt, unsigned int xyz)
Applies R12v to a physicists' braket.
Definition: gaussoper.h:198
these objects help to construct BraketPairs
Definition: braket.h:270
T norm1() const
1-norm
Definition: vectorn.h:48
Set of basis functions.
Definition: bfset.h:42
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