GQCP
Loading...
Searching...
No Matches
BaseOneElectronIntegralBuffer.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#include <array>
23
24
25namespace GQCP {
26
27
36template <typename _IntegralScalar, size_t _N>
38public:
39 using IntegralScalar = _IntegralScalar; // the scalar representation of an integral
40 static constexpr auto N = _N; // the number of components the operator has
41
42
43protected:
44 size_t nbf1; // the number of basis functions in the first shell
45 size_t nbf2; // the number of basis functions in the second shell
46
47
48public:
49 /*
50 * CONSTRUCTORS
51 */
52
57 BaseOneElectronIntegralBuffer(const size_t nbf1, const size_t nbf2) :
58 nbf1 {nbf1},
59 nbf2 {nbf2} {}
60
61
62 /*
63 * DESTRUCTOR
64 */
65 virtual ~BaseOneElectronIntegralBuffer() = default;
66
67
68 /*
69 * PUBLIC PURE VIRTUAL METHODS
70 */
71
75 virtual bool areIntegralsAllZero() const = 0;
76
84 virtual IntegralScalar value(const size_t i, const size_t f1, const size_t f2) const = 0;
85
86
87 /*
88 * PUBLIC METHODS
89 */
90
98 void emplace(std::array<MatrixX<IntegralScalar>, N>& full_components, const size_t bf1, const size_t bf2) const {
99
100 // Place the calculated integrals inside the matrix representation of the integrals
101 for (size_t f1 = 0; f1 < this->nbf1; f1++) { // the index of the basis function within shell 1
102 for (size_t f2 = 0; f2 < this->nbf2; f2++) { // the index of the basis function within shell 2
103
104 for (size_t i = 0; i < N; i++) { // loop over the components
105 full_components[i](bf1 + f1, bf2 + f2) = this->value(i, f1, f2);
106 } // components
107
108 } // f2
109 } // f1
110 }
111
112
116 size_t numberOfBasisFunctionsInShell1() const { return this->nbf1; }
117
121 size_t numberOfBasisFunctionsInShell2() const { return this->nbf2; }
122};
123
124
125} // namespace GQCP
Definition: BaseOneElectronIntegralBuffer.hpp:37
size_t nbf2
Definition: BaseOneElectronIntegralBuffer.hpp:45
static constexpr auto N
Definition: BaseOneElectronIntegralBuffer.hpp:40
void emplace(std::array< MatrixX< IntegralScalar >, N > &full_components, const size_t bf1, const size_t bf2) const
Definition: BaseOneElectronIntegralBuffer.hpp:98
virtual bool areIntegralsAllZero() const =0
virtual ~BaseOneElectronIntegralBuffer()=default
virtual IntegralScalar value(const size_t i, const size_t f1, const size_t f2) const =0
_IntegralScalar IntegralScalar
Definition: BaseOneElectronIntegralBuffer.hpp:39
size_t numberOfBasisFunctionsInShell2() const
Definition: BaseOneElectronIntegralBuffer.hpp:121
size_t nbf1
Definition: BaseOneElectronIntegralBuffer.hpp:44
size_t numberOfBasisFunctionsInShell1() const
Definition: BaseOneElectronIntegralBuffer.hpp:116
BaseOneElectronIntegralBuffer(const size_t nbf1, const size_t nbf2)
Definition: BaseOneElectronIntegralBuffer.hpp:57
Definition: Matrix.hpp:47
Definition: BaseOneElectronIntegralBuffer.hpp:25