MPQC  3.0.0-alpha
int2e.h
1 //
2 // int2e.h
3 //
4 // Copyright (C) 2001 Edward Valeev
5 //
6 // Author: Edward Valeev <evaleev@vt.edu>
7 // Maintainer: EV
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_libint2_int2e_h
29 #define _chemistry_qc_libint2_int2e_h
30 
31 #include <limits.h>
32 
33 #include <util/ref/ref.h>
34 #include <chemistry/qc/basis/basis.h>
35 #include <chemistry/qc/basis/tbint.h>
36 #include <chemistry/qc/libint2/bounds.h>
37 
38 namespace sc {
39 
40 class Integral;
41 class Log2Bounds;
42 
46 class Int2eLibint2: public RefCount {
47  protected:
48  Integral *integral_;
49 
54 
55  Ref<Log2Bounds> bounds_;
56 
57  GaussianShell *int_shell1_;
58  GaussianShell *int_shell2_;
59  GaussianShell *int_shell3_;
60  GaussianShell *int_shell4_;
61 
62  // Whether shells can be permuted
63  int permute_;
64  // Whether redundant integrals are needed or only unique ones
65  int redundant_;
66 
67  /*--- Storage related stuff ---*/
68  // Available storage
69  size_t storage_;
70  // Storage currently used
71  size_t storage_used_;
72  // Checks if too much storage is used
73  void check_storage_() const;
74  // Reports minimum "significant" storage needed to initialize the Int2e base
75  static size_t storage_required_(const Ref<GaussianBasisSet>& b1,
76  const Ref<GaussianBasisSet>& b2 = 0,
77  const Ref<GaussianBasisSet>& b3 = 0,
78  const Ref<GaussianBasisSet>& b4 = 0);
79 
80  /*--- Scratch ---*/
81  std::vector<double> tformbuf_; // stores one partially transformed contraction quartet
82 
83  /*--- helper functions ---*/
84  // cart.->sph.harm. transform functions
85  void transform_contrquartets_(double *,double *);
86  // normalize cartesian quartets, if needed
87  void norm_contrcart1_(double* data);
88  template <unsigned int ntypes> void norm_contrcart_(double* data);
89  // sort from by-contraction-quartet to shell-quartet order
90  void sort_contrquartets_to_shellquartet_(double *,double *);
91  // permute perm_ints_ into target_int_buf_
92  void permute_target_(double *, double *, int, int, int);
93  void permute_1234_to_1243_(double *, double *);
94  void permute_1234_to_2134_(double *, double *);
95  void permute_1234_to_2143_(double *, double *);
96  void permute_1234_to_3412_(double *, double *);
97  void permute_1234_to_3421_(double *, double *);
98  void permute_1234_to_4312_(double *, double *);
99  void permute_1234_to_4321_(double *, double *);
100  // retrieve nonredundant integrals
101  void get_nonredundant_ints_(double *, double *, int, int, int);
102 
103  public:
105  const Ref<GaussianBasisSet>&,
106  const Ref<GaussianBasisSet>&,
107  const Ref<GaussianBasisSet>&,
108  const Ref<GaussianBasisSet>&,
109  size_t storage);
110  ~Int2eLibint2();
111 
113 
115  virtual Ref<Int2eLibint2> clone();
116 
118  void bounds(const Ref<Log2Bounds>&);
120  const Ref<Log2Bounds>& bounds() const { return bounds_; }
121 
123  size_t storage_used() const { return storage_used_; }
124 
126  int redundant() const { return redundant_; }
128  void set_redundant(int flag) { redundant_ = flag; }
129 
131  int permute() const { return permute_; }
133  void set_permute(int flag) { permute_ = flag; }
134 
136  virtual void compute_quartet(int *, int*, int*, int*) =0;
138  virtual double *buffer(unsigned int) const =0;
141  virtual int log2_bound(int s1, int s2, int s3, int s4);
142 
143 
144  Ref<GaussianBasisSet> basis()
145  {
146  if (bs1_==bs2_ && bs1_ == bs3_ && bs1_ == bs4_) return bs1_;
147  return 0;
148  }
149  Ref<GaussianBasisSet> basis1() { return bs1_; }
150  Ref<GaussianBasisSet> basis2() { return bs2_; }
151  Ref<GaussianBasisSet> basis3() { return bs3_; }
152  Ref<GaussianBasisSet> basis4() { return bs4_; }
153 
154  protected:
156  Int2eLibint2(const Int2eLibint2& other);
157 };
158 
159 }
160 
161 #endif
162 
163 // Local Variables:
164 // mode: c++
165 // c-file-style: "CLJ"
166 // End:
sc::Int2eLibint2::compute_quartet
virtual void compute_quartet(int *, int *, int *, int *)=0
Evaluate the target quartet of integrals.
sc::Int2eLibint2::buffer
virtual double * buffer(unsigned int) const =0
Returns the location of the buffer with target integrals.
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::Int2eLibint2::clone
virtual Ref< Int2eLibint2 > clone()
"clones" this engine, all precomputed data is shallow-copied
sc::Int2eLibint2::permute
int permute() const
Whether shells can be permuted.
Definition: int2e.h:131
sc::Int2eLibint2::bounds
const Ref< Log2Bounds > & bounds() const
returns the bounds evaluator for log2_bound
Definition: int2e.h:120
sc::other
SpinCase1 other(SpinCase1 S)
given 1-spin return the other 1-spin
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::Int2eLibint2::log2_bound
virtual int log2_bound(int s1, int s2, int s3, int s4)
Computes log2 bound.
sc::Int2eLibint2::set_redundant
void set_redundant(int flag)
Set redundant flag.
Definition: int2e.h:128
sc::Int2eLibint2
Int2eLibint2 is an interface to various specializations of two-electron integral evaluators implement...
Definition: int2e.h:46
sc::RefCount
The base class for all reference counted objects.
Definition: ref.h:192
sc::Int2eLibint2::storage_used
size_t storage_used() const
Reports how much storage is actually used at a given time.
Definition: int2e.h:123
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::Int2eLibint2::redundant
int redundant() const
Whether redundant integrals are returned.
Definition: int2e.h:126
sc::GaussianShell
A shell of Gaussian functions.
Definition: gaussshell.h:51
sc::Int2eLibint2::set_permute
void set_permute(int flag)
Set shell permutation flag.
Definition: int2e.h:133

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