MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
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
31namespace sc {
32
36 protected:
37 int a_;
38 int b_;
39 int c_;
40 int l_;
41 int bfn_;
42
43 public:
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:
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
117inline 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
129inline 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
143inline 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
152inline int
154{
155 return l(0);
156}
157
158inline int
160{
161 return l(1);
162}
163
164inline 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:
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:
CartesianIter gives the ordering of the Cartesian functions within a shell for the particular integra...
Definition cartiter.h:35
virtual void start()=0
Start the iteration.
int n()
Returns the number of Cartesian functions.
Definition cartiter.h:56
int c()
Returns the exponent of z.
Definition cartiter.h:62
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:69
int l()
Returns the angular momentum.
Definition cartiter.h:64
int l(int i)
Returns a() if i==0, b() if i==1, and c() if i==2.
Definition cartiter.h:66
int b()
Returns the exponent of y.
Definition cartiter.h:60
int a()
Returns the exponent of x.
Definition cartiter.h:58
RedundantCartesianIter objects loop through all possible combinations of a given number of axes.
Definition cartiter.h:82
void next()
Move to the next combination of axes.
Definition cartiter.h:130
int axis(int i)
Return the i'th axis.
Definition cartiter.h:114
int l()
The angular momentum.
Definition cartiter.h:110
int a()
The current exponent of x.
Definition cartiter.h:153
void start()
Initialize the iterator.
Definition cartiter.h:118
int b()
The current exponent of y.
Definition cartiter.h:159
RedundantCartesianIter(int l)
Create a object for the given angular momentum.
int c()
The current exponent of z.
Definition cartiter.h:165
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:172
int axis(int i)
Return the i'th axis.
Definition cartiter.h:214
int a() const
The current exponent of x.
Definition cartiter.h:204
int c() const
The current exponent of z.
Definition cartiter.h:208
int b() const
The current exponent of y.
Definition cartiter.h:206
virtual int bfn() const =0
Return the current Cartesian basis function number.
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:212
virtual void start(int a, int b, int c)
Initialize the iterator.
int l() const
The angular momentum.
Definition cartiter.h:210
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:29 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.