LIBINT  2.1.0-stable
comp_11_r12kr12lg12_11.h
1 /*
2  * This file is a part of Libint.
3  * Copyright (C) 2004-2014 Edward F. Valeev
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see http://www.gnu.org/licenses/.
17  *
18  */
19 
20 #ifndef _libint2_src_bin_libint_cr11r12kr12lg1211_h_
21 #define _libint2_src_bin_libint_cr11r12kr12lg1211_h_
22 
23 #include <generic_rr.h>
24 #include <integral_11_11.h>
25 #include <gaussoper.h>
26 
27 using namespace std;
28 
29 namespace libint2 {
30 
35  template <class BFSet>
37  public GenericRecurrenceRelation< CR_11_R12kR12lG12_11<BFSet>,
38  BFSet,
39  GenIntegralSet_11_11<BFSet,R12kR12lG12,EmptySet> >
40  {
41  public:
43  typedef BFSet BasisFunctionType;
46  friend class GenericRecurrenceRelation<ThisType,BFSet,TargetType>;
47  static const unsigned int max_nchildren = 3;
48 
49  using ParentType::Instance;
50 
52  static bool directional() { return false; }
53 
54  private:
55  using ParentType::RecurrenceRelation::expr_;
56  using ParentType::RecurrenceRelation::nflops_;
57  using ParentType::target_;
58  using ParentType::is_simple;
59  template<class RR, class C> friend class ChildFactory;
60 
62  CR_11_R12kR12lG12_11(const SafePtr<TargetType>&, unsigned int dir);
63  static std::string descr() { return "CR"; }
64 
65  };
66 
67  template <class F>
68  CR_11_R12kR12lG12_11<F>::CR_11_R12kR12lG12_11(const SafePtr<TargetType>& Tint,
69  unsigned int dir) :
70  ParentType(Tint,dir)
71  {
72  using namespace libint2::algebra;
73  using namespace libint2::prefactor;
74  using namespace libint2::braket;
75 
76  //std::cout << "CR_11_R12kR12lG12_11<F> -- applying to "
77  // << Tint->label() << std::endl;
78 
79  F a(Tint->bra(0,0));
80  F b(Tint->ket(0,0));
81  F c(Tint->bra(1,0));
82  F d(Tint->ket(1,0));
83 
84  const IntVec3& r12pbra = Tint->oper()->descr().K();
85  const IntVec3& r12pket = Tint->oper()->descr().L();
86  const int norm = r12pbra.norm1() + r12pket.norm1();
87 
88  // Try reducing r12pbra
89  for(int xyz=0; xyz<3; ++xyz) {
90 
91  const IntVec3& _1 = unit_intvec3(xyz);
92  const IntVec3 r12pbra_m1 = r12pbra - _1;
93 
94  if (!ltzero(r12pbra_m1)) {
95  if (norm == 1) {
98  factory.wedge( R12v(_pbra(a,c),xyz) , _pket(b,d), mType(0u), R12kG12(R12_k_G12_Descr(0)));
99  }
100  else {
102  ChildFactory<ThisType,ChildType> factory(this);
103  R12k_R12l_G12_Descr odescr(r12pbra_m1,r12pket);
104  factory.wedge( R12v(_pbra(a,c),xyz) , _pket(b,d), EmptySet(), R12kR12lG12(odescr));
105  }
106  return;
107  }
108  }
109 
110  // Try reducing r12pket
111  for(int xyz=0; xyz<3; ++xyz) {
112 
113  const IntVec3& _1 = unit_intvec3(xyz);
114  const IntVec3 r12pket_m1 = r12pket - _1;
115 
116  if (!ltzero(r12pket_m1)) {
117  if (norm == 1) {
119  ChildFactory<ThisType,ChildType> factory(this);
120  factory.wedge( _pbra(a,c) , R12v(_pket(b,d),xyz), mType(0u), R12kG12(R12_k_G12_Descr(0)));
121  }
122  else {
124  ChildFactory<ThisType,ChildType> factory(this);
125  R12k_R12l_G12_Descr odescr(r12pbra,r12pket_m1);
126  factory.wedge( _pbra(a,c) , R12v(_pket(b,d),xyz), EmptySet(), R12kR12lG12(odescr));
127  }
128  return;
129  }
130  }
131 
132  }
133 
134 };
135 
136 
137 #endif
R12_k_G12 is a two-body operator of form r_{12}^k * exp(- * r_{12}), where k is an integer and is a ...
Definition: oper.h:298
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:23
BraketPair< F, PKet > _pket(const F &f1, const F &f2)
Physicists ket.
Definition: braket.h:448
static bool directional()
This relation is not directional.
Definition: comp_11_r12kr12lg12_11.h:52
Definition: stdarray.h:18
Definition: prefactors.h:159
Compute relation for integrals of operator R12k_R12l_G12.
Definition: comp_11_r12kr12lg12_11.h:36
GenOper is a single operator described by descriptor Descr.
Definition: oper.h:152
Generic integral over a two-body operator with one bfs for each particle in bra and ket...
Definition: integral_11_11.h:32
void wedge(const LinearCombination< SafePtr< DGVertex >, BraketPair< F, PBra > > &bra_lc, const LinearCombination< SafePtr< DGVertex >, BraketPair< F, PKet > > &ket_lc, const AuxIndexType &aux=AuxIndexType(), const OperType &oper=OperType())
take a wedge product of various (linear combinations of) brakets
Definition: generic_rr.h:191
RRImpl must inherit GenericRecurrenceRelation<RRImpl>
Definition: generic_rr.h:48
QuantumNumbersA<T,N> is a set of N quantum numbers of type T implemented in terms of a C-style array...
Definition: quanta.h:198
bool ltzero(const IntVec3 &a)
return true if has elements < 0
Definition: vectorn.h:90
Definition: algebra.h:32
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > R12v(const BraketPair< F, BKType > &bkt, unsigned int xyz)
Applies R12v to a physicists&#39; braket.
Definition: gaussoper.h:197
these objects help to construct BraketPairs
Definition: braket.h:442
R12k_R12l_G12 is a two-body operator of form ( r_{12x}^kx * r_{12y}^ky * r_{12z}^kz ) * (r_{12x}^lx *...
Definition: oper.h:322
Set of basis functions.
Definition: bfset.h:41
T norm1() const
1-norm
Definition: vectorn.h:47
BraketPair< F, PBra > _pbra(const F &f1, const F &f2)
Physicists bra.
Definition: braket.h:444
Helps GenericRecurrenceRelation to work around the compiler problem with make_child.
Definition: generic_rr.h:148