MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
nbint.h
1//
2// tbint.h
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_tbint_h
29#define _chemistry_qc_basis_tbint_h
30
31#include <util/ref/ref.h>
32#include <util/group/message.h>
33#include <util/container/stdarray.h>
34#include <chemistry/qc/basis/gaussbas.h>
35#include <chemistry/qc/basis/dercent.h>
36#include <chemistry/qc/basis/operator.h>
37#include <chemistry/qc/basis/obint.h>
38
39namespace sc {
40
41// //////////////////////////////////////////////////////////////////////////
42
43class Integral;
44
48struct TwoBodyIntShape {
49 enum value {
55 1_O_2 };
56};
57
61class NBodyIntEval : public RefCount {
62
63 private:
64 double *log2_to_double_;
65
66 protected:
67 // this is who created me
68 Integral *integral_;
69
70 std::vector< Ref<GaussianBasisSet> > bs_;
71
72 double *buffer_;
73
74 int redundant_;
75
76 NBodyInt(Integral *integral,
77 const std::vector< Ref<GaussianBasisSet> >& bs);
78 public:
79 virtual ~NBodyInt();
80
82 Ref<GaussianBasisSet> basis(size_t center = 0) { return bs_.at(center); }
83
87 virtual NBodyOperSet::type type() const =0;
89 virtual const Ref<OperSetDescr>& descr() const =0;
90
95 virtual const double * buffer(NBodyOper::type type = NBodyOper::coulomb) const;
96
100 virtual void compute_shell(int,int,int,int) = 0;
101
108 std::pair<std::map<TwoBodyOper::type,const double*>,std::array<unsigned long,4> >
109 compute_shell_arrays(int,int,int,int);
110
114 virtual int log2_shell_bound(int= -1,int= -1,int= -1,int= -1) = 0;
115
119 double shell_bound(int= -1,int= -1,int= -1,int= -1);
120
123 virtual int redundant() const { return redundant_; }
125 virtual void set_redundant(int i) { redundant_ = i; }
126
128 virtual void set_integral_storage(size_t storage);
129
132 virtual bool cloneable() const;
133
137
139 Integral *integral() const { return integral_; }
140
141};
142
143
144class ShellQuartetIter {
145 protected:
146 const double * buf;
147 double scale_;
148
149 int redund_;
150
151 int e12;
152 int e34;
153 int e13e24;
154
155 int index;
156
157 int istart;
158 int jstart;
159 int kstart;
160 int lstart;
161
162 int iend;
163 int jend;
164 int kend;
165 int lend;
166
167 int icur;
168 int jcur;
169 int kcur;
170 int lcur;
171
172 int i_;
173 int j_;
174 int k_;
175 int l_;
176
177 public:
178 ShellQuartetIter();
179 virtual ~ShellQuartetIter();
180
181 virtual void init(const double *,
182 int, int, int, int,
183 int, int, int, int,
184 int, int, int, int,
185 double, int);
186
187 virtual void start();
188 virtual void next();
189
190 int ready() const { return icur < iend; }
191
192 int i() const { return i_; }
193 int j() const { return j_; }
194 int k() const { return k_; }
195 int l() const { return l_; }
196
197 int nint() const { return iend*jend*kend*lend; }
198
199 double val() const { return buf[index]*scale_; }
200};
201
203 protected:
204 Ref<TwoBodyInt> tbi;
206
207 int iend;
208
209 int icur;
210 int jcur;
211 int kcur;
212 int lcur;
213
214 public:
217
218 virtual ~TwoBodyIntIter();
219
220 virtual void start();
221 virtual void next();
222
223 int ready() const { return (icur < iend); }
224
225 int ishell() const { return icur; }
226 int jshell() const { return jcur; }
227 int kshell() const { return kcur; }
228 int lshell() const { return lcur; }
229
230 virtual double scale() const;
231
232 ShellQuartetIter& current_quartet();
233};
234
235// //////////////////////////////////////////////////////////////////////////
236
237class TwoBodyTwoCenterIntIter : public RefCount {
238 protected:
239 Ref<TwoBodyTwoCenterInt> tbi; // help me obi wan
241 ShellPairIter spi;
242
243 int redund;
244
245 int istart;
246 int jstart;
247
248 int iend;
249 int jend;
250
251 int icur;
252 int jcur;
253
254 int ij;
255
256 public:
260 virtual ~TwoBodyTwoCenterIntIter();
261
262 virtual void start(int ist=0, int jst=0, int ien=0, int jen=0);
263 virtual void next();
264
265 int ready() const { return (icur < iend); }
266
267 int ishell() const { return icur; }
268 int jshell() const { return jcur; }
269
270 int ijshell() const { return ij; }
271
272 int redundant() const { return redund; }
273 void set_redundant(int i) { redund=i; }
274
275 virtual double scale() const;
276
277 Ref<TwoBodyTwoCenterInt> two_body_int() { return tbi; }
278
279 ShellPairIter& current_pair();
280
281 virtual bool cloneable() const;
282 virtual Ref<TwoBodyTwoCenterIntIter> clone();
283};
284
286
288class TwoBodyTwoCenterIntOp: public SCElementOp {
289 protected:
290 Ref<TwoBodyTwoCenterIntIter> iter;
291
292 public:
293 TwoBodyTwoCenterIntOp(const Ref<TwoBodyTwoCenterInt>&);
294 TwoBodyTwoCenterIntOp(const Ref<TwoBodyTwoCenterIntIter>&);
295 virtual ~TwoBodyTwoCenterIntOp();
296
299 void process_spec_ltri(SCMatrixLTriBlock*);
300 void process_spec_rectsub(SCMatrixRectSubBlock*);
301 void process_spec_ltrisub(SCMatrixLTriSubBlock*);
302
303 bool cloneable() const;
305
307};
308
309
310}
311
312#endif
313
314// Local Variables:
315// mode: c++
316// c-file-style: "ETS"
317// End:
The Integral abstract class acts as a factory to provide objects that compute one and two electron in...
Definition integral.h:111
This is an abstract base type for classes that compute integrals of general N-body operators describe...
Definition nbint.h:61
virtual Ref< TwoBodyInt > clone()
Returns a clone of this.
virtual const Ref< OperSetDescr > & descr() const =0
return the operator set descriptor
virtual int log2_shell_bound(int=-1, int=-1, int=-1, int=-1)=0
Return log base 2 of the maximum magnitude of any integral in a shell block obtained from compute_she...
virtual NBodyOperSet::type type() const =0
Returns the type of the operator set that this object computes.
virtual void set_integral_storage(size_t storage)
This storage is used to cache computed integrals.
std::pair< std::map< TwoBodyOper::type, const double * >, std::array< unsigned long, 4 > > compute_shell_arrays(int, int, int, int)
Given four shell indices, supported two body integral types are computed and returned.
virtual const double * buffer(NBodyOper::type type=NBodyOper::coulomb) const
The computed shell integrals will be put in the buffer returned by this member.
virtual void set_redundant(int i)
See redundant().
Definition nbint.h:125
virtual void compute_shell(int, int, int, int)=0
Given four shell indices, integrals will be computed and placed in the buffer.
Ref< GaussianBasisSet > basis(size_t center=0)
Return the number of basis functions on center center.
Definition nbint.h:82
virtual int redundant() const
If redundant is true, then keep redundant integrals in the buffer.
Definition nbint.h:123
double shell_bound(int=-1, int=-1, int=-1, int=-1)
Return the maximum magnitude of any integral in a shell block obtained from compute_shell.
Integral * integral() const
Return the integral factory that was used to create this object.
Definition nbint.h:139
virtual bool cloneable() const
Return true if the clone member can be called.
Definition nbint.h:202
The base class for all reference counted objects.
Definition ref.h:192
A template class that maintains references counts.
Definition ref.h:361
The SCMatrixBlockIter class is used to described iterates that loop through the elements in a block.
Definition blkiter.h:46
The SCMatrixLTriBlock describes a triangular piece of a matrix.
Definition block.h:253
The SCMatrixLTriSubBlock describes a triangular subblock of a matrix.
Definition block.h:288
The SCMatrixRectBlock describes a rectangular piece of a matrix.
Definition block.h:183
The SCMatrixRectSubBlock describes a rectangular piece of a matrix.
Definition block.h:219
Definition obint.h:195
Definition tbint.h:407
Definition tbint.h:465
Definition tbint.h:500
void process_spec_rect(SCMatrixRectBlock *)
Matrices should call these members when the type of block is known.
void process(SCMatrixBlockIter &)
This is the fallback routine to process blocks and is called by process_spec members that are not ove...
Ref< SCElementOp > clone()
Returns a clone of this object.
bool cloneable() const
Returns true if this SCElementOp supports the clone() member.
int has_side_effects()
By default this returns nonzero.
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
value
Definition nbint.h:49
@ _O_22
4-center integral in chemistry convention
Definition nbint.h:51
@ _O_2
3-center integral
Definition nbint.h:53
type
types of known two-body operators
Definition operator.h:318
@ eri
two-body Coulomb
Definition operator.h:319

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