MPQC 2.3.1
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#ifdef __GNUC__
32#pragma interface
33#endif
34
35namespace sc {
36
40 protected:
41 int a_;
42 int b_;
43 int c_;
44 int l_;
45 int bfn_;
46
47 public:
50 virtual ~CartesianIter();
51
53 virtual void start() =0;
55 virtual void next() =0;
57 virtual operator int() =0;
58
60 int n() { return ((l_>=0)?((((l_)+2)*((l_)+1))>>1):0); }
62 int a() { return a_; }
64 int b() { return b_; }
66 int c() { return c_; }
68 int l() { return l_; }
70 int l(int i) { return i ? (i==1 ? b_ : c_) : a_; }
73 int bfn() { return bfn_; }
74};
75
81 private:
82 int done_;
83 int l_;
84 int *axis_;
85
86 public:
90
92 virtual int bfn() =0;
93
95 void start();
97 void next();
99 operator int() { return !done_; }
100
102 int a();
104 int b();
106 int c();
108 int l() { return l_; }
110 int l(int i);
112 int axis(int i) { return axis_[i]; }
113};
114
115inline void
117{
118 if (l_==0)
119 done_ = 1;
120 else
121 done_ = 0;
122
123 for (int i=0; i<l_; i++)
124 axis_[i] = 0;
125}
126
127inline void
129{
130 for (int i=0; i<l_; i++) {
131 if (axis_[i] == 2)
132 axis_[i] = 0;
133 else {
134 axis_[i]++;
135 return;
136 }
137 }
138 done_ = 1;
139}
140
141inline int
143{
144 int i;
145 int r = 0;
146 for (i=0; i<l_; i++) if (axis_[i]==axis) r++;
147 return r;
148}
149
150inline int
152{
153 return l(0);
154}
155
156inline int
158{
159 return l(1);
160}
161
162inline int
164{
165 return l(2);
166}
167
171 private:
172 int done_;
173 int l_;
174 int e_[3];
175 int *axis_;
176
177 // the locations of the z's in the axis array
178 int *zloc_;
179 // the locations of the y's in the subarray after the z's are removed
180 int *yloc_;
181
182 int valid();
183
184 public:
188
190 virtual int bfn() =0;
191
194 void start(int a, int b, int c);
196 void next();
198 operator int() const { return !done_; }
199
201 int a() const { return e_[0]; }
203 int b() const { return e_[1]; }
205 int c() const { return e_[2]; }
207 int l() const { return l_; }
209 int l(int i) { return e_[i]; }
211 int axis(int i) { return axis_[i]; }
212};
213
214}
215
216#endif
217
218// Local Variables:
219// mode: c++
220// c-file-style: "ETS"
221// End:
CartesianIter gives the ordering of the Cartesian functions within a shell for the particular integra...
Definition: cartiter.h:39
virtual void start()=0
Start the iteration.
int n()
Returns the number of Cartesian functions.
Definition: cartiter.h:60
int c()
Returns the exponent of z.
Definition: cartiter.h:66
virtual void next()=0
Move to the next Cartesian function.
CartesianIter(int l)
Initialize an iterator for the given angular momentum.
int bfn()
Returns the number of the current basis function within the shell.
Definition: cartiter.h:73
int l()
Returns the angular momentum.
Definition: cartiter.h:68
int l(int i)
Returns a() if i==0, b() if i==1, and c() if i==2.
Definition: cartiter.h:70
int b()
Returns the exponent of y.
Definition: cartiter.h:64
int a()
Returns the exponent of x.
Definition: cartiter.h:62
RedundantCartesianIter objects loop through all possible combinations of a given number of axes.
Definition: cartiter.h:80
void next()
Move to the next combination of axes.
Definition: cartiter.h:128
int axis(int i)
Return the i'th axis.
Definition: cartiter.h:112
int l()
The angular momentum.
Definition: cartiter.h:108
int a()
The current exponent of x.
Definition: cartiter.h:151
void start()
Initialize the iterator.
Definition: cartiter.h:116
int b()
The current exponent of y.
Definition: cartiter.h:157
RedundantCartesianIter(int l)
Create a object for the given angular momentum.
int c()
The current exponent of z.
Definition: cartiter.h:163
virtual int bfn()=0
Return the current Cartesian basis function number.
Like RedundantCartesianIter, except a, b, and c are fixed to a given value.
Definition: cartiter.h:170
int axis(int i)
Return the i'th axis.
Definition: cartiter.h:211
int a() const
The current exponent of x.
Definition: cartiter.h:201
void start(int a, int b, int c)
Initialize the iterator.
int c() const
The current exponent of z.
Definition: cartiter.h:205
int b() const
The current exponent of y.
Definition: cartiter.h:203
RedundantCartesianSubIter(int l)
Create a object for the given angular momentum.
void next()
Move to the next combination of axes.
int l(int i)
Returns a() if i==0, b() if i==1, and c() if i==2.
Definition: cartiter.h:209
virtual int bfn()=0
Return the current Cartesian basis function number.
int l() const
The angular momentum.
Definition: cartiter.h:207

Generated at Thu Jul 21 2022 00:00:00 for MPQC 2.3.1 using the documentation package Doxygen 1.9.5.