MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
petite.h
1//
2// petite.h --- definition of the PetiteList 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_petite_h
29#define _chemistry_qc_basis_petite_h
30
31#include <mpqc_config.h>
32#include <iostream>
33#include <mpqc_config.h>
34
35#include <util/misc/scint.h>
36#include <util/ref/ref.h>
37#include <math/scmat/blocked.h>
38#include <math/scmat/offset.h>
39#include <chemistry/molecule/molecule.h>
40#include <chemistry/qc/basis/gaussbas.h>
41#include <chemistry/qc/basis/integral.h>
42
43// //////////////////////////////////////////////////////////////////////////
44
45namespace sc {
46
47inline sc_int_least64_t
48ij_offset64(sc_int_least64_t i, sc_int_least64_t j)
49{
50 return (i>j) ? (((i*(i+1)) >> 1) + j) : (((j*(j+1)) >> 1) + i);
51}
52
53inline sc_int_least64_t
54i_offset64(sc_int_least64_t i)
55{
56 return ((i*(i+1)) >> 1);
57}
58
59// //////////////////////////////////////////////////////////////////////////
60// These are helper functions for PetiteList and GenericPetiteList4
61
62int **compute_atom_map(const Ref<GaussianBasisSet> &);
63void delete_atom_map(int **atom_map, const Ref<GaussianBasisSet> &);
64
65int **compute_shell_map(int **atom_map, const Ref<GaussianBasisSet> &);
66void delete_shell_map(int **shell_map, const Ref<GaussianBasisSet> &);
67
68// //////////////////////////////////////////////////////////////////////////
69
71 int bfn;
72 double coef;
73
75 contribution(int b, double c);
77};
78
79struct SO {
80 int len;
81 int length;
82 contribution *cont;
83
84 SO();
85 SO(int);
86 ~SO();
87
88 SO& operator=(const SO&);
89
90 void set_length(int);
91 void reset_length(int);
92
93 // is this equal to so to within a sign
94 int equiv(const SO& so);
95};
96
97struct SO_block {
98 int len;
99 SO *so;
100
101 SO_block();
102 SO_block(int);
103 ~SO_block();
104
105 void set_length(int);
106 void reset_length(int);
107
108 int add(SO& s, int i);
109 void print(const char *title);
110};
111
112// //////////////////////////////////////////////////////////////////////////
113
120class PetiteList : public RefCount {
121 private:
122 int natom_;
123 int nshell_;
124 int ng_;
125 int nirrep_;
126 int nblocks_;
127 int c1_;
128
130 Ref<Integral> ints_;
131
132 char *p1_; // p1[n] is 1 if shell n is in the group P1
133 int **atom_map_; // atom_map[n][g] is the atom that symop g maps atom n
134 // into
135 int **shell_map_; // shell_map[n][g] is the shell that symop g maps shell n
136 // into
137 char *lamij_; // see Dupuis & King, IJQC 11,613,(1977)
138
139 int *nbf_in_ir_;
140
141 void init();
142
143 public:
145 ~PetiteList();
146
147 Ref<GaussianBasisSet> basis() { return gbs_; }
148 Ref<Integral> integral() { return ints_; }
149 Ref<PetiteList> clone() { return new PetiteList(gbs_, ints_); }
150
151 int nirrep() const { return nirrep_; }
152 int order() const { return ng_; }
153 int atom_map(int n, int g) const { return (c1_) ? n : atom_map_[n][g]; }
154 int shell_map(int n, int g) const { return (c1_) ? n : shell_map_[n][g]; }
155 int lambda(int ij) const { return (c1_) ? 1 : (int) lamij_[ij]; }
156 int lambda(int i, int j) const
157 { return (c1_) ? 1 : (int) lamij_[ij_offset(i,j)]; }
158
159 int in_p1(int n) const { return (c1_) ? 1 : (int) p1_[n]; }
160 int in_p2(int ij) const { return (c1_) ? 1 : (int) lamij_[ij]; }
162 int in_p2(int i, int j) const { return (c1_) ? 1 : (int) lamij_[ij_offset(i,j)]; }
163 int in_p4(int ij, int kl, int i, int j, int k, int l) const;
165 int in_p4(int i, int j, int k, int l) const;
166
167 int nfunction(int i) const
168 { return (c1_) ? gbs_->nbasis() : nbf_in_ir_[i]; }
169
170 int nblocks() const { return nblocks_; }
171
172 void print(std::ostream& =ExEnv::out0(), int verbose=1);
173
179
183
186
212
213 // given a skeleton matrix, form the symmetrized matrix in the SO basis
214 void symmetrize(const RefSymmSCMatrix& skel, const RefSymmSCMatrix& sym);
215
224
233};
234
235inline int
236PetiteList::in_p4(int ij, int kl, int i, int j, int k, int l) const
237{
238 if (c1_)
239 return 1;
240
241 sc_int_least64_t ijkl = i_offset64(ij)+kl;
242 int nijkl=1;
243
244 for (int g=1; g < ng_; g++) {
245 int gij = ij_offset(shell_map_[i][g],shell_map_[j][g]);
246 int gkl = ij_offset(shell_map_[k][g],shell_map_[l][g]);
247 sc_int_least64_t gijkl = ij_offset64(gij,gkl);
248
249 if (gijkl > ijkl)
250 return 0;
251 else if (gijkl == ijkl)
252 nijkl++;
253 }
254
255 return ng_/nijkl;
256}
257
258inline int
259PetiteList::in_p4(int i, int j, int k, int l) const
260{
261 if (c1_)
262 return 1;
263
264 int ij = ij_offset(i,j);
265 int kl = ij_offset(k,l);
266 sc_int_least64_t ijkl = ij_offset64(ij,kl);
267 int nijkl=1;
268
269 for (int g=1; g < ng_; g++) {
270 int gij = ij_offset(shell_map_[i][g],shell_map_[j][g]);
271 int gkl = ij_offset(shell_map_[k][g],shell_map_[l][g]);
272 sc_int_least64_t gijkl = ij_offset64(gij,gkl);
273
274 if (gijkl > ijkl)
275 return 0;
276 else if (gijkl == ijkl)
277 nijkl++;
278 }
279
280 return ng_/nijkl;
281}
282
283}
284
285
286
287#endif
288
289// Local Variables:
290// mode: c++
291// c-file-style: "ETS"
292// End:
static std::ostream & out0()
Return an ostream that writes from node 0.
PetiteList is a petite list (see Dupuis & King, IJQC 11,613,(1977) ) that can be used for constructin...
Definition petite.h:120
int in_p2(int i, int j) const
Same as previous, except for it takes i and j separately.
Definition petite.h:162
RefSCMatrix r(int g)
return the basis function rotation matrix R(g)
RefSCMatrix aotoso()
RefSymmSCMatrix to_AO_basis(const RefSymmSCMatrix &O_so)
converts an operator matrix from SO to AO basis.
RefSCMatrix sotoao()
RefSymmSCMatrix to_SO_basis(const RefSymmSCMatrix &O_ao)
converts an operator matrix from AO to SO basis.
RefSCDimension SO_basisdim()
blocked SO dimension (number of blocks = order of the point group, each subdimension has 1 block)
RefSCDimension AO_basisdim()
blocked AO dimension (if symmetry = c1, equivalent to SO_basisdim(); otherwise number of blocks = 1,...
RefSCMatrix evecs_to_SO_basis(const RefSCMatrix &)
converts a set of functions (vectors) from AO to SO basis.
RefSCMatrix evecs_to_AO_basis(const RefSCMatrix &)
converts a set of functions (vectors) from SO to AO basis.
SO_block * aotoso_info()
The base class for all reference counted objects.
Definition ref.h:192
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition dim.h:152
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
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
Definition petite.h:97
Definition petite.h:79
Definition petite.h:70

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