MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
gpetite.h
1//
2// gpetite.h --- definition of the generalized petite list class
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Edward Seidl <seidl@janed.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#ifndef _chemistry_qc_basis_gpetite_h
28#define _chemistry_qc_basis_gpetite_h
29
30#include <stdexcept>
31
32#include <mpqc_config.h>
33#include <util/misc/scint.h>
34#include <chemistry/qc/basis/basis.h>
35#include <chemistry/qc/basis/petite.h>
36
37namespace sc {
38
43 public:
46 const Ref<GaussianBasisSet>& bj,
47 const Ref<GaussianBasisSet>& bk,
48 const Ref<GaussianBasisSet>& bl
49 );
50 sc_int_least64_t offset(int i, int j, int k, int l) {
51 long ij = (i>j?(((i*long(i+1))>>1)+j):(((j*long(j+1))>>1)+i));
52 long kl = (k>l?(((k*long(k+1))>>1)+l):(((l*long(l+1))>>1)+k));
53 sc_int_least64_t
54 off = (ij>kl?(((ij*sc_int_least64_t(ij+1))>>1)+kl)
55 :(((kl*sc_int_least64_t(kl+1))>>1)+ij));
56 return off;
57 }
58};
59
65 long nk_, nl_;
66 public:
68 const Ref<GaussianBasisSet>& bj,
69 const Ref<GaussianBasisSet>& bk,
70 const Ref<GaussianBasisSet>& bl
71 );
72 sc_int_least64_t offset(int i, int j, int k, int l) {
73 long ij = (i>j?(((i*long(i+1))>>1)+j):(((j*long(j+1))>>1)+i));
74 return k + nk_*sc_int_least64_t(l + nl_*ij);
75 }
76};
77
83 long nj_, nkl_;
84 public:
86 const Ref<GaussianBasisSet>& bj,
87 const Ref<GaussianBasisSet>& bk,
88 const Ref<GaussianBasisSet>& bl
89 );
90 sc_int_least64_t offset(int i, int j, int k, int l) {
91 long kl = (k>l?(((k*long(k+1))>>1)+l):(((l*long(l+1))>>1)+k));
92 return kl + nkl_*sc_int_least64_t(j + nj_*i);
93 }
94};
95
101 long nij_;
102 public:
104 const Ref<GaussianBasisSet>& bj,
105 const Ref<GaussianBasisSet>& bk,
106 const Ref<GaussianBasisSet>& bl
107 );
108 sc_int_least64_t offset(int i, int j, int k, int l) {
109 long ij = (i>j?(((i*long(i+1))>>1)+j):(((j*long(j+1))>>1)+i));
110 long kl = (k>l?(((k*long(k+1))>>1)+l):(((l*long(l+1))>>1)+k));
111 return ij + nij_*sc_int_least64_t(kl);
112 }
113};
114
119 long nj_;
120 public:
122 const Ref<GaussianBasisSet>& bj,
123 const Ref<GaussianBasisSet>& bk,
124 const Ref<GaussianBasisSet>& bl
125 );
126 sc_int_least64_t offset(int i, int j, int k, int l) {
127 long ij = i*nj_ + j;
128 long kl = k*nj_ + l;
129 sc_int_least64_t
130 off = (ij>kl?(((ij*sc_int_least64_t(ij+1))>>1)+kl)
131 :(((kl*sc_int_least64_t(kl+1))>>1)+ij));
132 return off;
133 }
134};
135
140 int ni_, nj_, nk_;
141 public:
143 const Ref<GaussianBasisSet>& bj,
144 const Ref<GaussianBasisSet>& bk,
145 const Ref<GaussianBasisSet>& bl
146 );
147 sc_int_least64_t offset(int i, int j, int k, int l) {
148 return (i + ni_*sc_int_least64_t(j + nj_*long(k + nk_*l)));
149 }
150};
151
154class GPetiteList4: public RefCount {
155 bool c1_;
156 int ng_;
157protected:
158 int **shell_map_i_;
159 int **shell_map_j_;
160 int **shell_map_k_;
161 int **shell_map_l_;
162 Ref<GaussianBasisSet> b1_, b2_, b3_, b4_;
163 bool c1() const { return c1_; }
164 int order() const { return ng_; }
165public:
167 const Ref<GaussianBasisSet> &b2,
168 const Ref<GaussianBasisSet> &b3,
169 const Ref<GaussianBasisSet> &b4);
171 const Ref<GaussianBasisSet>& basis1() const { return b1_; }
172 const Ref<GaussianBasisSet>& basis2() const { return b2_; }
173 const Ref<GaussianBasisSet>& basis3() const { return b3_; }
174 const Ref<GaussianBasisSet>& basis4() const { return b4_; }
175 const Ref<PointGroup>& point_group() const { return b1_->molecule()->point_group(); }
176 virtual int in(int i, int j, int k, int l) = 0;
177};
178
185template <class C4>
187 C4 c_;
188 public:
190 const Ref<GaussianBasisSet> &b2,
191 const Ref<GaussianBasisSet> &b3,
192 const Ref<GaussianBasisSet> &b4) : GPetiteList4(b1,b2,b3,b4),
193 c_(b1,b2,b3,b4) {}
195 int in(int i, int j, int k, int l);
196};
197
198template <class C4>
199inline int
200GenericPetiteList4<C4>::in(int i, int j, int k, int l)
201{
202 if (c1()) return 1;
203
204 sc_int_least64_t ijkl = c_.offset(i,j,k,l);
205 int nijkl = 1;
206
207 const int ng = order();
208 for (int g=1; g < ng; g++) {
209 int gi = shell_map_i_[i][g];
210 int gj = shell_map_j_[j][g];
211 int gk = shell_map_k_[k][g];
212 int gl = shell_map_l_[l][g];
213 sc_int_least64_t gijkl = c_.offset(gi,gj,gk,gl);
214
215 if (gijkl > ijkl) return 0;
216 else if (gijkl == ijkl) nijkl++;
217 }
218
219 return ng/nijkl;
220}
221
224 public:
226 const Ref<GaussianBasisSet>& bj
227 );
228 sc_int_least64_t offset(int i, int j) {
229 const long ij = (i>j?(((i*long(i+1))>>1)+j):(((j*long(j+1))>>1)+i));
230 return ij;
231 }
232};
233
237 int ni_;
238 public:
240 const Ref<GaussianBasisSet>& bj
241 );
242 sc_int_least64_t offset(int i, int j) {
243 return (i + ni_*sc_int_least64_t(j));
244 }
245};
246
249class GPetiteList2: public RefCount {
250 bool c1_;
251 int ng_;
252protected:
253 int **shell_map_i_;
254 int **shell_map_j_;
255 Ref<GaussianBasisSet> b1_, b2_;
256 bool c1() const { return c1_; }
257 int order() const { return ng_; }
258public:
260 const Ref<GaussianBasisSet> &b2);
262 const Ref<GaussianBasisSet>& basis1() const { return b1_; }
263 const Ref<GaussianBasisSet>& basis2() const { return b2_; }
264 const Ref<PointGroup>& point_group() const { return b1_->molecule()->point_group(); }
265 virtual int in(int i, int j) = 0;
266};
267
273template <class C2>
275 C2 c_;
276 public:
278 const Ref<GaussianBasisSet> &b2) : GPetiteList2(b1,b2),
279 c_(b1,b2) {}
281 int in(int i, int j);
282 void symmetrize(const RefSymmSCMatrix& skel, const RefSymmSCMatrix& sym) const;
283 void symmetrize(const RefSCMatrix& skel, const RefSCMatrix& sym) const;
284};
285
286template <class C2>
287inline int
288GenericPetiteList2<C2>::in(int i, int j)
289{
290 if (c1()) return 1;
291
292 sc_int_least64_t ij = c_.offset(i,j);
293 int nij = 1;
294
295 const int ng = order();
296 for (int g=1; g < ng; g++) {
297 int gi = shell_map_i_[i][g];
298 int gj = shell_map_j_[j][g];
299 const sc_int_least64_t gij = c_.offset(gi,gj);
300
301 if (gij > ij) return 0;
302 else if (gij == ij) nij++;
303 }
304
305 return ng/nij;
306}
307
311 static Ref<GPetiteList2> plist2(const Ref<GaussianBasisSet> &b1,
312 const Ref<GaussianBasisSet> &b2);
313 static Ref<GPetiteList4> plist4(const Ref<GaussianBasisSet> &b1,
314 const Ref<GaussianBasisSet> &b2,
315 const Ref<GaussianBasisSet> &b3,
316 const Ref<GaussianBasisSet> &b4);
317};
318
320void symmetrize(const Ref<GPetiteList2>& plist2, const Ref<Integral>& integral, const RefSymmSCMatrix& skel, const RefSymmSCMatrix& sym);
322void symmetrize(const Ref<GPetiteList2>& plist2, const Ref<Integral>& integral, const RefSCMatrix& skel, const RefSCMatrix& sym);
323}
324
325#endif
326
327// Local Variables:
328// mode: c++
329// c-file-style: "ETS"
330// End:
This class is an abstract base to a generalized 2-index petite list.
Definition gpetite.h:249
This class is an abstract base to a generalized four index petite list.
Definition gpetite.h:154
This class provides a generalized 2-index petite list.
Definition gpetite.h:274
This class provides a generalized four index petite list.
Definition gpetite.h:186
The base class for all reference counted objects.
Definition ref.h:192
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition matrix.h:265
A template class that maintains references counts.
Definition ref.h:361
Can be used as a template argument to GenericPetiteList2.
Definition gpetite.h:223
If the shell loop structure has 8 fold symmetry, then this should be used as the template argument to...
Definition gpetite.h:42
If the shell loop structure has 2 fold symmetry between the first two indices and a 2 fold symmetry b...
Definition gpetite.h:100
If the shell loop structure has 2 fold symmetry between the first two indices, then this should be us...
Definition gpetite.h:64
Can be used as a template argument to GenericPetiteList2.
Definition gpetite.h:236
If the shell loop structure has 2 fold symmetry between the bra and the ket then this should be used ...
Definition gpetite.h:118
If the shell loop structure has 2 fold symmetry between the last two indices, then this should be use...
Definition gpetite.h:82
If the shell loop structure has no symmetry, then this should be used as the template argument to Gen...
Definition gpetite.h:139
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
void symmetrize(const Ref< GPetiteList2 > &plist2, const Ref< Integral > &integral, const RefSymmSCMatrix &skel, const RefSymmSCMatrix &sym)
Uses plist2 to convert the "skeleton" matrix into the full matrix. Only applicable when the two basis...
Produces generalized 2 and 4-index petite list objects.
Definition gpetite.h:310

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