GQCP
Loading...
Searching...
No Matches
LibintOneElectronIntegralEngine.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
25
26
27namespace GQCP {
28
29
35template <size_t _N>
37public:
38 using IntegralScalar = double; // the scalar representation of an integral for libint is always a real number
39 static constexpr auto N = _N; // the number of components the operator has
40
41
42private:
43 libint2::Engine libint2_engine;
44
45
46 // Parameters to give to the buffer
47 size_t component_offset = 0; // 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)
48 double scaling_factor = 1.0; // a factor that is multiplied to all of the calculated integrals
49
50
51public:
52 /*
53 * CONSTRUCTORS
54 */
55
61 LibintOneElectronIntegralEngine(const ElectronicDipoleOperator& op, const size_t max_nprim, const size_t max_l) :
62 libint2_engine {LibintInterfacer::get().createEngine(op, max_nprim, max_l)},
63 component_offset {1}, // emultipole1 has [overlap, x, y, z], we don't need the overlap
64 scaling_factor {-1.0} { // apply the minus sign which comes from the charge of the electrons -e
65
66 std::array<double, 3> libint2_origin_array {op.reference().x(), op.reference().y(), op.reference().z()};
67 this->libint2_engine.set_params(libint2_origin_array);
68 }
69
75 LibintOneElectronIntegralEngine(const KineticOperator& op, const size_t max_nprim, const size_t max_l) :
76 libint2_engine {LibintInterfacer::get().createEngine(op, max_nprim, max_l)} {}
77
83 LibintOneElectronIntegralEngine(const NuclearAttractionOperator& op, const size_t max_nprim, const size_t max_l) :
84 libint2_engine {LibintInterfacer::get().createEngine(op, max_nprim, max_l)} {
86 this->libint2_engine.set_params(libint2::make_point_charges(libint_atoms));
87 }
88
94 LibintOneElectronIntegralEngine(const OverlapOperator& op, const size_t max_nprim, const size_t max_l) :
95 libint2_engine {LibintInterfacer::get().createEngine(op, max_nprim, max_l)} {}
96
97
98 /*
99 * PUBLIC OVERRIDDEN METHODS
100 */
101
106 std::shared_ptr<BaseOneElectronIntegralBuffer<IntegralScalar, N>> calculate(const GTOShell& shell1, const GTOShell& shell2) override {
107
108 const auto libint_shell1 = LibintInterfacer::get().interface(shell1);
109 const auto libint_shell2 = LibintInterfacer::get().interface(shell2);
110
111 const auto& libint2_buffer = this->libint2_engine.results();
112 this->libint2_engine.compute(libint_shell1, libint_shell2);
113 return std::make_shared<LibintOneElectronIntegralBuffer<N>>(libint2_buffer, shell1.numberOfBasisFunctions(), shell2.numberOfBasisFunctions(), this->component_offset, this->scaling_factor);
114 }
115};
116
117
118} // namespace GQCP
const NuclearFramework & nuclearFramework() const
Definition: BaseNuclearOperator.hpp:70
Definition: BaseOneElectronIntegralEngine.hpp:37
const Vector< double, 3 > & reference() const
Definition: BaseReferenceDependentOperator.hpp:66
Definition: ElectronicDipoleOperator.hpp:33
Definition: GTOShell.hpp:32
size_t numberOfBasisFunctions() const
Definition: GTOShell.cpp:173
Definition: KineticOperator.hpp:31
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: LibintOneElectronIntegralEngine.hpp:36
static constexpr auto N
Definition: LibintOneElectronIntegralEngine.hpp:39
LibintOneElectronIntegralEngine(const OverlapOperator &op, const size_t max_nprim, const size_t max_l)
Definition: LibintOneElectronIntegralEngine.hpp:94
LibintOneElectronIntegralEngine(const NuclearAttractionOperator &op, const size_t max_nprim, const size_t max_l)
Definition: LibintOneElectronIntegralEngine.hpp:83
double IntegralScalar
Definition: LibintOneElectronIntegralEngine.hpp:38
LibintOneElectronIntegralEngine(const ElectronicDipoleOperator &op, const size_t max_nprim, const size_t max_l)
Definition: LibintOneElectronIntegralEngine.hpp:61
LibintOneElectronIntegralEngine(const KineticOperator &op, const size_t max_nprim, const size_t max_l)
Definition: LibintOneElectronIntegralEngine.hpp:75
std::shared_ptr< BaseOneElectronIntegralBuffer< IntegralScalar, N > > calculate(const GTOShell &shell1, const GTOShell &shell2) override
Definition: LibintOneElectronIntegralEngine.hpp:106
Definition: NuclearAttractionOperator.hpp:33
const std::vector< Nucleus > & nucleiAsVector() const
Definition: NuclearFramework.hpp:133
Definition: OverlapOperator.hpp:31
Definition: BaseOneElectronIntegralBuffer.hpp:25