MPQC  3.0.0-alpha
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 #include <util/ref/ref.h>
32 #include <util/state/state.h>
33 #include <util/container/stdarray.h>
34 #include <math/scmat/matrix.h>
35 #include <math/scmat/elemop.h>
36 
37 #include <chemistry/qc/basis/gaussbas.h>
38 #include <chemistry/qc/basis/dercent.h>
39 #include <chemistry/qc/basis/intparams.h>
40 
41 namespace sc {
42 
43 class Integral;
44 
45 // //////////////////////////////////////////////////////////////////////////
46 
49 class OneBodyInt : public RefCount {
50  protected:
51  // this is who created me
52  Integral *integral_;
53 
56 
57  double *buffer_;
58 
59  OneBodyInt(Integral *integral,
60  const Ref<GaussianBasisSet>&b1,
61  const Ref<GaussianBasisSet>&b2 = 0);
62 
63  public:
64  virtual ~OneBodyInt();
65 
67  int nbasis() const;
68 
70  int nbasis1() const;
72  int nbasis2() const;
73 
75  int nshell() const;
76 
78  int nshell1() const;
80  int nshell2() const;
81 
86  Ref<GaussianBasisSet> basis(size_t c) const;
87 
92 
94  const double * buffer() const;
95 
98  virtual void compute_shell(int,int) = 0;
99 
103  std::pair<const double *, std::array<unsigned long, 2> > compute_shell_array(int,int);
104 
107  virtual void reinitialize();
108 
111  virtual bool cloneable() const;
112 
115  virtual Ref<OneBodyInt> clone();
116 
117  Integral *integral() const { return integral_; }
118 };
119 
120 // //////////////////////////////////////////////////////////////////////////
121 
125  protected:
126  // this is who created me
127  Integral *integral_;
128 
130 
131  double *buffer_;
132 
133  OneBodyOneCenterInt(Integral *integral,
134  const Ref<GaussianBasisSet>&b1);
135 
136  public:
137  virtual ~OneBodyOneCenterInt();
138 
140  int nbasis() const;
141 
143  int nbasis1() const;
144 
146  int nshell() const;
147 
149  int nshell1() const;
150 
155  Ref<GaussianBasisSet> basis(size_t c) const;
156 
159 
161  const double * buffer() const;
162 
165  virtual void compute_shell(int) = 0;
166 
169  virtual void reinitialize();
170 
173  virtual bool cloneable() const;
174 
178 
179  Integral *integral() const { return integral_; }
180 };
181 
182 // //////////////////////////////////////////////////////////////////////////
183 
185  Ref<OneBodyInt> ob_;
186  int jsh_;
187  public:
189  int sh2 = 0);
190  void compute_shell(int);
191 };
192 
193 // //////////////////////////////////////////////////////////////////////////
194 
196  private:
197  const double * buf;
198  double scale_;
199 
200  int e12;
201 
202  int index;
203 
204  int ioffset;
205  int joffset;
206 
207  int iend;
208  int jend;
209 
210  int icur;
211  int jcur;
212 
213  public:
214  ShellPairIter();
215  ~ShellPairIter();
216 
217  void init(const double * buffer, int ishell, int jshell,
218  int ioff, int joff, int nfunci, int nfuncj, int redund=0,
219  double scale=1.0);
220 
221  void start() { icur=jcur=index=0; }
222  int ready() const { return (icur < iend); }
223 
224  void next() {
225  if (jcur < ((e12)?(icur):((jend)-1))) {
226  index++;
227  jcur++;
228  return;
229  }
230 
231  jcur=0;
232  icur++;
233 
234  index = icur*jend;
235  }
236 
237  int current_i() const { return icur; }
238  int current_j() const { return jcur; }
239 
240  int i() const { return icur+ioffset; }
241  int j() const { return jcur+joffset; }
242 
243  int nint() const { return iend*jend; }
244 
245  double val() const { return buf[index]*scale_; }
246 };
247 
248 // //////////////////////////////////////////////////////////////////////////
249 
250 class OneBodyIntIter : public RefCount {
251  protected:
252  Ref<OneBodyInt> obi; // help me obi wan
253  ShellPairIter spi;
254 
255  int redund;
256 
257  int istart;
258  int jstart;
259 
260  int iend;
261  int jend;
262 
263  int icur;
264  int jcur;
265 
266  int ij;
267 
268  public:
269  OneBodyIntIter();
271  virtual ~OneBodyIntIter();
272 
273  virtual void start(int ist=0, int jst=0, int ien=0, int jen=0);
274  virtual void next();
275 
276  int ready() const { return (icur < iend); }
277 
278  int ishell() const { return icur; }
279  int jshell() const { return jcur; }
280 
281  int ijshell() const { return ij; }
282 
283  int redundant() const { return redund; }
284  void set_redundant(int i) { redund=i; }
285 
286  virtual double scale() const;
287 
288  Ref<OneBodyInt> one_body_int() { return obi; }
289 
290  ShellPairIter& current_pair();
291 
292  virtual bool cloneable() const;
293  virtual Ref<OneBodyIntIter> clone();
294 };
295 
296 
297 
298 // //////////////////////////////////////////////////////////////////////////
299 
300 class OneBodyIntOp: public SCElementOp {
301  protected:
302  Ref<OneBodyIntIter> iter;
303 
304  public:
307  virtual ~OneBodyIntOp();
308 
309  void process(SCMatrixBlockIter&);
311  void process_spec_ltri(SCMatrixLTriBlock*);
312  void process_spec_rectsub(SCMatrixRectSubBlock*);
313  void process_spec_ltrisub(SCMatrixLTriSubBlock*);
314 
315  bool cloneable() const;
317 
318  int has_side_effects();
319 };
320 
322  private:
323  Ref<OneBodyIntIter> iter;
324 
325  public:
328  virtual ~OneBody3IntOp();
329 
330  void process(SCMatrixBlockIter&,
333  void process_spec_rect(SCMatrixRectBlock*,
336  void process_spec_ltri(SCMatrixLTriBlock*,
339 
340  int has_side_effects();
341  int has_side_effects_in_arg1();
342  int has_side_effects_in_arg2();
343 
344 };
345 
346 // //////////////////////////////////////////////////////////////////////////
347 
350 class OneBodyDerivInt : public RefCount {
351  protected:
352  // this is who created me
353  Integral *integral_;
354 
357 
358  double *buffer_;
359 
360  public:
363  const Ref<GaussianBasisSet>&b1,
364  const Ref<GaussianBasisSet>&b2);
365  virtual ~OneBodyDerivInt();
366 
368  int nbasis() const;
370  int nbasis1() const;
372  int nbasis2() const;
373 
375  int nshell() const;
377  int nshell1() const;
379  int nshell2() const;
380 
387 
403  const double * buffer() const;
404 
407  virtual void compute_shell(int ish, int jsh, int center) = 0;
408 
411  virtual void reinitialize();
412 
414  Integral *integral() const { return integral_; }
415 };
416 
417 // //////////////////////////////////////////////////////////////////////////
418 
422  protected:
423  // this is who created me
424  Integral *integral_;
425 
427 
428  double *buffer_;
429 
430  public:
432  virtual ~OneBodyOneCenterDerivInt();
433 
435  int nbasis() const;
437  int nbasis1() const;
438 
440  int nshell() const;
442  int nshell1() const;
443 
448 
451  const double * buffer() const;
452 
455  virtual void compute_shell(int ish, int center) = 0;
456 
459  virtual void reinitialize();
460 
462  Integral *integral() const { return integral_; }
463 };
464 
465 }
466 
467 #endif
468 
469 // Local Variables:
470 // mode: c++
471 // c-file-style: "ETS"
472 // End:
sc::OneBodyInt::cloneable
virtual bool cloneable() const
Return true if the clone member can be called.
sc::OneBodyOneCenterDerivInt::reinitialize
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
sc::OneBodyOneCenterInt::nshell
int nshell() const
Return the number of shells on center one.
sc::OneBodyOneCenterDerivInt::nbasis
int nbasis() const
Return the number of basis functions on center one.
sc::OneBodyOneCenterInt::nbasis
int nbasis() const
Returns the number of basis functions on center one.
sc::OneBodyOneCenterInt
OneBodyOneCenterInt is an abstract base class for objects that compute integrals between two basis fu...
Definition: obint.h:124
sc::OneBodyIntOp::has_side_effects
int has_side_effects()
By default this returns nonzero.
sc::OneBodyDerivInt::buffer
const double * buffer() const
The computed shell integrals will be put in the buffer returned by this member.
sc::OneBodyDerivInt::basis1
Ref< GaussianBasisSet > basis1() const
Return the basis set on center one.
sc::OneBodyDerivInt::reinitialize
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
sc::SCMatrixLTriBlock
The SCMatrixLTriBlock describes a triangular piece of a matrix.
Definition: block.h:253
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::OneBodyDerivInt::nbasis2
int nbasis2() const
Return the number of basis functions on the center two.
sc::SCMatrixRectBlock
The SCMatrixRectBlock describes a rectangular piece of a matrix.
Definition: block.h:183
sc::OneBodyOneCenterDerivInt::nbasis1
int nbasis1() const
Return the number of basis functions on center one.
sc::OneBodyDerivInt::nshell
int nshell() const
Return the number of shells on center one.
sc::OneBodyDerivInt::integral
Integral * integral() const
Return the integral factory that was used to create this object.
Definition: obint.h:414
sc::OneBodyOneCenterInt::buffer
const double * buffer() const
Returns the buffer where the integrals are placed.
sc::OneBodyOneCenterInt::cloneable
virtual bool cloneable() const
Return true if the clone member can be called.
sc::SCMatrixLTriSubBlock
The SCMatrixLTriSubBlock describes a triangular subblock of a matrix.
Definition: block.h:288
sc::OneBodyDerivInt::nbasis
int nbasis() const
Return the number of basis functions on center one.
sc::OneBodyDerivInt::nbasis1
int nbasis1() const
Return the number of basis functions on the center one.
sc::OneBodyInt::nbasis
int nbasis() const
Returns the number of basis functions on center one.
sc::OneBodyInt::basis2
Ref< GaussianBasisSet > basis2() const
Return the basis set on the center two.
sc::OneBodyOneCenterInt::reinitialize
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
sc::OneBodyInt::buffer
const double * buffer() const
Returns the buffer where the integrals are placed.
sc::SCElementOp
Objects of class SCElementOp are used to perform operations on the elements of matrices.
Definition: elemop.h:94
sc::OneBodyDerivInt::nshell2
int nshell2() const
Return the number of shells on center two.
sc::OneBodyOneCenterInt::compute_shell
virtual void compute_shell(int)=0
Computes the integrals for basis functions on the given shell.
sc::OneBodyDerivInt::compute_shell
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 ...
sc::OneBodyOneCenterDerivInt::integral
Integral * integral() const
Return the integral factory that was used to create this object.
Definition: obint.h:462
sc::OneBodyOneCenterInt::clone
virtual Ref< OneBodyOneCenterInt > clone()
Returns a clone of this.
sc::OneBodyInt::compute_shell
virtual void compute_shell(int, int)=0
Computes the integrals between basis functions in the given shell pair.
sc::OneBodyOneCenterInt::nbasis1
int nbasis1() const
Returns the number of basis functions on the center one.
sc::OneBodyInt::reinitialize
virtual void reinitialize()
This is called for one body integrals that take data to let them know that the data they reference ha...
sc::OneBodyInt::nbasis1
int nbasis1() const
Returns the number of basis functions on the center one.
sc::OneBodyOneCenterInt::basis1
Ref< GaussianBasisSet > basis1() const
Return the basis set on the center one.
sc::OneBodyInt
OneBodyInt is an abstract base class for objects that compute integrals between two basis functions.
Definition: obint.h:49
sc::OneBodyDerivInt::nshell1
int nshell1() const
Return the number of shells on center one.
sc::OneBodyOneCenterDerivInt::basis1
Ref< GaussianBasisSet > basis1() const
Return the basis set on center one.
sc::OneBodyDerivInt::basis
Ref< GaussianBasisSet > basis() const
Return the basis set on center one.
sc::OneBodyIntOp::clone
Ref< SCElementOp > clone()
Returns a clone of this object.
sc::Integral
The Integral abstract class acts as a factory to provide objects that compute one and two electron in...
Definition: integral.h:111
sc::OneBodyOneCenterDerivInt::compute_shell
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 ...
sc::OneBodyIntOp::cloneable
bool cloneable() const
Returns true if this SCElementOp supports the clone() member.
sc::ShellPairIter
Definition: obint.h:195
sc::OneBodyOneCenterDerivInt::buffer
const double * buffer() const
The computed shell integrals will be put in the buffer returned by this member.
sc::OneBodyDerivInt
OneBodyDerivInt is an abstract base class for objects that compute one body derivative integrals.
Definition: obint.h:350
sc::SCMatrixBlockIter
The SCMatrixBlockIter class is used to described iterates that loop through the elements in a block.
Definition: blkiter.h:46
sc::OneBodyInt::compute_shell_array
std::pair< const double *, std::array< unsigned long, 2 > > compute_shell_array(int, int)
Computes the integrals between basis functions in the given shell pair.
sc::OneBodyInt::nshell1
int nshell1() const
Return the number of shells on the center one.
sc::OneBodyInt::nshell2
int nshell2() const
Return the number of shells on the center two.
sc::OneBodyOneCenterDerivInt::basis
Ref< GaussianBasisSet > basis() const
Return the basis set on center one.
sc::OneBodyIntOp::process_spec_rect
void process_spec_rect(SCMatrixRectBlock *)
Matrices should call these members when the type of block is known.
sc::OneBodyInt::basis1
Ref< GaussianBasisSet > basis1() const
Return the basis set on the center one.
sc::OneBody3IntOp
Definition: obint.h:321
sc::OneBodyInt::nshell
int nshell() const
Return the number of shells on center one.
sc::OneBodyIntIter
Definition: obint.h:250
sc::OneBodyOneCenterDerivInt::nshell1
int nshell1() const
Return the number of shells on center one.
sc::OneBodyIntOp
Definition: obint.h:300
sc::OneBodyOneCenterDerivInt::nshell
int nshell() const
Return the number of shells on center one.
sc::SCMatrixRectSubBlock
The SCMatrixRectSubBlock describes a rectangular piece of a matrix.
Definition: block.h:219
sc::OneBodyOneCenterInt::nshell1
int nshell1() const
Return the number of shells on the center one.
sc::SCElementOp3
The SCElementOp3 class is very similar to the SCElementOp class except that a triplet of blocks is tr...
Definition: elemop.h:181
sc::RefCount
The base class for all reference counted objects.
Definition: ref.h:192
sc::OneBodyOneCenterInt::basis
Ref< GaussianBasisSet > basis(size_t c) const
Return the basis set on center one.
sc::OneBodyOneCenterDerivInt
OneBodyOneCenterDerivInt is an abstract base class for objects that compute one body derivative integ...
Definition: obint.h:421
sc::OneBodyDerivInt::basis2
Ref< GaussianBasisSet > basis2() const
Return the basis set on center two.
sc::OneBodyOneCenterWrapper
Definition: obint.h:184
sc::OneBodyInt::basis
Ref< GaussianBasisSet > basis(size_t c) const
Return the basis set on center one.
sc::OneBodyInt::clone
virtual Ref< OneBodyInt > clone()
Returns a clone of this.
sc::OneBodyIntOp::process
void process(SCMatrixBlockIter &)
This is the fallback routine to process blocks and is called by process_spec members that are not ove...
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::OneBodyOneCenterWrapper::compute_shell
void compute_shell(int)
Computes the integrals for basis functions on the given shell.
sc::OneBodyInt::nbasis2
int nbasis2() const
Returns the number of basis functions on the center two.

Generated at Sun Jan 26 2020 23:23:57 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.