21#ifndef _libint2_src_bin_libint_integral1111_h_
22#define _libint2_src_bin_libint_integral1111_h_
32template <
class BFS,
class Oper,
class AuxQuanta = EmptySet>
35 Oper, IncableBFSet, typename DefaultTwoPBraket<BFS>::Result,
36 typename DefaultTwoPBraket<BFS>::Result, AuxQuanta> {
38 typedef BFS BasisFunctionType;
42 typedef AuxQuanta AuxIndexType;
49 typename Oper::iter_type,
50 typename AuxQuanta::iter_type>
52 typedef typename parent_type::key_type key_type;
65 static const std::shared_ptr<this_type>
Instance(
66 const BFS& bra0,
const BFS& ket0,
const BFS& bra1,
const BFS& ket1,
67 const AuxIndexType&
aux = AuxIndexType(),
71 static const std::shared_ptr<this_type>
Instance(
74 const AuxIndexType&
aux = AuxIndexType(),
76 return Instance(braket_wedge.left[0], braket_wedge.right[0],
77 braket_wedge.left[1], braket_wedge.right[1],
aux,
oper);
81 static const std::shared_ptr<this_type>
Instance(
84 const AuxIndexType&
aux = AuxIndexType(),
86 return Instance(braket_wedge.left[0], braket_wedge.left[1],
87 braket_wedge.right[0], braket_wedge.right[1],
aux,
oper);
94 static const std::shared_ptr<this_type>
Instance(
95 const BraType&
bra,
const KetType&
ket,
96 const AuxIndexType&
aux = AuxIndexType(),
97 const OperType&
oper = OperType());
113 const KetType&
ket,
const AuxIndexType&
aux);
119 bool this_precomputed()
const;
122#if USE_INT_KEY_TO_HASH
123template <
class BFS,
class Oper,
class AuxQuanta>
125 GenIntegralSet_11_11<BFS, Oper, AuxQuanta>::singl_manager_(&this_type::key);
127#error "USE_INT_KEY_TO_HASH must be set"
130template <
class BFS,
class Oper,
class AuxQuanta>
131GenIntegralSet_11_11<BFS, Oper, AuxQuanta>::GenIntegralSet_11_11(
132 const OperType& oper,
const BraType& bra,
const KetType& ket,
133 const AuxIndexType& aux)
134 : parent_type(oper, bra, ket, aux) {
136 throw std::runtime_error(
137 "GenIntegralSet_11_11::GenIntegralSet_11_11(bra,ket) -- number of BFSs "
138 "in bra for particle 0 must be 1");
140 throw std::runtime_error(
141 "GenIntegralSet_11_11::GenIntegralSet_11_11(bra,ket) -- number of BFSs "
142 "in bra for particle 1 must be 1");
144 throw std::runtime_error(
145 "GenIntegralSet_11_11::GenIntegralSet_11_11(bra,ket) -- number of BFSs "
146 "in ket for particle 0 must be 1");
148 throw std::runtime_error(
149 "GenIntegralSet_11_11::GenIntegralSet_11_11(bra,ket) -- number of BFSs "
150 "in ket for particle 1 must be 1");
152 std::cout <<
"GenIntegralSet_11_11: constructed " << this->
label()
157template <
class BFS,
class Oper,
class AuxQuanta>
158GenIntegralSet_11_11<BFS, Oper, AuxQuanta>::~GenIntegralSet_11_11() {
160 std::cout <<
"GenIntegralSet_11_11: destructed " << this->label()
165template <
class BFS,
class Oper,
class AuxQuanta>
166const std::shared_ptr<GenIntegralSet_11_11<BFS, Oper, AuxQuanta> >
169 const AuxIndexType& aux,
171 typedef typename SingletonManagerType::value_type map_value_type;
172 key_type key = parent_type::compute_key(oper, bra, ket, aux);
173 const map_value_type& val = singl_manager_.find(key);
175 std::shared_ptr<this_type> this_int(
new this_type(oper, bra, ket, aux));
177 const typename SingletonManagerType::value_type& val =
178 singl_manager_.find(this_int);
179 val.second->instid_ = val.first;
185template <
class BFS,
class Oper,
class AuxQuanta>
186const std::shared_ptr<GenIntegralSet_11_11<BFS, Oper, AuxQuanta> >
188 const BFS& bra0,
const BFS& ket0,
const BFS& bra1,
const BFS& ket1,
189 const AuxIndexType& aux,
const OperType& oper) {
192 BFSRef bra0_ref(bra0);
193 BFSRef bra1_ref(bra1);
194 BFSRef ket0_ref(ket0);
195 BFSRef ket1_ref(ket1);
197 typedef std::shared_ptr<BFS> BFSRef;
198 BFSRef bra0_ref(
new BFS(bra0));
199 BFSRef bra1_ref(
new BFS(bra1));
200 BFSRef ket0_ref(
new BFS(ket0));
201 BFSRef ket1_ref(
new BFS(ket1));
203 std::vector<BFSRef> vbra0;
204 vbra0.push_back(bra0_ref);
205 std::vector<BFSRef> vbra1;
206 vbra1.push_back(bra1_ref);
207 std::vector<BFSRef> vket0;
208 vket0.push_back(ket0_ref);
209 std::vector<BFSRef> vket1;
210 vket1.push_back(ket1_ref);
211 std::vector<std::vector<BFSRef> > vvbra;
212 vvbra.push_back(vbra0);
213 vvbra.push_back(vbra1);
214 std::vector<std::vector<BFSRef> > vvket;
215 vvket.push_back(vket0);
216 vvket.push_back(vket1);
219 return Instance(bra, ket, aux, oper);
222template <
class BFS,
class Oper,
class AuxQuanta>
225 return parent_type::PtrComp::equiv(
static_cast<const parent_type*
>(
this), a);
228template <
class BFS,
class Oper,
class AuxQuanta>
230 std::shared_ptr<parent_type> this_parent_ptr =
231 std::const_pointer_cast<parent_type, const parent_type>(
232 std::enable_shared_from_this<parent_type>::shared_from_this());
233 std::shared_ptr<this_type> this_ptr =
234 std::static_pointer_cast<this_type>(this_parent_ptr);
235 singl_manager_.remove(this_ptr);
ArrayBraket is a lightweight implementation of Braket concept.
Definition src/bin/libint/braket.h:39
unsigned int num_members(unsigned int p) const
Returns the number of BFS for particle p.
Definition src/bin/libint/braket.h:79
BraketPair is a trimmed down version of ArrayBraket specialized for same-particle or different-partic...
Definition src/bin/libint/braket.h:247
Generic integral over a two-body operator with one bfs for each particle in bra and ket.
Definition integral_11_11.h:36
void unregister() const
Reimplements DGVertex::unregister()
Definition integral_11_11.h:229
static const std::shared_ptr< this_type > Instance(const algebra::Wedge< BraketPair< BFS, CBra >, BraketPair< BFS, CKet > > &braket_wedge, const AuxIndexType &aux=AuxIndexType(), const OperType &oper=OperType())
This "constructor" uses a wedge of 2 chemists brakets.
Definition integral_11_11.h:81
GenIntegralSet_11_11< typename BFS::iter_type, typename Oper::iter_type, typename AuxQuanta::iter_type > iter_type
this is a set of these subobjects
Definition integral_11_11.h:51
static const std::shared_ptr< this_type > Instance(const algebra::Wedge< BraketPair< BFS, PBra >, BraketPair< BFS, PKet > > &braket_wedge, const AuxIndexType &aux=AuxIndexType(), const OperType &oper=OperType())
This "constructor" uses a wedge of 2 physicists brakets.
Definition integral_11_11.h:71
static const std::shared_ptr< this_type > Instance(const BFS &bra0, const BFS &ket0, const BFS &bra1, const BFS &ket1, const AuxIndexType &aux=AuxIndexType(), const OperType &oper=OperType())
This "constructor" takes basis function sets, in Mulliken ordering.
Definition integral_11_11.h:187
PtrEquiv< this_type > PtrComp
This class provides comparison operations on pointers.
Definition integral_11_11.h:57
bool operator==(const this_type &) const
Comparison operator.
Definition integral_11_11.h:223
SingletonStack< this_type, key_type > SingletonManagerType
This the type of the object that manages objects of this type as Singletons.
Definition integral_11_11.h:55
bool auto_unroll() const
Implements GenIntegralSet::auto_unroll()
Definition integral_11_11.impl.h:32
GenIntegralSet is a set of integrals over functions derived from BFS.
Definition integral.h:99
const std::string & label() const override
Specialization of DGVertex::label()
Definition integral.h:525
const BraType & bra() const
Obtain const ref to bra.
Definition integral.h:406
const KetType & ket() const
Obtain const ref to bra.
Definition integral.h:414
const std::shared_ptr< Oper > oper() const
Obtain the operator.
Definition integral.h:421
const std::shared_ptr< AuxQuanta > aux() const
Obtain the auxiliary quanta.
Definition integral.h:428
Oper is OperSet characterized by properties Props.
Definition oper.h:91
PtrEquiv<T> provides a set of comparison functions named 'equiv' which take as arguments a mix of ref...
Definition equiv.h:36
SingletonStack<T,KeyType> helps to implement Singleton-like objects of type T.
Definition singl_stack.h:45
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24
Wedge is a typeholder for the result of a wedge product.
Definition algebra.h:248