GQCP
Loading...
Searching...
No Matches
LibcintOneElectronIntegralBuffer.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
35template <typename _IntegralScalar, size_t _N>
37public:
38 using IntegralScalar = _IntegralScalar; // the scalar representation of an integral
39 static constexpr auto N = _N; // the number of components the operator has
40
41
42private:
43 double scaling_factor; // a factor that multiplies every calculated value (for example in the dipole integrals, an extra factor -1 should be included)
44 std::vector<IntegralScalar> buffer; // the libcint integral data converted to a C++ vector
45
46 int result; // the result of the libcint_function call
47
48
49public:
50 /*
51 * CONSTRUCTORS
52 */
53
61 LibcintOneElectronIntegralBuffer(const std::vector<IntegralScalar>& buffer, const size_t nbf1, const size_t nbf2, const int result, const double scaling_factor = 1.0) :
62 scaling_factor {scaling_factor},
63 buffer {buffer},
64 result {result},
66
67
68 /*
69 * PUBLIC OVERRIDDEN METHODS
70 */
71
75 bool areIntegralsAllZero() const override { return (this->result == 0); }
76
84 IntegralScalar value(const size_t i, const size_t f1, const size_t f2) const override {
85 return this->scaling_factor * this->buffer[f1 + this->nbf1 * (f2 + this->nbf2 * i)]; // column-major ordering for libcint
86 }
87};
88
89
90} // namespace GQCP
Definition: BaseOneElectronIntegralBuffer.hpp:37
size_t nbf2
Definition: BaseOneElectronIntegralBuffer.hpp:45
size_t nbf1
Definition: BaseOneElectronIntegralBuffer.hpp:44
Definition: LibcintOneElectronIntegralBuffer.hpp:36
IntegralScalar value(const size_t i, const size_t f1, const size_t f2) const override
Definition: LibcintOneElectronIntegralBuffer.hpp:84
bool areIntegralsAllZero() const override
Definition: LibcintOneElectronIntegralBuffer.hpp:75
_IntegralScalar IntegralScalar
Definition: LibcintOneElectronIntegralBuffer.hpp:38
static constexpr auto N
Definition: LibcintOneElectronIntegralBuffer.hpp:39
LibcintOneElectronIntegralBuffer(const std::vector< IntegralScalar > &buffer, const size_t nbf1, const size_t nbf2, const int result, const double scaling_factor=1.0)
Definition: LibcintOneElectronIntegralBuffer.hpp:61
Definition: BaseOneElectronIntegralBuffer.hpp:25