GQCP
Loading...
Searching...
No Matches
BaseTwoElectronIntegralBuffer.hpp
Go to the documentation of this file.
1// This file is part of GQCG-GQCP.
2//
3// Copyright (C) 2017-2020 the GQCG developers
4//
5// GQCG-GQCP is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GQCG-GQCP is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GQCG-GQCP. If not, see <http://www.gnu.org/licenses/>.
17
18#pragma once
19
20
22
23#include <array>
24
25
26namespace GQCP {
27
28
37template <typename _IntegralScalar, size_t _N>
39public:
40 using IntegralScalar = _IntegralScalar; // the scalar representation of an integral
41 static constexpr auto N = _N; // the number of components the operator has
42
43
44protected:
45 size_t nbf1; // the number of basis functions in the first shell
46 size_t nbf2; // the number of basis functions in the second shell
47 size_t nbf3; // the number of basis functions in the third shell
48 size_t nbf4; // the number of basis functions in the fourth shell
49
50
51public:
52 /*
53 * CONSTRUCTORS
54 */
55
62 BaseTwoElectronIntegralBuffer(const size_t nbf1, const size_t nbf2, const size_t nbf3, const size_t nbf4) :
63 nbf1 {nbf1},
64 nbf2 {nbf2},
65 nbf3 {nbf3},
66 nbf4 {nbf4} {}
67
68
69 /*
70 * DESTRUCTOR
71 */
72 virtual ~BaseTwoElectronIntegralBuffer() = default;
73
74
75 /*
76 * PUBLIC PURE VIRTUAL METHODS
77 */
78
82 virtual bool areIntegralsAllZero() const = 0;
83
93 virtual IntegralScalar value(const size_t i, const size_t f1, const size_t f2, const size_t f3, const size_t f4) const = 0;
94
95
96 /*
97 * PUBLIC METHODS
98 */
99
109 void emplace(std::array<Tensor<IntegralScalar, 4>, N>& full_components, const size_t bf1, const size_t bf2, const size_t bf3, const size_t bf4) const {
110
111 // Place the calculated integrals inside the matrix representation of the integrals
112 for (size_t f1 = 0; f1 != this->nbf1; f1++) { // f1: index of basis function within shell 1
113 for (size_t f2 = 0; f2 != this->nbf2; f2++) { // f2: index of basis function within shell 2
114 for (size_t f3 = 0; f3 != this->nbf3; f3++) { // f3: index of basis function within shell 3
115 for (size_t f4 = 0; f4 != this->nbf4; f4++) { // f4: index of basis function within shell 4
116
117 for (size_t i = 0; i < N; i++) {
118 full_components[i](bf1 + f1, bf2 + f2, bf3 + f3, bf4 + f4) = this->value(i, f1, f2, f3, f4); // in chemist's notation
119 }
120
121 } // f1
122 } // f2
123 } // f3
124 } // f4
125 }
126
127
131 size_t numberOfBasisFunctionsInShell1() const { return this->nbf1; }
132
136 size_t numberOfBasisFunctionsInShell2() const { return this->nbf2; }
137
141 size_t numberOfBasisFunctionsInShell3() const { return this->nbf3; }
142
146 size_t numberOfBasisFunctionsInShell4() const { return this->nbf4; }
147
148};
149
150
151} // namespace GQCP
Definition: BaseTwoElectronIntegralBuffer.hpp:38
size_t nbf4
Definition: BaseTwoElectronIntegralBuffer.hpp:48
size_t numberOfBasisFunctionsInShell3() const
Definition: BaseTwoElectronIntegralBuffer.hpp:141
size_t nbf3
Definition: BaseTwoElectronIntegralBuffer.hpp:47
size_t numberOfBasisFunctionsInShell1() const
Definition: BaseTwoElectronIntegralBuffer.hpp:131
void emplace(std::array< Tensor< IntegralScalar, 4 >, N > &full_components, const size_t bf1, const size_t bf2, const size_t bf3, const size_t bf4) const
Definition: BaseTwoElectronIntegralBuffer.hpp:109
BaseTwoElectronIntegralBuffer(const size_t nbf1, const size_t nbf2, const size_t nbf3, const size_t nbf4)
Definition: BaseTwoElectronIntegralBuffer.hpp:62
size_t nbf1
Definition: BaseTwoElectronIntegralBuffer.hpp:45
virtual bool areIntegralsAllZero() const =0
size_t numberOfBasisFunctionsInShell4() const
Definition: BaseTwoElectronIntegralBuffer.hpp:146
static constexpr auto N
Definition: BaseTwoElectronIntegralBuffer.hpp:41
_IntegralScalar IntegralScalar
Definition: BaseTwoElectronIntegralBuffer.hpp:40
virtual IntegralScalar value(const size_t i, const size_t f1, const size_t f2, const size_t f3, const size_t f4) const =0
size_t numberOfBasisFunctionsInShell2() const
Definition: BaseTwoElectronIntegralBuffer.hpp:136
size_t nbf2
Definition: BaseTwoElectronIntegralBuffer.hpp:46
virtual ~BaseTwoElectronIntegralBuffer()=default
Definition: Tensor.hpp:46
Definition: BaseOneElectronIntegralBuffer.hpp:25