22 #include <smart_ptr.h> 25 #include <integral_decl.h> 27 #ifndef _libint2_src_bin_libint_policyspec_h_ 28 #define _libint2_src_bin_libint_policyspec_h_ 55 StdLibintTDPolicy<CGShell>::init_subobj(
const StdLibintTDPolicy<CGShell>::obj_stype& cgshell,
56 std::vector<StdLibintTDPolicy<CGShell>::subobj_stype>& cgfs);
60 StdLibintTDPolicy<CGShell>::dealloc_subobj(std::vector<StdLibintTDPolicy<CGShell>::subobj_stype>& subobj);
67 template <CartesianAxis Axis>
79 if (cgshell.is_unit()) {
84 for(
unsigned int q=0; q<=am; ++q) {
86 cgf.deriv() = cgshell.deriv();
87 if (cgshell.contracted()) cgf.contract();
92 static void dealloc_subobj(vector<subobj_stype>& subobj)
107 template <
class Oper,
class BFS,
class BraSetType,
class KetSetType,
class AuxQuanta>
112 static const unsigned int np = Oper::Properties::np;
118 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
120 std::vector< SubIterator* > siters_inord;
121 typedef std::vector< std::vector< SubIterator* > > bra_siters_type;
122 typedef std::vector< std::vector< SubIterator* > > ket_siters_type;
123 bra_siters_type bra_siters;
124 ket_siters_type ket_siters;
125 bra_siters.resize(np);
126 ket_siters.resize(np);
130 siters_inord.push_back(&oper_siter);
133 siters_inord.push_back(&aux_siter);
135 for(
unsigned int p=0; p<np; p++) {
136 const unsigned int nbra = obj->bra().num_members(p);
137 bra_siters[p].resize(nbra);
138 for(
unsigned int i=0; i<nbra; i++) {
139 SubIterator* iter = obj->bra().member_subiter(p,i);
140 siters_inord.push_back(iter);
141 bra_siters[p][i] = iter;
144 const unsigned int nket = obj->ket().num_members(p);
145 ket_siters[p].resize(nket);
146 for(
unsigned int i=0; i<nket; i++) {
147 SubIterator* iter = obj->ket().member_subiter(p,i);
148 siters_inord.push_back(iter);
149 ket_siters[p][i] = iter;
153 const unsigned int niters = siters_inord.size();
154 for(
unsigned int it=0; it<niters; it++)
155 siters_inord[it]->init();
158 bool can_iterate =
true;
159 while (can_iterate) {
161 typename Oper::iter_type oper(oper_siter.elem());
162 typename AuxQuanta::iter_type aux(aux_siter.elem());
165 typename BraSetType::iter_type bra;
166 for(
unsigned int p=0; p<np; p++) {
167 const unsigned int nbra = bra_siters[p].size();
168 for(
unsigned int i=0; i<nbra; i++)
169 bra.set_member(bra_siters[p][i]->pelem(), p, i);
173 typename KetSetType::iter_type ket;
174 for(
unsigned int p=0; p<np; p++) {
175 const unsigned int nket = ket_siters[p].size();
176 for(
unsigned int i=0; i<nket; i++)
177 ket.set_member(ket_siters[p][i]->pelem(), p, i);
181 SafePtr<subobj_type> curr_subobj_sptr = subobj_type::Instance(bra,ket,aux,oper);
182 subobj.push_back(curr_subobj_sptr);
185 for(
int it=niters-1; it>=0; it--) {
204 typedef bra_siters_type::iterator bra_iter;
205 typedef ket_siters_type::iterator ket_iter;
206 typedef bra_siters_type::value_type::iterator bra_elem_iter;
207 typedef bra_siters_type::value_type::iterator ket_elem_iter;
209 const bra_iter bi_end = bra_siters.end();
210 for(bra_iter bi=bra_siters.begin(); bi != bi_end; ++bi) {
211 const bra_elem_iter bij_end = bi->end();
212 for(bra_elem_iter bij=bi->begin(); bij != bij_end; ++bij) {
218 const ket_iter ki_end = ket_siters.end();
219 for(ket_iter ki=ket_siters.begin(); ki != ki_end; ++ki) {
220 const ket_elem_iter kij_end = ki->end();
221 for(ket_elem_iter kij=ki->begin(); kij != kij_end; ++kij) {
231 static void dealloc_subobj(std::vector< SafePtr<subobj_type> >& subobj) {
235 #if LIBINT_SUPPORT_ONEBODYINTS 236 template <
typename BFS,
typename Oper,
typename AuxQuanta>
247 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
251 for(gis_siter.
init(); gis_siter; ++gis_siter) {
252 const SafePtr<typename obj_type::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
253 const SafePtr<subobj_type> curr_subobj =
254 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get(), *curr_gis_ptr->oper().get());
255 subobj.push_back(curr_subobj);
260 static void dealloc_subobj(std::vector< SafePtr< subobj_type > >& subobj) {
263 #endif // LIBINT_SUPPORT_ONEBODYINTS 265 template <
typename BFS,
typename Oper,
typename AuxQuanta>
276 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
280 for(gis_siter.
init(); gis_siter; ++gis_siter) {
281 const SafePtr<typename obj_type::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
282 const SafePtr<subobj_type> curr_subobj =
283 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get(), *curr_gis_ptr->oper().get());
284 subobj.push_back(curr_subobj);
289 static void dealloc_subobj(std::vector< SafePtr< subobj_type > >& subobj) {
301 typedef typename obj_type::iter_type subobj_type;
308 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
312 for(gis_siter.
init(); gis_siter; ++gis_siter) {
313 const SafePtr<typename TwoPRep_11_11<BFS>::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
314 const SafePtr<subobj_type> curr_subobj =
315 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
316 subobj.push_back(curr_subobj);
329 template <
class BFS,
int K>
333 typedef typename obj_type::iter_type subobj_type;
340 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
344 for(gis_siter.
init(); gis_siter; ++gis_siter) {
345 const SafePtr<typename obj_type::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
346 const SafePtr<subobj_type> curr_subobj =
347 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
348 subobj.push_back(curr_subobj);
361 template <
class BFS,
int K>
365 typedef typename obj_type::iter_type subobj_type;
372 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
376 for(gis_siter.
init(); gis_siter; ++gis_siter) {
377 const SafePtr<typename obj_type::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
378 const SafePtr<subobj_type> curr_subobj =
379 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
380 subobj.push_back(curr_subobj);
404 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
408 for(gis_siter.
init(); gis_siter; ++gis_siter) {
409 const SafePtr<typename obj_type::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
410 const SafePtr<subobj_type> curr_subobj =
411 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
412 subobj.push_back(curr_subobj);
435 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
439 for(gis_siter.
init(); gis_siter; ++gis_siter) {
440 const SafePtr<typename obj_type::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
441 const SafePtr<subobj_type> curr_subobj =
442 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
443 subobj.push_back(curr_subobj);
466 static void init_subobj(
const SafePtr<obj_type>& obj, std::vector< SafePtr<subobj_type> >& subobj) {
470 for(gis_siter.
init(); gis_siter; ++gis_siter) {
471 const SafePtr<typename obj_type::parent_type::iter_type> curr_gis_ptr = gis_siter.
elem();
472 const SafePtr<subobj_type> curr_subobj =
473 subobj_type::Instance(curr_gis_ptr->bra(), curr_gis_ptr->ket(), *curr_gis_ptr->aux().get());
474 subobj.push_back(curr_subobj);
static void init_subobj(const obj_stype &cgshell, std::vector< subobj_stype > &cgfs)
This function allocates subobj of obj (e.g. basis functions contained in a shell)
Definition: policy_spec.h:77
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:304
StorageTraits< T >::StorageType StorageType
By default, use SafePtr to manage these objects.
Definition: traits.h:84
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:462
Cartesian components of 3D CGF = 1D CGF.
Definition: bfset.h:438
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:368
R1dotR1G12_11_11 – integral over R1dotR1_G12 operator with one bfs for each particle in bra and ket.
Definition: integral_decl.h:40
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24
GenIntegralSet is a set of integrals over functions derived from BFS.
Definition: integral.h:91
a "shell" of 1D CGFs with quantum number L is a set of 1D CGFs with quantum numbers 0 .
Definition: bfset.h:627
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:431
Generic integral over a two-body operator with one bfs for each particle in bra and ket.
Definition: integral_11_11.h:33
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:338
void init()
Initializes the iterator.
Definition: iter.h:188
Definition: integral_decl.h:39
SubIteratorBase<T> provides a base class for a sub-iterator class for T.
Definition: iter.h:73
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:116
virtual void init()=0
Initializes the iterator.
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:114
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:243
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:464
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:336
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:245
Definition: integral_decl.h:36
Oper is OperSet characterized by properties Props.
Definition: oper.h:90
Generic integral over a one-body operator with one bfs for each particle in bra and ket.
Definition: integral_1_1.h:33
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:433
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:74
Definition: integral_decl.h:42
Iterator provides a base class for all object iterator classes.
Definition: iter.h:45
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:370
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:274
const iref & elem() const
Returns current element.
Definition: iter.h:165
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:306
R2dotR2G12_11_11 – integral over R2dotR2_G12 operator with one bfs for each particle in bra and ket.
Definition: integral_decl.h:41
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:400
TypeTraits< subobj_type >::StorageType subobj_stype
how these subobjects are stored
Definition: policy_spec.h:402
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:272
Definition: integral_decl.h:38
TypeTraits< obj_type >::StorageType obj_stype
how these objects are stored
Definition: policy_spec.h:72