28 #ifndef _chemistry_qc_mbptr12_pairiter_h
29 #define _chemistry_qc_mbptr12_pairiter_h
36 #include <chemistry/qc/mbptr12/moindexspace.h>
58 virtual void start(
const int first_ij =0) =0;
60 virtual void next() =0;
62 virtual operator int()
const =0;
65 int ni()
const {
return ni_; }
67 int nj()
const {
return nj_; }
69 int i()
const {
return i_; }
71 int j()
const {
return j_; }
73 int nij()
const {
return nij_; }
75 int ij()
const {
return ij_; }
90 virtual int nij_aa()
const =0;
92 virtual int nij_ab()
const =0;
95 virtual int ij_aa()
const =0;
97 virtual int ij_ab()
const =0;
99 virtual int ij_ba()
const =0;
113 void init_ij(
const int ij) {
116 throw std::runtime_error(
"SpatialMOPairIter_eq::start() -- argument ij out of range");
119 const int renorm_ij =
ij%nij_;
121 i_ = (int)floor((sqrt(1.0+8.0*renorm_ij) - 1.0)/2.0);
122 const int i_off = i_*(i_+1)/2;
123 j_ = renorm_ij - i_off;
125 ij_ab_ = i_*nj_ + j_;
126 ji_ab_ = j_*ni_ + i_;
129 const int i_off = i_*(i_-1)/2;
141 if (ij_ab_ == nij_ab_-1) {
154 ij_aa_ += (i_ == j_) ? 0 : 1;
160 ij_aa_ += (i_ == j_) ? 0 : 1;
182 operator int()
const {
return (nij_ > ij_);};
190 int ij_aa()
const {
return (i_ == j_) ? -1 : ij_aa_; }
192 int ij_ab()
const {
return ij_ab_; }
194 int ij_ba()
const {
return ji_ab_; }
204 void init_ij(
const int ij) {
207 throw std::runtime_error(
"SpatialMOPairIter_neq::start() -- argument ij out of range");
210 const int renorm_ij =
ij%nij_;
213 j_ = renorm_ij - i_*nj_;
255 operator int()
const {
return (nij_ > ij_);};
int nj() const
Returns the number of functions in space j.
Definition: pairiter.h:67
int ij_ba() const
Returns compound index ij for beta-alpha case.
Definition: pairiter.h:194
MOPairIter gives the ordering of orbital pairs.
Definition: pairiter.h:41
A template class that maintains references counts.
Definition: ref.h:332
int ij_aa() const
Returns compound index ij for alpha-alpha case.
Definition: pairiter.h:262
int ij() const
Returns the current iteration.
Definition: pairiter.h:75
SpatialMOPairIter_eq(const Ref< MOIndexSpace > &space1)
Initialize an iterator for the given MO spaces.
SpatialMOPairIter(const Ref< MOIndexSpace > &space_i, const Ref< MOIndexSpace > &space_j)
Initialize a spatial pair iterator for the given MO spaces.
Definition: pairiter.h:85
void next()
Move to the next pair.
Definition: pairiter.h:178
int j() const
Returns index j.
Definition: pairiter.h:71
SpatialMOPairIter_neq gives the ordering of pairs of spatial orbitals from different spaces.
Definition: pairiter.h:200
int nij_ab() const
Returns the number of functions in alpha-beta space.
Definition: pairiter.h:260
virtual int ij_aa() const =0
Returns compound index ij for alpha-alpha case.
SpatialMOPairIter_neq(const Ref< MOIndexSpace > &space1, const Ref< MOIndexSpace > &space2)
Initialize an iterator for the given MO spaces.
virtual void start(const int first_ij=0)=0
Start the iteration.
RefSCDimension scdim_aa(const Ref< MOIndexSpace > &space1, const Ref< MOIndexSpace > &space2)
Constructs an appropriate RefSCDimension object for same-spin pair.
void start(const int ij_offset=0)
Initialize the iterator assuming that iteration will start with pair ij_offset.
Definition: pairiter.h:171
int nij_aa() const
Returns the number of functions in alpha-alpha space.
Definition: pairiter.h:258
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition: dim.h:156
int ij_aa() const
Returns compound index ij for alpha-alpha case.
Definition: pairiter.h:190
MOPairIter(const Ref< MOIndexSpace > &space_i, const Ref< MOIndexSpace > &space_j)
Initialize an iterator for the given MO spaces.
virtual int ij_ab() const =0
Returns compound index ij for alpha-beta case.
virtual void next()=0
Move to the next pair.
int i() const
Returns index i.
Definition: pairiter.h:69
SpatialMOPairIter_eq gives the ordering of same-spin and different-spin orbital pairs if both orbital...
Definition: pairiter.h:105
int ij_ab() const
Returns compound index ij for alpha-beta case.
Definition: pairiter.h:264
int ni() const
Returns the number of functions in space i.
Definition: pairiter.h:65
int nij() const
Returns the number of pair combinations for this iterator.
Definition: pairiter.h:73
This class produces MOPairIter objects.
Definition: pairiter.h:272
SpatialMOPairIter gives the ordering of pairs of spatial orbitals.
Definition: pairiter.h:81
RefSCDimension scdim_ab(const Ref< MOIndexSpace > &space1, const Ref< MOIndexSpace > &space2)
Constructs an appropriate RefSCDimension object for different-spin pair.
virtual int nij_aa() const =0
Returns the number of functions in alpha-alpha space.
int nij_aa() const
Returns the number of functions in alpha-alpha space.
Definition: pairiter.h:185
virtual int ij_ba() const =0
Returns compound index ij for beta-alpha case.
int ij_ba() const
Returns compound index ij for beta-alpha case.
Definition: pairiter.h:266
The base class for all reference counted objects.
Definition: ref.h:194
Ref< SpatialMOPairIter > mopairiter(const Ref< MOIndexSpace > &space1, const Ref< MOIndexSpace > &space2)
Constructs an appropriate MOPairIter object.
virtual int nij_ab() const =0
Returns the number of functions in alpha-beta space.
void start(const int ij_offset=0)
Initialize the iterator assuming that iteration will start with pair ij_offset.
Definition: pairiter.h:244
int ij_ab() const
Returns compound index ij for alpha-beta case.
Definition: pairiter.h:192
int nij_ab() const
Returns the number of functions in alpha-beta space.
Definition: pairiter.h:187
void next()
Move to the next pair.
Definition: pairiter.h:251
Generated at Sun Jan 26 2020 23:33:04 for MPQC
2.3.1 using the documentation package Doxygen
1.8.16.