MPQC 2.3.1
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
28#ifndef _chemistry_qc_basis_gpetite_h
29#define _chemistry_qc_basis_gpetite_h
30
31#ifdef __GNUC__
32#pragma interface
33#endif
34
35#include <stdexcept>
36
37#include <scconfig.h>
38#include <util/misc/scint.h>
39#include <chemistry/qc/basis/basis.h>
40#include <chemistry/qc/basis/petite.h>
41
42namespace sc {
43
48 public:
51 const Ref<GaussianBasisSet> bj,
52 const Ref<GaussianBasisSet> bk,
54 );
55 sc_int_least64_t offset(int i, int j, int k, int l) {
56 long ij = (i>j?(((i*long(i+1))>>1)+j):(((j*long(j+1))>>1)+i));
57 long kl = (k>l?(((k*long(k+1))>>1)+l):(((l*long(l+1))>>1)+k));
58 sc_int_least64_t
59 off = (ij>kl?(((ij*sc_int_least64_t(ij+1))>>1)+kl)
60 :(((kl*sc_int_least64_t(kl+1))>>1)+ij));
61 return off;
62 }
63};
64
70 long nk_, nl_;
71 public:
73 const Ref<GaussianBasisSet> bj,
74 const Ref<GaussianBasisSet> bk,
76 );
77 sc_int_least64_t offset(int i, int j, int k, int l) {
78 long ij = (i>j?(((i*long(i+1))>>1)+j):(((j*long(j+1))>>1)+i));
79 return k + nk_*sc_int_least64_t(l + nl_*ij);
80 }
81};
82
88 long nij_;
89 public:
91 const Ref<GaussianBasisSet> bj,
92 const Ref<GaussianBasisSet> bk,
94 );
95 sc_int_least64_t offset(int i, int j, int k, int l) {
96 long ij = (i>j?(((i*long(i+1))>>1)+j):(((j*long(j+1))>>1)+i));
97 long kl = (k>l?(((k*long(k+1))>>1)+l):(((l*long(l+1))>>1)+k));
98 return ij + nij_*sc_int_least64_t(kl);
99 }
100};
101
106 int ni_, nj_, nk_;
107 public:
109 const Ref<GaussianBasisSet> bj,
110 const Ref<GaussianBasisSet> bk,
111 const Ref<GaussianBasisSet> bl
112 );
113 sc_int_least64_t offset(int i, int j, int k, int l) {
114 return (i + ni_*sc_int_least64_t(j + nj_*long(k + nk_*l)));
115 }
116};
117
120class GenPetite4: public RefCount {
121protected:
122 bool c1_;
123 int ng_;
124 int **shell_map_i_;
125 int **shell_map_j_;
126 int **shell_map_k_;
127 int **shell_map_l_;
128 Ref<GaussianBasisSet> b1_, b2_, b3_, b4_;
129public:
131 const Ref<GaussianBasisSet> &b2,
132 const Ref<GaussianBasisSet> &b3,
133 const Ref<GaussianBasisSet> &b4);
134 ~GenPetite4();
135 virtual int in_p4(int i, int j, int k, int l) = 0;
136};
137
140extern Ref<GenPetite4>
141construct_gpetite(const Ref<GaussianBasisSet> &b1,
142 const Ref<GaussianBasisSet> &b2,
143 const Ref<GaussianBasisSet> &b3,
144 const Ref<GaussianBasisSet> &b4);
145
152template <class C4>
153class GPetite4: public GenPetite4 {
154 C4 c_;
155 public:
157 const Ref<GaussianBasisSet> &b2,
158 const Ref<GaussianBasisSet> &b3,
159 const Ref<GaussianBasisSet> &b4,
160 const C4& c);
161 ~GPetite4();
162 int in_p4(int i, int j, int k, int l);
163};
164
165template <class C4>
166inline int
167GPetite4<C4>::in_p4(int i, int j, int k, int l)
168{
169 if (c1_) return 1;
170
171 sc_int_least64_t ijkl = c_.offset(i,j,k,l);
172 int nijkl = 1;
173
174 for (int g=1; g < ng_; g++) {
175 int gi = shell_map_i_[i][g];
176 int gj = shell_map_j_[j][g];
177 int gk = shell_map_k_[k][g];
178 int gl = shell_map_l_[l][g];
179 sc_int_least64_t gijkl = c_.offset(gi,gj,gk,gl);
180
181 if (gijkl > ijkl) return 0;
182 else if (gijkl == ijkl) nijkl++;
183 }
184
185 return ng_/nijkl;
186}
187
188}
189
190
191
192#endif
193
194// Local Variables:
195// mode: c++
196// c-file-style: "ETS"
197// End:
This class provides a generalized four index petite list.
Definition gpetite.h:153
This class is an abstract base to a generalized four index petite list.
Definition gpetite.h:120
The base class for all reference counted objects.
Definition ref.h:194
A template class that maintains references counts.
Definition ref.h:332
If the shell loop structure has 8 fold symmetry, then this should be used as the template argument to...
Definition gpetite.h:47
If the shell loop structure has 2 fold symmetry between the first two indices and a 2 fold symmetry b...
Definition gpetite.h:87
If the shell loop structure has 2 fold symmetry between the first two indices, then this should be us...
Definition gpetite.h:69
If the shell loop structure has no symmetry, then this should be used as the template argument to GPe...
Definition gpetite.h:105

Generated at Fri May 31 2024 00:00:00 for MPQC 2.3.1 using the documentation package Doxygen 1.11.0.