21#include <integral_decl.h>
28#ifndef _libint2_src_bin_libint_policyspec_h_
29#define _libint2_src_bin_libint_policyspec_h_
55void StdLibintTDPolicy<CGShell>::init_subobj(
56 const StdLibintTDPolicy<CGShell>::obj_stype& cgshell,
57 std::vector<StdLibintTDPolicy<CGShell>::subobj_stype>& cgfs);
60void StdLibintTDPolicy<CGShell>::dealloc_subobj(
61 std::vector<StdLibintTDPolicy<CGShell>::subobj_stype>& subobj);
69template <CartesianAxis Axis>
81 std::vector<subobj_stype>& cgfs) {
82 if (cgshell.is_unit()) {
86 for (
unsigned int q = 0; q <= am; ++q) {
88 cgf.deriv() = cgshell.deriv();
89 if (cgshell.contracted()) cgf.contract();
94 static void dealloc_subobj(std::vector<subobj_stype>& subobj) {}
107template <
class Oper,
class BFS,
class BraSetType,
class KetSetType,
109struct StdLibintTDPolicy<
113 static const unsigned int np = Oper::Properties::np;
119 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
120 std::vector<std::shared_ptr<subobj_type>>& subobj) {
121 std::vector<SubIterator*>
124 typedef std::vector<std::vector<SubIterator*>> bra_siters_type;
125 typedef std::vector<std::vector<SubIterator*>> ket_siters_type;
126 bra_siters_type bra_siters;
128 ket_siters_type ket_siters;
130 bra_siters.resize(np);
131 ket_siters.resize(np);
135 siters_inord.push_back(&oper_siter);
138 siters_inord.push_back(&aux_siter);
140 for (
unsigned int p = 0; p < np; p++) {
141 const unsigned int nbra = obj->bra().num_members(p);
142 bra_siters[p].resize(nbra);
143 for (
unsigned int i = 0; i < nbra; i++) {
144 SubIterator* iter = obj->bra().member_subiter(p, i);
145 siters_inord.push_back(iter);
146 bra_siters[p][i] = iter;
149 const unsigned int nket = obj->ket().num_members(p);
150 ket_siters[p].resize(nket);
151 for (
unsigned int i = 0; i < nket; i++) {
152 SubIterator* iter = obj->ket().member_subiter(p, i);
153 siters_inord.push_back(iter);
154 ket_siters[p][i] = iter;
158 const unsigned int niters = siters_inord.size();
159 for (
unsigned int it = 0; it < niters; it++) siters_inord[it]->init();
162 bool can_iterate =
true;
163 while (can_iterate) {
164 typename Oper::iter_type oper(oper_siter.
elem());
165 typename AuxQuanta::iter_type aux(aux_siter.
elem());
168 typename BraSetType::iter_type bra;
169 for (
unsigned int p = 0; p < np; p++) {
170 const unsigned int nbra = bra_siters[p].size();
171 for (
unsigned int i = 0; i < nbra; i++)
172 bra.set_member(bra_siters[p][i]->pelem(), p, i);
176 typename KetSetType::iter_type ket;
177 for (
unsigned int p = 0; p < np; p++) {
178 const unsigned int nket = ket_siters[p].size();
179 for (
unsigned int i = 0; i < nket; i++)
180 ket.set_member(ket_siters[p][i]->pelem(), p, i);
184 std::shared_ptr<subobj_type> curr_subobj_sptr =
185 subobj_type::Instance(bra, ket, aux, oper);
186 subobj.push_back(curr_subobj_sptr);
189 for (
int it = niters - 1; it >= 0; it--) {
199 if (it == 0) can_iterate =
false;
206 typedef bra_siters_type::iterator bra_iter;
207 typedef ket_siters_type::iterator ket_iter;
208 typedef bra_siters_type::value_type::iterator bra_elem_iter;
209 typedef bra_siters_type::value_type::iterator ket_elem_iter;
211 const bra_iter bi_end = bra_siters.end();
212 for (bra_iter bi = bra_siters.begin(); bi != bi_end; ++bi) {
213 const bra_elem_iter bij_end = bi->end();
214 for (bra_elem_iter bij = bi->begin(); bij != bij_end; ++bij) {
220 const ket_iter ki_end = ket_siters.end();
221 for (ket_iter ki = ket_siters.begin(); ki != ki_end; ++ki) {
222 const ket_elem_iter kij_end = ki->end();
223 for (ket_elem_iter kij = ki->begin(); kij != kij_end; ++kij) {
233 static void dealloc_subobj(
234 std::vector<std::shared_ptr<subobj_type>>& subobj) {}
237#if LIBINT_SUPPORT_ONEBODYINTS
238template <
typename BFS,
typename Oper,
typename AuxQuanta>
248 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
249 std::vector<std::shared_ptr<subobj_type>>& subobj) {
252 for (gis_siter.
init(); gis_siter; ++gis_siter) {
253 const std::shared_ptr<typename obj_type::parent_type::iter_type>
254 curr_gis_ptr = gis_siter.
elem();
255 const std::shared_ptr<subobj_type> curr_subobj = subobj_type::Instance(
256 curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get(),
257 *curr_gis_ptr->oper().get());
258 subobj.push_back(curr_subobj);
264 static void dealloc_subobj(
265 std::vector<std::shared_ptr<subobj_type>>& subobj) {}
269template <
typename BFS,
typename Oper,
typename AuxQuanta>
279 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
280 std::vector<std::shared_ptr<subobj_type>>& subobj) {
283 for (gis_siter.
init(); gis_siter; ++gis_siter) {
284 const std::shared_ptr<typename obj_type::parent_type::iter_type>
285 curr_gis_ptr = gis_siter.
elem();
286 const std::shared_ptr<subobj_type> curr_subobj = subobj_type::Instance(
287 curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get(),
288 *curr_gis_ptr->oper().get());
289 subobj.push_back(curr_subobj);
295 static void dealloc_subobj(
296 std::vector<std::shared_ptr<subobj_type>>& subobj) {}
307 typedef typename obj_type::iter_type subobj_type;
314 static void init_subobj(
const std::shared_ptr<obj_type>& obj, std::vector< std::shared_ptr<subobj_type> >& subobj) {
318 for(gis_siter.
init(); gis_siter; ++gis_siter) {
319 const std::shared_ptr<typename TwoPRep_11_11<BFS>::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
320 const std::shared_ptr<subobj_type> curr_subobj =
321 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
322 subobj.push_back(curr_subobj);
335template <
class BFS,
int K>
338 typedef typename obj_type::iter_type subobj_type;
345 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
346 std::vector<std::shared_ptr<subobj_type>>& subobj) {
349 for (gis_siter.
init(); gis_siter; ++gis_siter) {
350 const std::shared_ptr<typename obj_type::parent_type::iter_type>
351 curr_gis_ptr = gis_siter.
elem();
352 const std::shared_ptr<subobj_type> curr_subobj = subobj_type::Instance(
353 curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
354 subobj.push_back(curr_subobj);
360 static void dealloc_subobj(
368template <
class BFS,
int K>
371 typedef typename obj_type::iter_type subobj_type;
378 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
379 std::vector<std::shared_ptr<subobj_type>>& subobj) {
382 for (gis_siter.
init(); gis_siter; ++gis_siter) {
383 const std::shared_ptr<typename obj_type::parent_type::iter_type>
384 curr_gis_ptr = gis_siter.
elem();
385 const std::shared_ptr<subobj_type> curr_subobj = subobj_type::Instance(
386 curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
387 subobj.push_back(curr_subobj);
393 static void dealloc_subobj(
411 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
412 std::vector<std::shared_ptr<subobj_type>>& subobj) {
415 for (gis_siter.
init(); gis_siter; ++gis_siter) {
416 const std::shared_ptr<typename obj_type::parent_type::iter_type>
417 curr_gis_ptr = gis_siter.
elem();
418 const std::shared_ptr<subobj_type> curr_subobj = subobj_type::Instance(
419 curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
420 subobj.push_back(curr_subobj);
426 static void dealloc_subobj(
444 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
445 std::vector<std::shared_ptr<subobj_type>>& subobj) {
448 for (gis_siter.
init(); gis_siter; ++gis_siter) {
449 const std::shared_ptr<typename obj_type::parent_type::iter_type>
450 curr_gis_ptr = gis_siter.
elem();
451 const std::shared_ptr<subobj_type> curr_subobj = subobj_type::Instance(
452 curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
453 subobj.push_back(curr_subobj);
459 static void dealloc_subobj(
477 static void init_subobj(
const std::shared_ptr<obj_type>& obj,
478 std::vector<std::shared_ptr<subobj_type>>& subobj) {
481 for (gis_siter.
init(); gis_siter; ++gis_siter) {
482 const std::shared_ptr<typename obj_type::parent_type::iter_type>
483 curr_gis_ptr = gis_siter.
elem();
484 const std::shared_ptr<subobj_type> curr_subobj = subobj_type::Instance(
485 curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
486 subobj.push_back(curr_subobj);
492 static void dealloc_subobj(
Cartesian components of 3D CGF = 1D CGF.
Definition bfset.h:457
a "shell" of 1D CGFs with quantum number L is a set of 1D CGFs with quantum numbers 0 .
Definition bfset.h:647
Generic integral over a two-body operator with one bfs for each particle in bra and ket.
Definition integral_11_11.h:36
Generic integral over a one-body operator with one bfs for each particle in bra and ket.
Definition integral_1_1.h:36
GenIntegralSet is a set of integrals over functions derived from BFS.
Definition integral.h:99
Oper is OperSet characterized by properties Props.
Definition oper.h:91
Definition integral_decl.h:40
R1dotR1G12_11_11 – integral over R1dotR1_G12 operator with one bfs for each particle in bra and ket.
Definition r1dotr1g12_11_11.h:35
Definition r1dotr2g12_11_11.h:47
R2dotR2G12_11_11 – integral over R2dotR2_G12 operator with one bfs for each particle in bra and ket.
Definition r2dotr2g12_11_11.h:35
SubIteratorBase<T> provides a base class for a sub-iterator class for T.
Definition iter.h:73
void init() override
Initializes the iterator.
Definition iter.h:182
const iref & elem() const
Returns current element.
Definition iter.h:161
Iterator provides a base class for all object iterator classes.
Definition iter.h:43
virtual void init()=0
Initializes the iterator.
Definition integral_decl.h:42
Definition integral_decl.h:37
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24
static void init_subobj(const obj_stype &cgshell, std::vector< subobj_stype > &cgfs)
This function allocates subobj of obj (e.g.
Definition policy_spec.h:80
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:76
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:74
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:115
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:117
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:277
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:275
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:246
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:244
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:341
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:343
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:409
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:407
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:475
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:473
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:440
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:442
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:374
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:376
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition policy_spec.h:312
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition policy_spec.h:310
StorageTraits< T >::StorageType StorageType
By default, use std::shared_ptr to manage these objects.
Definition traits.h:85