MPQC  3.0.0-alpha
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 
39 namespace sc {
40 
41 // //////////////////////////////////////////////////////////////////////////
42 
43 class Integral;
44 
49  enum value {
51  11_O_22,
53  11_O_2,
55  1_O_2 };
56 };
57 
61 class 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 
136  virtual Ref<TwoBodyInt> clone();
137 
139  Integral *integral() const { return integral_; }
140 
141 };
142 
143 
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:
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;
205  ShellQuartetIter sqi;
206 
207  int iend;
208 
209  int icur;
210  int jcur;
211  int kcur;
212  int lcur;
213 
214  public:
215  TwoBodyIntIter();
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 
238  protected:
239  Ref<TwoBodyTwoCenterInt> tbi; // help me obi wan
240  TwoBodyOper::type type;
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 
289  protected:
291 
292  public:
295  virtual ~TwoBodyTwoCenterIntOp();
296 
297  void process(SCMatrixBlockIter&);
299  void process_spec_ltri(SCMatrixLTriBlock*);
300  void process_spec_rectsub(SCMatrixRectSubBlock*);
301  void process_spec_ltrisub(SCMatrixLTriSubBlock*);
302 
303  bool cloneable() const;
305 
306  int has_side_effects();
307 };
308 
309 
310 }
311 
312 #endif
313 
314 // Local Variables:
315 // mode: c++
316 // c-file-style: "ETS"
317 // End:
sc::TwoBodyTwoCenterIntOp::cloneable
bool cloneable() const
Returns true if this SCElementOp supports the clone() member.
sc::TwoBodyTwoCenterIntOp::process
void process(SCMatrixBlockIter &)
This is the fallback routine to process blocks and is called by process_spec members that are not ove...
sc::TwoBodyTwoCenterIntOp::clone
Ref< SCElementOp > clone()
Returns a clone of this object.
sc::NBodyIntEval
This is an abstract base type for classes that compute integrals of general N-body operators describe...
Definition: nbint.h:61
sc::NBodyIntEval::descr
virtual const Ref< OperSetDescr > & descr() const =0
return the operator set descriptor
sc::SCMatrixLTriBlock
The SCMatrixLTriBlock describes a triangular piece of a matrix.
Definition: block.h:253
sc::NBodyIntEval::set_integral_storage
virtual void set_integral_storage(size_t storage)
This storage is used to cache computed integrals.
sc::NBodyIntEval::cloneable
virtual bool cloneable() const
Return true if the clone member can be called.
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::TwoBodyIntShape::value
value
Definition: nbint.h:49
sc::SCMatrixRectBlock
The SCMatrixRectBlock describes a rectangular piece of a matrix.
Definition: block.h:183
sc::NBodyIntEval::integral
Integral * integral() const
Return the integral factory that was used to create this object.
Definition: nbint.h:139
sc::TwoBodyIntIter
Definition: tbint.h:465
sc::SCMatrixLTriSubBlock
The SCMatrixLTriSubBlock describes a triangular subblock of a matrix.
Definition: block.h:288
sc::NBodyIntEval::redundant
virtual int redundant() const
If redundant is true, then keep redundant integrals in the buffer.
Definition: nbint.h:123
sc::NBodyIntEval::set_redundant
virtual void set_redundant(int i)
See redundant().
Definition: nbint.h:125
sc::SCElementOp
Objects of class SCElementOp are used to perform operations on the elements of matrices.
Definition: elemop.h:94
sc::TwoBodyTwoCenterIntIter
Definition: nbint.h:237
sc::NBodyIntEval::buffer
virtual const double * buffer(NBodyOper::type type=NBodyOper::coulomb) const
The computed shell integrals will be put in the buffer returned by this member.
sc::NBodyIntEval::basis
Ref< GaussianBasisSet > basis(size_t center=0)
Return the number of basis functions on center center.
Definition: nbint.h:82
sc::TwoBodyTwoCenterIntOp::has_side_effects
int has_side_effects()
By default this returns nonzero.
sc::TwoBodyTwoCenterIntOp::process_spec_rect
void process_spec_rect(SCMatrixRectBlock *)
Matrices should call these members when the type of block is known.
sc::NBodyIntIter
Definition: nbint.h:202
sc::TwoBodyTwoCenterIntOp
The 2-body analog of OneBodyIntOp.
Definition: nbint.h:288
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::ShellPairIter
Definition: obint.h:195
sc::TwoBodyOper::eri
two-body Coulomb
Definition: operator.h:319
sc::SCMatrixBlockIter
The SCMatrixBlockIter class is used to described iterates that loop through the elements in a block.
Definition: blkiter.h:46
sc::NBodyIntEval::log2_shell_bound
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...
sc::NBodyIntEval::compute_shell_arrays
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.
sc::TwoBodyOper::type
type
types of known two-body operators
Definition: operator.h:318
sc::NBodyIntEval::type
virtual NBodyOperSet::type type() const =0
Returns the type of the operator set that this object computes.
sc::NBodyIntEval::shell_bound
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.
sc::TwoBodyIntShape::_O_22
4-center integral in chemistry convention
Definition: nbint.h:51
sc::TwoBodyIntShape::_O_2
3-center integral
Definition: nbint.h:53
sc::SCMatrixRectSubBlock
The SCMatrixRectSubBlock describes a rectangular piece of a matrix.
Definition: block.h:219
sc::RefCount
The base class for all reference counted objects.
Definition: ref.h:192
sc::NBodyIntEval::compute_shell
virtual void compute_shell(int, int, int, int)=0
Given four shell indices, integrals will be computed and placed in the buffer.
sc::ShellQuartetIter
Definition: nbint.h:144
sc::NBodyIntEval::clone
virtual Ref< TwoBodyInt > clone()
Returns a clone of this.
sc::TwoBodyIntShape
Describes types of integrals of 2-body operators.
Definition: nbint.h:48
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

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