MPQC  3.0.0-alpha
cartiter.h
1 //
2 // cartiter.h
3 //
4 // Copyright (C) 1996 Limit Point Systems, Inc.
5 //
6 // Author: Curtis Janssen <cljanss@limitpt.com>
7 // Maintainer: LPS
8 //
9 // This file is part of the SC Toolkit.
10 //
11 // The SC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The SC Toolkit is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #ifndef _chemistry_qc_basis_cartiter_h
29 #define _chemistry_qc_basis_cartiter_h
30 
31 namespace sc {
32 
36  protected:
37  int a_;
38  int b_;
39  int c_;
40  int l_;
41  int bfn_;
42 
43  public:
45  CartesianIter(int l);
46  virtual ~CartesianIter();
47 
49  virtual void start() =0;
51  virtual void next() =0;
53  virtual operator int() =0;
54 
56  int n() { return ((l_>=0)?((((l_)+2)*((l_)+1))>>1):0); }
58  int a() { return a_; }
60  int b() { return b_; }
62  int c() { return c_; }
64  int l() { return l_; }
66  int l(int i) { return i ? (i==1 ? b_ : c_) : a_; }
69  int bfn() { return bfn_; }
70 };
71 
83  private:
84  int done_;
85  int l_;
86  int *axis_;
87 
88  public:
91  virtual ~RedundantCartesianIter();
92 
94  virtual int bfn() =0;
95 
97  void start();
99  void next();
101  operator int() { return !done_; }
102 
104  int a();
106  int b();
108  int c();
110  int l() { return l_; }
112  int l(int i);
114  int axis(int i) { return axis_[i]; }
115 };
116 
117 inline void
119 {
120  if (l_==0)
121  done_ = 1;
122  else
123  done_ = 0;
124 
125  for (int i=0; i<l_; i++)
126  axis_[i] = 0;
127 }
128 
129 inline void
131 {
132  for (int i=0; i<l_; i++) {
133  if (axis_[i] == 2)
134  axis_[i] = 0;
135  else {
136  axis_[i]++;
137  return;
138  }
139  }
140  done_ = 1;
141 }
142 
143 inline int
145 {
146  int i;
147  int r = 0;
148  for (i=0; i<l_; i++) if (axis_[i]==axis) r++;
149  return r;
150 }
151 
152 inline int
154 {
155  return l(0);
156 }
157 
158 inline int
160 {
161  return l(1);
162 }
163 
164 inline int
166 {
167  return l(2);
168 }
169 
173  private:
174  int done_;
175  int l_;
176  int e_[3];
177  int *axis_;
178 
179  // the locations of the z's in the axis array
180  int *zloc_;
181  // the locations of the y's in the subarray after the z's are removed
182  int *yloc_;
183 
184  int valid();
185 
186  public:
189  virtual ~RedundantCartesianSubIter();
190 
193  virtual int bfn() const =0;
194 
197  virtual void start(int a, int b, int c);
199  void next();
201  operator int() const { return !done_; }
202 
204  int a() const { return e_[0]; }
206  int b() const { return e_[1]; }
208  int c() const { return e_[2]; }
210  int l() const { return l_; }
212  int l(int i) { return e_[i]; }
214  int axis(int i) { return axis_[i]; }
215 };
216 
217 }
218 
219 #endif
220 
221 // Local Variables:
222 // mode: c++
223 // c-file-style: "ETS"
224 // End:
sc::CartesianIter::start
virtual void start()=0
Start the iteration.
sc::RedundantCartesianIter::RedundantCartesianIter
RedundantCartesianIter(int l)
Create a object for the given angular momentum.
sc::RedundantCartesianSubIter::l
int l(int i)
Returns a() if i==0, b() if i==1, and c() if i==2.
Definition: cartiter.h:212
sc::RedundantCartesianIter
RedundantCartesianIter objects loop through all possible combinations of a given number of axes.
Definition: cartiter.h:82
sc::RedundantCartesianSubIter::start
virtual void start(int a, int b, int c)
Initialize the iterator.
sc::RedundantCartesianSubIter::RedundantCartesianSubIter
RedundantCartesianSubIter(int l)
Create a object for the given angular momentum.
sc::CartesianIter::CartesianIter
CartesianIter(int l)
Initialize an iterator for the given angular momentum.
sc::RedundantCartesianIter::a
int a()
The current exponent of x.
Definition: cartiter.h:153
sc::CartesianIter
CartesianIter gives the ordering of the Cartesian functions within a shell for the particular integra...
Definition: cartiter.h:35
sc::CartesianIter::l
int l()
Returns the angular momentum.
Definition: cartiter.h:64
sc::RedundantCartesianSubIter
Like RedundantCartesianIter, except a, b, and c are fixed to a given value.
Definition: cartiter.h:172
sc::RedundantCartesianSubIter::l
int l() const
The angular momentum.
Definition: cartiter.h:210
sc::RedundantCartesianIter::b
int b()
The current exponent of y.
Definition: cartiter.h:159
sc::CartesianIter::a
int a()
Returns the exponent of x.
Definition: cartiter.h:58
sc::RedundantCartesianIter::axis
int axis(int i)
Return the i'th axis.
Definition: cartiter.h:114
sc::CartesianIter::l
int l(int i)
Returns a() if i==0, b() if i==1, and c() if i==2.
Definition: cartiter.h:66
sc::RedundantCartesianSubIter::a
int a() const
The current exponent of x.
Definition: cartiter.h:204
sc::RedundantCartesianSubIter::bfn
virtual int bfn() const =0
Return the current Cartesian basis function number.
sc::RedundantCartesianIter::bfn
virtual int bfn()=0
Return the current Cartesian basis function number.
sc::RedundantCartesianSubIter::axis
int axis(int i)
Return the i'th axis.
Definition: cartiter.h:214
sc::CartesianIter::c
int c()
Returns the exponent of z.
Definition: cartiter.h:62
sc::CartesianIter::next
virtual void next()=0
Move to the next Cartesian function.
sc::RedundantCartesianIter::c
int c()
The current exponent of z.
Definition: cartiter.h:165
sc::CartesianIter::bfn
int bfn()
Returns the number of the current basis function within the shell.
Definition: cartiter.h:69
sc::RedundantCartesianIter::start
void start()
Initialize the iterator.
Definition: cartiter.h:118
sc::RedundantCartesianIter::next
void next()
Move to the next combination of axes.
Definition: cartiter.h:130
sc::RedundantCartesianSubIter::c
int c() const
The current exponent of z.
Definition: cartiter.h:208
sc::RedundantCartesianSubIter::next
void next()
Move to the next combination of axes.
sc::CartesianIter::b
int b()
Returns the exponent of y.
Definition: cartiter.h:60
sc::RedundantCartesianIter::l
int l()
The angular momentum.
Definition: cartiter.h:110
sc::CartesianIter::n
int n()
Returns the number of Cartesian functions.
Definition: cartiter.h:56
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::RedundantCartesianSubIter::b
int b() const
The current exponent of y.
Definition: cartiter.h:206

Generated at Sun Jan 26 2020 23:23:57 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.