28 #ifndef MPQC_INTEGRALS_INTEGRALS_HPP
29 #define MPQC_INTEGRALS_INTEGRALS_HPP
33 #include <mpqc/math/tensor.hpp>
34 #include <boost/foreach.hpp>
36 #include <chemistry/molecule/molecule.h>
37 #include <chemistry/qc/basis/integral.h>
49 template<
class RefEngine>
61 : engine_(engineptr) {}
72 size_t dims[] = {size_t(p.size()),
size_t(q.size()) };
73 engine_->compute_shell(p.index(), q.index());
74 return Tensor2(engine_->buffer(), dims);
78 size_t dims[] = {size_t( p.size()),
size_t(q.size()),
80 engine_->compute_shell(p.index(), q.index(), r.index());
81 return Tensor3(engine_->buffer(), dims);
84 Tensor4
operator()(Shell p, Shell q, Shell r, Shell s) {
85 size_t dims[] = { size_t(p.size()),
size_t(q.size()),
86 size_t(r.size()),
size_t(s.size()) };
87 engine_->compute_shell(p.index(), q.index(),
88 r.index(), s.index());
89 return Tensor4(engine_->buffer(), dims);
103 const std::vector<int> &S) {
105 std::vector<Shell> shells;
106 BOOST_FOREACH(
int s, S){
108 shells.push_back(Shell(s,range(f,f+n)));
126 template<
class Engine>
127 void evaluate(Integrals<Engine> integral,
128 const std::vector<int> &P,
129 const std::vector<int> &Q,
130 TensorRef<double,2, TensorRowMajor > &ints) {
131 std::vector<Shell> shells[] = {
132 pack(integral.engine()->basis1(), P),
133 pack(integral.engine()->basis2(), Q)
136 BOOST_FOREACH(Shell p, shells[0]){
137 BOOST_FOREACH(Shell q, shells[1]){
138 ints(p,q) = integral(p,q);
144 template<
class Engine>
145 void evaluate(Integrals<Engine> integral,
146 const std::vector<int> &P,
147 const std::vector<int> &Q,
148 const std::vector<int> &R,
149 TensorRef<double,3, TensorRowMajor > &ints) {
150 std::vector<Shell> shells[] = {
151 pack(integral.engine()->basis1(), P),
152 pack(integral.engine()->basis2(), Q),
153 pack(integral.engine()->basis3(), R)
155 BOOST_FOREACH(Shell p, shells[0]){
156 BOOST_FOREACH(Shell q, shells[1]){
157 BOOST_FOREACH(Shell r, shells[2]){
158 ints(p,q,r) = integral(p,q,r);
164 template<
class Engine>
165 void evaluate(Integrals<Engine> integral,
166 const std::vector<int> &P,
167 const std::vector<int> &Q,
168 const std::vector<int> &R,
169 const std::vector<int> &S,
170 TensorRef<double,4, TensorRowMajor > &ints) {
171 std::vector<Shell> shells[] = {
172 pack(integral.engine()->basis1(), P),
173 pack(integral.engine()->basis2(), Q),
174 pack(integral.engine()->basis3(), R),
175 pack(integral.engine()->basis4(), S),
177 BOOST_FOREACH(Shell p, shells[0]){
178 BOOST_FOREACH(Shell q, shells[1]){
179 BOOST_FOREACH(Shell r, shells[2]){
180 BOOST_FOREACH(Shell s, shells[3]){
181 ints(p,q,r,s) = integral(p,q,r,s);
207 const std::vector<int> &P,
208 const std::vector<int> &Q,
215 const std::vector<int> &P,
216 const std::vector<int> &Q,
223 const std::vector<int> &P,
224 const std::vector<int> &Q,
225 const std::vector<int> &R,
226 TensorRef<double,3, TensorRowMajor > &ints) {
232 const std::vector<int> &P,
233 const std::vector<int> &Q,
234 const std::vector<int> &R,
235 const std::vector<int> &S,
236 TensorRef<double,4, TensorRowMajor > &ints) {