GQCP
Loading...
Searching...
No Matches
LibintTwoElectronIntegralEngine.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
24
25
26namespace GQCP {
27
28
34template <size_t _N>
36public:
37 using IntegralScalar = double; // the scalar representation of an integral for libint is always a real number
38 static constexpr auto N = _N; // the number of components the operator has
39
40
41private:
42 libint2::Engine libint2_engine;
43
44
45public:
46 /*
47 * CONSTRUCTORS
48 */
49
55 LibintTwoElectronIntegralEngine(const CoulombRepulsionOperator& op, const size_t max_nprim, const size_t max_l) :
56 libint2_engine {LibintInterfacer::get().createEngine(op, max_nprim, max_l)} {}
57
58
59 /*
60 * PUBLIC OVERRIDDEN METHODS
61 */
62
71 std::shared_ptr<BaseTwoElectronIntegralBuffer<IntegralScalar, N>> calculate(const GTOShell& shell1, const GTOShell& shell2, const GTOShell& shell3, const GTOShell& shell4) override {
72
73 const auto libint_shell1 = LibintInterfacer::get().interface(shell1);
74 const auto libint_shell2 = LibintInterfacer::get().interface(shell2);
75 const auto libint_shell3 = LibintInterfacer::get().interface(shell3);
76 const auto libint_shell4 = LibintInterfacer::get().interface(shell4);
77
78 const auto& libint2_buffer = this->libint2_engine.results();
79 this->libint2_engine.compute(libint_shell1, libint_shell2, libint_shell3, libint_shell4);
80 return std::make_shared<LibintTwoElectronIntegralBuffer<N>>(libint2_buffer, shell1.numberOfBasisFunctions(), shell2.numberOfBasisFunctions(), shell3.numberOfBasisFunctions(), shell4.numberOfBasisFunctions());
81 }
82};
83
84
85} // namespace GQCP
Definition: BaseTwoElectronIntegralEngine.hpp:37
Definition: CoulombRepulsionOperator.hpp:31
Definition: GTOShell.hpp:32
size_t numberOfBasisFunctions() const
Definition: GTOShell.cpp:173
Definition: LibintInterfacer.hpp:43
libint2::svector< double > interface(const std::vector< double > &vector) const
Definition: LibintInterfacer.cpp:85
static LibintInterfacer & get()
Definition: LibintInterfacer.cpp:68
Definition: LibintTwoElectronIntegralEngine.hpp:35
std::shared_ptr< BaseTwoElectronIntegralBuffer< IntegralScalar, N > > calculate(const GTOShell &shell1, const GTOShell &shell2, const GTOShell &shell3, const GTOShell &shell4) override
Definition: LibintTwoElectronIntegralEngine.hpp:71
double IntegralScalar
Definition: LibintTwoElectronIntegralEngine.hpp:37
static constexpr auto N
Definition: LibintTwoElectronIntegralEngine.hpp:38
LibintTwoElectronIntegralEngine(const CoulombRepulsionOperator &op, const size_t max_nprim, const size_t max_l)
Definition: LibintTwoElectronIntegralEngine.hpp:55
Definition: BaseOneElectronIntegralBuffer.hpp:25