GQCP
Loading...
Searching...
No Matches
LibcintTwoElectronIntegralBuffer.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
24namespace GQCP {
25
26
33template <typename _IntegralScalar, size_t _N>
35public:
36 using IntegralScalar = _IntegralScalar; // the scalar representation of an integral
37 static constexpr auto N = _N; // the number of components the operator has
38
39
40private:
41 std::vector<IntegralScalar> buffer; // the libcint integral data converted to a C++ vector
42
43 int result; // the result of the libcint_function call
44
45
46public:
47 /*
48 * CONSTRUCTORS
49 */
50
59 LibcintTwoElectronIntegralBuffer(const std::vector<IntegralScalar>& buffer, const size_t nbf1, const size_t nbf2, const size_t nbf3, const size_t nbf4, const int result) :
60 buffer {buffer},
61 result {result},
63
64
65 /*
66 * PUBLIC OVERRIDDEN METHODS
67 */
68
72 bool areIntegralsAllZero() const override { return (result == 0); }
73
83 IntegralScalar value(const size_t i, const size_t f1, const size_t f2, const size_t f3, const size_t f4) const override {
84 return this->buffer[f1 + this->nbf1 * (f2 + this->nbf2 * (f3 + this->nbf3 * (f4 + this->nbf4 * i)))]; // column major for libcint
85 }
86};
87
88
89} // 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: LibcintTwoElectronIntegralBuffer.hpp:34
bool areIntegralsAllZero() const override
Definition: LibcintTwoElectronIntegralBuffer.hpp:72
LibcintTwoElectronIntegralBuffer(const std::vector< IntegralScalar > &buffer, const size_t nbf1, const size_t nbf2, const size_t nbf3, const size_t nbf4, const int result)
Definition: LibcintTwoElectronIntegralBuffer.hpp:59
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: LibcintTwoElectronIntegralBuffer.hpp:83
static constexpr auto N
Definition: LibcintTwoElectronIntegralBuffer.hpp:37
_IntegralScalar IntegralScalar
Definition: LibcintTwoElectronIntegralBuffer.hpp:36
Definition: BaseOneElectronIntegralBuffer.hpp:25