1 | //
|
---|
2 | // int2e.h
|
---|
3 | //
|
---|
4 | // Copyright (C) 2001 Edward Valeev
|
---|
5 | //
|
---|
6 | // Author: Edward Valeev <edward.valeev@chemistry.gatech.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 | #ifdef __GNUG__
|
---|
29 | #pragma interface
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #ifndef _chemistry_qc_cints_int2e_h
|
---|
33 | #define _chemistry_qc_cints_int2e_h
|
---|
34 |
|
---|
35 | #include <limits.h>
|
---|
36 |
|
---|
37 | #include <util/ref/ref.h>
|
---|
38 | #include <chemistry/qc/basis/basis.h>
|
---|
39 | #include <chemistry/qc/basis/tbint.h>
|
---|
40 |
|
---|
41 | namespace sc {
|
---|
42 |
|
---|
43 | class Integral;
|
---|
44 |
|
---|
45 | /** Int2eCints is an interface to various specializations of two-electron
|
---|
46 | integral evaluators implemented in Cints. It is used by TwoBodyIntCints and TwoBodyDerivIntCints to
|
---|
47 | implement IntegralCints. */
|
---|
48 | class Int2eCints: public RefCount {
|
---|
49 | protected:
|
---|
50 | Integral *integral_;
|
---|
51 |
|
---|
52 | Ref<GaussianBasisSet> bs1_;
|
---|
53 | Ref<GaussianBasisSet> bs2_;
|
---|
54 | Ref<GaussianBasisSet> bs3_;
|
---|
55 | Ref<GaussianBasisSet> bs4_;
|
---|
56 |
|
---|
57 | Ref<MessageGrp> grp_;
|
---|
58 |
|
---|
59 | GaussianShell *int_shell1_;
|
---|
60 | GaussianShell *int_shell2_;
|
---|
61 | GaussianShell *int_shell3_;
|
---|
62 | GaussianShell *int_shell4_;
|
---|
63 |
|
---|
64 | // Whether shells can be permuted
|
---|
65 | int permute_;
|
---|
66 | // Whether redundant integrals are needed or only unique ones
|
---|
67 | int redundant_;
|
---|
68 |
|
---|
69 | /*--- Storage related stuff ---*/
|
---|
70 | // Available storage
|
---|
71 | size_t storage_;
|
---|
72 | // Storage currently used
|
---|
73 | size_t storage_used_;
|
---|
74 | // Checks if too much storage is used
|
---|
75 | void check_storage_() const;
|
---|
76 | // Reports minimum "significant" storage needed to initialize the Int2e base
|
---|
77 | static size_t storage_required_(const Ref<GaussianBasisSet>& b1,
|
---|
78 | const Ref<GaussianBasisSet>& b2 = 0,
|
---|
79 | const Ref<GaussianBasisSet>& b3 = 0,
|
---|
80 | const Ref<GaussianBasisSet>& b4 = 0);
|
---|
81 |
|
---|
82 | /*--- Scratch ---*/
|
---|
83 | double *tformbuf_; // stores one partially transformed contraction quartet
|
---|
84 |
|
---|
85 | /*--- helper functions ---*/
|
---|
86 | // cart.->sph.harm. transform functions
|
---|
87 | void transform_contrquartets_(double *,double *);
|
---|
88 | // sort from by-contraction-quartet to shell-quartet order
|
---|
89 | void sort_contrquartets_to_shellquartet_(double *,double *);
|
---|
90 | // permute perm_ints_ into target_int_buf_
|
---|
91 | void permute_target_(double *, double *, int, int, int);
|
---|
92 | void permute_1234_to_1243_(double *, double *);
|
---|
93 | void permute_1234_to_2134_(double *, double *);
|
---|
94 | void permute_1234_to_2143_(double *, double *);
|
---|
95 | void permute_1234_to_3412_(double *, double *);
|
---|
96 | void permute_1234_to_3421_(double *, double *);
|
---|
97 | void permute_1234_to_4312_(double *, double *);
|
---|
98 | void permute_1234_to_4321_(double *, double *);
|
---|
99 | // retrieve nonredundant integrals
|
---|
100 | void get_nonredundant_ints_(double *, double *, int, int, int);
|
---|
101 |
|
---|
102 | public:
|
---|
103 | Int2eCints(Integral *,
|
---|
104 | const Ref<GaussianBasisSet>&,
|
---|
105 | const Ref<GaussianBasisSet>&,
|
---|
106 | const Ref<GaussianBasisSet>&,
|
---|
107 | const Ref<GaussianBasisSet>&,
|
---|
108 | size_t storage);
|
---|
109 | ~Int2eCints();
|
---|
110 |
|
---|
111 | /// Sets storage limit and starts storage tracking
|
---|
112 | void init_storage(size_t);
|
---|
113 | /// Finishes storage tracking
|
---|
114 | void done_storage();
|
---|
115 | /// Reports how much storage is actually used at a given time
|
---|
116 | size_t storage_used() const { return storage_used_; }
|
---|
117 |
|
---|
118 | /// Whether redundant integrals are returned
|
---|
119 | int redundant() const { return redundant_; }
|
---|
120 | /// Set redundant flag
|
---|
121 | void set_redundant(int flag) { redundant_ = flag; }
|
---|
122 |
|
---|
123 | /// Whether shells can be permuted
|
---|
124 | int permute() const { return permute_; }
|
---|
125 | /// Set shell permutation flag
|
---|
126 | void set_permute(int flag) { permute_ = flag; }
|
---|
127 |
|
---|
128 | /// Evaluate the target quartet of integrals
|
---|
129 | virtual void compute_quartet(int *, int*, int*, int*) =0;
|
---|
130 | /// Returns the location of the buffer with target integrals
|
---|
131 | virtual double *buffer(TwoBodyInt::tbint_type = TwoBodyInt::eri) const =0;
|
---|
132 |
|
---|
133 | Ref<GaussianBasisSet> basis()
|
---|
134 | {
|
---|
135 | if (bs1_==bs2_ && bs1_ == bs3_ && bs1_ == bs4_) return bs1_;
|
---|
136 | return 0;
|
---|
137 | }
|
---|
138 | Ref<GaussianBasisSet> basis1() { return bs1_; }
|
---|
139 | Ref<GaussianBasisSet> basis2() { return bs2_; }
|
---|
140 | Ref<GaussianBasisSet> basis3() { return bs3_; }
|
---|
141 | Ref<GaussianBasisSet> basis4() { return bs4_; }
|
---|
142 |
|
---|
143 | };
|
---|
144 |
|
---|
145 | }
|
---|
146 |
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | // Local Variables:
|
---|
150 | // mode: c++
|
---|
151 | // c-file-style: "CLJ"
|
---|
152 | // End:
|
---|