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 
43 namespace sc {
44 
45 class Integral;
46 
47 // //////////////////////////////////////////////////////////////////////////
48 
50 {
51  public:
54 
55  double position[3];
56  double vector[3];
57 
58  void set_position(double*);
59  void set_vector(double*);
60 };
61 
62 
63 class 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 
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 
100 class 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 
158  virtual Ref<OneBodyInt> clone();
159 
160  Integral *integral() const { return integral_; }
161 };
162 
163 // //////////////////////////////////////////////////////////////////////////
164 
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 
225  Ref<OneBodyInt> ob_;
226  int jsh_;
227  public:
229  int sh2 = 0);
230  void compute_shell(int);
231 };
232 
233 // //////////////////////////////////////////////////////////////////////////
234 
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 
290 class 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();
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 
340 class OneBodyIntOp: public SCElementOp {
341  protected:
342  Ref<OneBodyIntIter> iter;
343 
344  public:
347  virtual ~OneBodyIntOp();
348 
349  void process(SCMatrixBlockIter&);
351  void process_spec_ltri(SCMatrixLTriBlock*);
352  void process_spec_rectsub(SCMatrixRectSubBlock*);
353  void process_spec_ltrisub(SCMatrixLTriSubBlock*);
354 
355  bool cloneable();
357 
358  int has_side_effects();
359 };
360 
362  private:
363  Ref<OneBodyIntIter> iter;
364 
365  public:
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 
390 class OneBodyDerivInt : public RefCount {
391  protected:
392  // this is who created me
393  Integral *integral_;
394 
397 
398  double *buffer_;
399 
400  public:
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 
445  protected:
446  // this is who created me
447  Integral *integral_;
448 
450 
451  double *buffer_;
452 
453  public:
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:
const double * buffer() const
The computed shell integrals will be put in the buffer returned by this member.
Ref< GaussianBasisSet > basis1()
Return the basis set on the center one.
virtual Ref< OneBodyOneCenterInt > clone()
Returns a clone of this.
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
int nbasis1() const
Return the number of basis functions on the center one.
const double * buffer() const
Returns the buffer where the integrals are placed.
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
OneBodyInt is an abstract base class for objects that compute integrals between two basis functions...
Definition: obint.h:100
virtual void compute_shell(int, int)=0
Computes the integrals between basis functions in the given shell pair.
int nbasis2() const
Return the number of basis functions on the center two.
int nbasis1() const
Returns the number of basis functions on the center one.
Ref< GaussianBasisSet > basis1()
Return the basis set on center one.
Definition: obint.h:290
virtual void compute_shell(int ish, int jsh, DerivCenters &)=0
Compute the derivative integrals and place the result in the buffer returned by buffer().
Definition: obint.h:235
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 the center two.
Ref< GaussianBasisSet > basis2()
Return the basis set on the center two.
Definition: obint.h:63
int nshell1() const
Return the number of shells on the center one.
Ref< GaussianBasisSet > basis2()
Return the basis set on center two.
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
Definition: obint.h:75
void compute_shell(int)
Computes the integrals for basis functions on the given shell.
int nbasis1() const
Returns the number of basis functions on the center one.
OneBodyOneCenterInt is an abstract base class for objects that compute integrals between two basis fu...
Definition: obint.h:167
virtual bool cloneable()
Return true if the clone member can be called.
int nshell() const
Return the number of shells on center one.
The base class for all reference counted objects.
Definition: ref.h:194
virtual void compute_shell(int ish, DerivCenters &)=0
Compute the derivative integrals and place the result in the buffer returned by buffer().
OneBodyDerivInt is an abstract base class for objects that compute one body derivative integrals...
Definition: obint.h:390
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:224
virtual Ref< OneBodyInt > clone()
Returns a clone of this.
const double * buffer() const
The computed shell integrals will be put in the buffer returned by this member.
Definition: obint.h:49
Definition: mpqcin.h:13
Definition: obint.h:340
int nbasis2() const
Returns the number of basis functions on the center two.
int has_side_effects()
By default this returns nonzero.
DerivCenters keeps track the centers that derivatives are taken with respect to.
Definition: dercent.h:41
int nbasis() const
Returns the number of basis functions on center one.
virtual void compute_shell(int)=0
Computes the integrals for basis functions on the given shell.
void process(SCMatrixBlockIter &)
This is the fallback routine to process blocks and is called by process_spec members that are not ove...
OneBodyOneCenterDerivInt is an abstract base class for objects that compute one body derivative integ...
Definition: obint.h:444
Ref< SCElementOp > clone()
Returns a clone of this object.
int nshell1() const
Return the number of shells on center one.
The SCMatrixLTriBlock describes a triangular piece of a matrix.
Definition: block.h:257
int nbasis() const
Return the number of basis functions on center one.
Definition: obint.h:361
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
bool cloneable()
Returns true if this SCElementOp supports the cloneable member.
Ref< GaussianBasisSet > basis()
Return the basis set on center one.
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
The SCElementOp3 class is very similar to the SCElementOp class except that a triplet of blocks is tr...
Definition: elemop.h:147
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 nbasis1() const
Return the number of basis functions on center one.
The SCMatrixLTriSubBlock describes a triangular subblock of a matrix.
Definition: block.h:292
int nbasis() const
Returns the number of basis functions on center one.
int nshell() const
Return the number of shells on center one.
int nshell1() const
Return the number of shells on the center one.
int nshell2() const
Return the number of shells on center two.
int nshell() const
Return the number of shells on center one.
int nbasis() const
Return the number of basis functions on center one.
Ref< GaussianBasisSet > basis1()
Return the basis set on center one.
Objects of class SCElementOp are used to perform operations on the elements of matrices.
Definition: elemop.h:60
Ref< GaussianBasisSet > basis1()
Return the basis set on the center one.
int nshell() const
Return the number of shells on center one.
The SCMatrixBlockIter class is used to described iterates that loop through the elements in a block...
Definition: blkiter.h:50
int nshell1() const
Return the number of shells on center one.
const double * buffer() const
Returns the buffer where the integrals are placed.

Generated at Fri Feb 16 2018 01:48:56 for MPQC 2.3.1 using the documentation package Doxygen 1.8.14.