MPQC 2.3.1
obint.h
1//
2// obint.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_obint_h
29#define _chemistry_qc_basis_obint_h
30
31#ifdef __GNUC__
32#pragma interface
33#endif
34
35#include <util/ref/ref.h>
36#include <util/state/state.h>
37#include <math/scmat/matrix.h>
38#include <math/scmat/elemop.h>
39
40#include <chemistry/qc/basis/gaussbas.h>
41#include <chemistry/qc/basis/dercent.h>
42
43namespace sc {
44
45class Integral;
46
47// //////////////////////////////////////////////////////////////////////////
48
49class EfieldDotVectorData: public RefCount
50{
51 public:
52 EfieldDotVectorData() {};
53 ~EfieldDotVectorData();
54
55 double position[3];
56 double vector[3];
57
58 void set_position(double*);
59 void set_vector(double*);
60};
61
62
63class DipoleData: public RefCount
64{
65 public:
66 double origin[3];
67
68 DipoleData(double *d) {origin[0]=d[0]; origin[1]=d[1]; origin[2]=d[2];}
69 DipoleData() {origin[0]=origin[1]=origin[2]=0.0;}
70 ~DipoleData();
71 void set_origin(double*);
72};
73
74
75class PointChargeData: public RefCount
76{
77 private:
78 int ncharges_;
79 const double *charges_;
80 const double *const*positions_;
81 double *alloced_charges_;
82 double **alloced_positions_;
83
84 public:
85 // If copy_data is 0, the passed positions and charges will
86 // be stored (but not freed).
87 PointChargeData(int ncharge,
88 const double *const*positions, const double *charges,
89 int copy_data = 0);
90 ~PointChargeData();
91
92 int ncharges() const { return ncharges_; }
93 const double *charges() const { return charges_; }
94 const double *const*positions() const { return positions_; }
95};
96
97
100class OneBodyInt : public RefCount {
101 protected:
102 // this is who created me
103 Integral *integral_;
104
107
108 double *buffer_;
109
110 OneBodyInt(Integral *integral,
111 const Ref<GaussianBasisSet>&b1,
112 const Ref<GaussianBasisSet>&b2 = 0);
113
114 public:
115 virtual ~OneBodyInt();
116
118 int nbasis() const;
119
121 int nbasis1() const;
123 int nbasis2() const;
124
126 int nshell() const;
127
129 int nshell1() const;
131 int nshell2() const;
132
135
140
142 const double * buffer() const;
143
146 virtual void compute_shell(int,int) = 0;
147
150 virtual void reinitialize();
151
154 virtual bool cloneable();
155
159
160 Integral *integral() const { return integral_; }
161};
162
163// //////////////////////////////////////////////////////////////////////////
164
167class OneBodyOneCenterInt : public RefCount {
168 protected:
169 // this is who created me
170 Integral *integral_;
171
173
174 double *buffer_;
175
176 OneBodyOneCenterInt(Integral *integral,
177 const Ref<GaussianBasisSet>&b1);
178
179 public:
180 virtual ~OneBodyOneCenterInt();
181
183 int nbasis() const;
184
186 int nbasis1() const;
187
189 int nshell() const;
190
192 int nshell1() const;
193
196
199
201 const double * buffer() const;
202
205 virtual void compute_shell(int) = 0;
206
209 virtual void reinitialize();
210
213 virtual bool cloneable();
214
218
219 Integral *integral() const { return integral_; }
220};
221
222// //////////////////////////////////////////////////////////////////////////
223
224class OneBodyOneCenterWrapper : public OneBodyOneCenterInt {
225 Ref<OneBodyInt> ob_;
226 int jsh_;
227 public:
228 OneBodyOneCenterWrapper(const Ref<OneBodyInt>& ob,
229 int sh2 = 0);
230 void compute_shell(int);
231};
232
233// //////////////////////////////////////////////////////////////////////////
234
235class ShellPairIter {
236 private:
237 const double * buf;
238 double scale_;
239
240 int e12;
241
242 int index;
243
244 int ioffset;
245 int joffset;
246
247 int iend;
248 int jend;
249
250 int icur;
251 int jcur;
252
253 public:
254 ShellPairIter();
255 ~ShellPairIter();
256
257 void init(const double * buffer, int ishell, int jshell,
258 int ioff, int joff, int nfunci, int nfuncj, int redund=0,
259 double scale=1.0);
260
261 void start() { icur=jcur=index=0; }
262 int ready() const { return (icur < iend); }
263
264 void next() {
265 if (jcur < ((e12)?(icur):((jend)-1))) {
266 index++;
267 jcur++;
268 return;
269 }
270
271 jcur=0;
272 icur++;
273
274 index = icur*jend;
275 }
276
277 int current_i() const { return icur; }
278 int current_j() const { return jcur; }
279
280 int i() const { return icur+ioffset; }
281 int j() const { return jcur+joffset; }
282
283 int nint() const { return iend*jend; }
284
285 double val() const { return buf[index]*scale_; }
286};
287
288// //////////////////////////////////////////////////////////////////////////
289
290class OneBodyIntIter : public RefCount {
291 protected:
292 Ref<OneBodyInt> obi; // help me obi wan
293 ShellPairIter spi;
294
295 int redund;
296
297 int istart;
298 int jstart;
299
300 int iend;
301 int jend;
302
303 int icur;
304 int jcur;
305
306 int ij;
307
308 public:
309 OneBodyIntIter();
310 OneBodyIntIter(const Ref<OneBodyInt>&);
311 virtual ~OneBodyIntIter();
312
313 virtual void start(int ist=0, int jst=0, int ien=0, int jen=0);
314 virtual void next();
315
316 int ready() const { return (icur < iend); }
317
318 int ishell() const { return icur; }
319 int jshell() const { return jcur; }
320
321 int ijshell() const { return ij; }
322
323 int redundant() const { return redund; }
324 void set_redundant(int i) { redund=i; }
325
326 virtual double scale() const;
327
328 Ref<OneBodyInt> one_body_int() { return obi; }
329
330 ShellPairIter& current_pair();
331
332 virtual bool cloneable();
333 virtual Ref<OneBodyIntIter> clone();
334};
335
336
337
338// //////////////////////////////////////////////////////////////////////////
339
340class OneBodyIntOp: public SCElementOp {
341 protected:
343
344 public:
345 OneBodyIntOp(const Ref<OneBodyInt>&);
346 OneBodyIntOp(const Ref<OneBodyIntIter>&);
347 virtual ~OneBodyIntOp();
348
351 void process_spec_ltri(SCMatrixLTriBlock*);
352 void process_spec_rectsub(SCMatrixRectSubBlock*);
353 void process_spec_ltrisub(SCMatrixLTriSubBlock*);
354
355 bool cloneable();
357
359};
360
361class OneBody3IntOp: public SCElementOp3 {
362 private:
364
365 public:
366 OneBody3IntOp(const Ref<OneBodyInt>&b);
367 OneBody3IntOp(const Ref<OneBodyIntIter>&);
368 virtual ~OneBody3IntOp();
369
370 void process(SCMatrixBlockIter&,
373 void process_spec_rect(SCMatrixRectBlock*,
376 void process_spec_ltri(SCMatrixLTriBlock*,
379
380 int has_side_effects();
381 int has_side_effects_in_arg1();
382 int has_side_effects_in_arg2();
383
384};
385
386// //////////////////////////////////////////////////////////////////////////
387
390class OneBodyDerivInt : public RefCount {
391 protected:
392 // this is who created me
393 Integral *integral_;
394
397
398 double *buffer_;
399
400 public:
401 OneBodyDerivInt(Integral *, const Ref<GaussianBasisSet>&b);
402 OneBodyDerivInt(Integral *,
403 const Ref<GaussianBasisSet>&b1,
404 const Ref<GaussianBasisSet>&b2);
405 virtual ~OneBodyDerivInt();
406
408 int nbasis() const;
410 int nbasis1() const;
412 int nbasis2() const;
413
415 int nshell() const;
417 int nshell1() const;
419 int nshell2() const;
420
427
430 const double * buffer() const;
431
434 virtual void compute_shell(int ish, int jsh, DerivCenters&) = 0;
437 virtual void compute_shell(int ish, int jsh, int center) = 0;
438};
439
440// //////////////////////////////////////////////////////////////////////////
441
444class OneBodyOneCenterDerivInt : public RefCount {
445 protected:
446 // this is who created me
447 Integral *integral_;
448
450
451 double *buffer_;
452
453 public:
454 OneBodyOneCenterDerivInt(Integral *, const Ref<GaussianBasisSet>&b);
455 virtual ~OneBodyOneCenterDerivInt();
456
458 int nbasis() const;
460 int nbasis1() const;
461
463 int nshell() const;
465 int nshell1() const;
466
471
474 const double * buffer() const;
475
478 virtual void compute_shell(int ish, DerivCenters&) = 0;
481 virtual void compute_shell(int ish, int center) = 0;
482};
483
484}
485
486#endif
487
488// Local Variables:
489// mode: c++
490// c-file-style: "ETS"
491// End:
DerivCenters keeps track the centers that derivatives are taken with respect to.
Definition dercent.h:41
The Integral abstract class acts as a factory to provide objects that compute one and two electron in...
Definition integral.h:58
int nshell2() const
Return the number of shells on center two.
Ref< GaussianBasisSet > basis2()
Return the basis set on center two.
Ref< GaussianBasisSet > basis1()
Return the basis set on center one.
int nshell1() const
Return the number of shells on center one.
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
virtual void compute_shell(int ish, int jsh, int center)=0
Compute the derivative integrals with respect to the given center and place the result in the buffer ...
int nbasis1() const
Return the number of basis functions on the center one.
int nbasis2() const
Return the number of basis functions on the center two.
int nshell() const
Return the number of shells on center one.
virtual void compute_shell(int ish, int jsh, DerivCenters &)=0
Compute the derivative integrals and place the result in the buffer returned by buffer().
const double * buffer() const
The computed shell integrals will be put in the buffer returned by this member.
int nbasis() const
Return the number of basis functions on center one.
int has_side_effects()
By default this returns nonzero.
Ref< SCElementOp > clone()
Returns a clone of this object.
bool cloneable()
Returns true if this SCElementOp supports the cloneable member.
void process(SCMatrixBlockIter &)
This is the fallback routine to process blocks and is called by process_spec members that are not ove...
void process_spec_rect(SCMatrixRectBlock *)
Matrices should call these members when the type of block is known.
virtual bool cloneable()
Return true if the clone member can be called.
int nshell2() const
Return the number of shells on the center two.
virtual Ref< OneBodyInt > clone()
Returns a clone of this.
virtual void compute_shell(int, int)=0
Computes the integrals between basis functions in the given shell pair.
int nbasis1() const
Returns the number of basis functions on the center one.
Ref< GaussianBasisSet > basis1()
Return the basis set on the center one.
int nbasis() const
Returns the number of basis functions on center one.
const double * buffer() const
Returns the buffer where the integrals are placed.
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
int nbasis2() const
Returns the number of basis functions on the center two.
Ref< GaussianBasisSet > basis2()
Return the basis set on the center two.
int nshell1() const
Return the number of shells on the center one.
int nshell() const
Return the number of shells on center one.
int nshell1() const
Return the number of shells on center one.
const double * buffer() const
The computed shell integrals will be put in the buffer returned by this member.
virtual void compute_shell(int ish, int center)=0
Compute the derivative integrals with respect to the given center and place the result in the buffer ...
int nbasis1() const
Return the number of basis functions on center one.
int nbasis() const
Return the number of basis functions on center one.
int nshell() const
Return the number of shells on center one.
Ref< GaussianBasisSet > basis1()
Return the basis set on center one.
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
virtual void compute_shell(int ish, DerivCenters &)=0
Compute the derivative integrals and place the result in the buffer returned by buffer().
int nshell1() const
Return the number of shells on the center one.
const double * buffer() const
Returns the buffer where the integrals are placed.
virtual bool cloneable()
Return true if the clone member can be called.
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
int nbasis1() const
Returns the number of basis functions on the center one.
Ref< GaussianBasisSet > basis1()
Return the basis set on the center one.
virtual Ref< OneBodyOneCenterInt > clone()
Returns a clone of this.
virtual void compute_shell(int)=0
Computes the integrals for basis functions on the given shell.
int nbasis() const
Returns the number of basis functions on center one.
int nshell() const
Return the number of shells on center one.
void compute_shell(int)
Computes the integrals for basis functions on the given shell.
A template class that maintains references counts.
Definition ref.h:332
The SCMatrixBlockIter class is used to described iterates that loop through the elements in a block.
Definition blkiter.h:50
The SCMatrixLTriBlock describes a triangular piece of a matrix.
Definition block.h:257
The SCMatrixLTriSubBlock describes a triangular subblock of a matrix.
Definition block.h:292
The SCMatrixRectBlock describes a rectangular piece of a matrix.
Definition block.h:187
The SCMatrixRectSubBlock describes a rectangular piece of a matrix.
Definition block.h:223
Definition obint.h:235

Generated at Mon Apr 28 2025 00:00:00 for MPQC 2.3.1 using the documentation package Doxygen 1.13.2.