GQCP
Loading...
Searching...
No Matches
LibintOneElectronIntegralBuffer.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
22
23
24namespace GQCP {
25
26
32template <size_t _N>
34public:
35 using IntegralScalar = double; // the scalar representation of an integral for libint is always a real number
36 static constexpr auto N = _N; // the number of components the operator has
37
38
39private:
40 size_t component_offset; // the number of libint components that should be skipped during access of calculated values (libint2::Operator::emultipole1 has 4 libint2 components, but in reality there should only be 1)
41 double scaling_factor; // a factor that is multiplied to all of the calculated integrals
42
43 using libint2_buffer_t = LibintInterfacer::libint_target_ptr_vec; // t for type
44 libint2_buffer_t libint2_buffer;
45
46
47public:
48 /*
49 * CONSTRUCTORS
50 */
51
59 LibintOneElectronIntegralBuffer(const libint2_buffer_t& libint2_buffer, const size_t nbf1, const size_t nbf2, const size_t component_offset = 0, const double scaling_factor = 1.0) :
60 libint2_buffer {libint2_buffer},
61 component_offset {component_offset},
62 scaling_factor {scaling_factor},
64
65
73 bool areIntegralsAllZero() const override { return (this->libint2_buffer[0] == nullptr); }
74
82 IntegralScalar value(const size_t i, const size_t f1, const size_t f2) const override {
83 return this->scaling_factor * this->libint2_buffer[i + this->component_offset][f2 + f1 * this->nbf2]; // integrals are packed in row-major form
84 }
85};
86
87
88} // namespace GQCP
Definition: BaseOneElectronIntegralBuffer.hpp:37
size_t nbf2
Definition: BaseOneElectronIntegralBuffer.hpp:45
size_t nbf1
Definition: BaseOneElectronIntegralBuffer.hpp:44
libint2::Engine::target_ptr_vec libint_target_ptr_vec
Definition: LibintInterfacer.hpp:45
Definition: LibintOneElectronIntegralBuffer.hpp:33
static constexpr auto N
Definition: LibintOneElectronIntegralBuffer.hpp:36
double IntegralScalar
Definition: LibintOneElectronIntegralBuffer.hpp:35
IntegralScalar value(const size_t i, const size_t f1, const size_t f2) const override
Definition: LibintOneElectronIntegralBuffer.hpp:82
LibintOneElectronIntegralBuffer(const libint2_buffer_t &libint2_buffer, const size_t nbf1, const size_t nbf2, const size_t component_offset=0, const double scaling_factor=1.0)
Definition: LibintOneElectronIntegralBuffer.hpp:59
bool areIntegralsAllZero() const override
Definition: LibintOneElectronIntegralBuffer.hpp:73
Definition: BaseOneElectronIntegralBuffer.hpp:25