GQCP
Loading...
Searching...
No Matches
TwoElectronIntegralBuffer.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>
39 public BaseTwoElectronIntegralBuffer<_IntegralScalar, _N> {
40public:
41 // The scalar representation of an integral.
42 using IntegralScalar = _IntegralScalar;
43
44 // The number of components the corresponding operator has.
45 static constexpr auto N = _N;
46
47
48protected:
49 // The calculated integrals.
50 std::array<std::vector<IntegralScalar>, N> buffer;
51
52
53public:
54 /*
55 * MARK: Constructors
56 */
57
65 TwoElectronIntegralBuffer(const size_t nbf1, const size_t nbf2, const size_t nbf3, const size_t nbf4, const std::array<std::vector<IntegralScalar>, N>& buffer) :
66 buffer {buffer},
68
69
70 /*
71 * MARK: Emplacement
72 */
73
77 bool areIntegralsAllZero() const override { return false; }
78
88 IntegralScalar value(const size_t i, const size_t f1, const size_t f2, const size_t f3, const size_t f4) const override {
89 // We'll access the component first, then a row-major ordering of the calculated integrals.
90 return this->buffer[i][f4 + this->nbf4 * (f3 + this->nbf3 * (f2 + this->nbf2 * f1))];
91 }
92};
93
94
95} // namespace GQCP
Definition: BaseTwoElectronIntegralBuffer.hpp:38
size_t nbf4
Definition: BaseTwoElectronIntegralBuffer.hpp:48
size_t nbf3
Definition: BaseTwoElectronIntegralBuffer.hpp:47
size_t nbf1
Definition: BaseTwoElectronIntegralBuffer.hpp:45
size_t nbf2
Definition: BaseTwoElectronIntegralBuffer.hpp:46
Definition: TwoElectronIntegralBuffer.hpp:39
_IntegralScalar IntegralScalar
Definition: TwoElectronIntegralBuffer.hpp:42
static constexpr auto N
Definition: TwoElectronIntegralBuffer.hpp:45
std::array< std::vector< IntegralScalar >, N > buffer
Definition: TwoElectronIntegralBuffer.hpp:50
TwoElectronIntegralBuffer(const size_t nbf1, const size_t nbf2, const size_t nbf3, const size_t nbf4, const std::array< std::vector< IntegralScalar >, N > &buffer)
Definition: TwoElectronIntegralBuffer.hpp:65
IntegralScalar value(const size_t i, const size_t f1, const size_t f2, const size_t f3, const size_t f4) const override
Definition: TwoElectronIntegralBuffer.hpp:88
bool areIntegralsAllZero() const override
Definition: TwoElectronIntegralBuffer.hpp:77
Definition: BaseOneElectronIntegralBuffer.hpp:25