GQCP
Loading...
Searching...
No Matches
CCSDEnvironment.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#include "QCModel/CC/CCD.hpp"
23#include "QCModel/CC/CCSD.hpp"
26
27#include <deque>
28
29
30namespace GQCP {
31
32
38template <typename _Scalar>
40public:
41 // The scalar type that represents one of the amplitudes.
42 using Scalar = _Scalar;
43
44
45public:
46 std::deque<Scalar> correlation_energies; // The electronic correlation energies.
47
48 std::deque<T1Amplitudes<Scalar>> t1_amplitudes;
49 std::deque<T2Amplitudes<Scalar>> t2_amplitudes;
50
51 std::deque<VectorX<Scalar>> t1_amplitude_errors;
52 std::deque<VectorX<Scalar>> t2_amplitude_errors;
53
54 SquareMatrix<Scalar> f; // The elements of the (inactive) Fock matrix.
55 SquareRankFourTensor<Scalar> V_A; // The antisymmetrized two-electron integrals (in physicist's notation).
56
57 ImplicitMatrixSlice<Scalar> F1; // An intermediate that represents equation (3) in Stanton1991.
58 ImplicitMatrixSlice<Scalar> F2; // An intermediate that represents equation (4) in Stanton1991.
59 ImplicitMatrixSlice<Scalar> F3; // An intermediate that represents equation (5) in Stanton1991.
60
61 ImplicitRankFourTensorSlice<Scalar> W1; // An intermediate that represents equation (6) in Stanton1991.
62 ImplicitRankFourTensorSlice<Scalar> W2; // An intermediate that represents equation (7) in Stanton1991.
63 ImplicitRankFourTensorSlice<Scalar> W3; // An intermediate that represents equation (8) in Stanton1991.
64
65 ImplicitRankFourTensorSlice<Scalar> tau2; // An intermediate that represents equation (10) in Stanton1991.
66 ImplicitRankFourTensorSlice<Scalar> tau2_tilde; // An intermediate that represents equation (9) in Stanton1991.
67
68
69public:
70 /*
71 * MARK: Constructors
72 */
73
83 correlation_energies {QCModel::CCSD<Scalar>::calculateCorrelationEnergy(f, V_A, t1_amplitudes, t2_amplitudes)}, // already calculate the initial CCSD energy correction
86 f {f},
87 V_A {V_A} {}
88
89
98 correlation_energies {QCModel::CCD<Scalar>::calculateCorrelationEnergy(f, V_A, t2_amplitudes)}, // Make sure to calculate the initial CCD energy correction already.
100 f {f},
101 V_A {V_A} {}
102
103
104 /*
105 * MARK: Named constructors
106 */
107
116 static CCSDEnvironment<Scalar> PerturbativeCCSD(const GSQHamiltonian<Scalar>& sq_hamiltonian, const OrbitalSpace& orbital_space) {
117
118 // For the CCSD environment equation, we need the inactive Fock matrix and the anti-symmetrized two-electron integrals in physicist's notation.
119 const auto f = sq_hamiltonian.calculateInactiveFockian(orbital_space).parameters();
120
121 const auto& g_chemists = sq_hamiltonian.twoElectron();
122 const auto V_A = g_chemists.convertedToPhysicistsNotation().antisymmetrized().parameters();
123
124
125 const auto t1_amplitudes = T1Amplitudes<Scalar>::Perturbative(f, orbital_space);
126 const auto t2_amplitudes = T2Amplitudes<Scalar>::Perturbative(f, V_A, orbital_space);
127
129 }
130
131
140 static CCSDEnvironment<Scalar> PerturbativeCCD(const GSQHamiltonian<Scalar>& sq_hamiltonian, const OrbitalSpace& orbital_space) {
141
142 // For the CCSD environment equation, we need the inactive Fock matrix and the anti-symmetrized two-electron integrals in physicist's notation.
143 const auto f = sq_hamiltonian.calculateInactiveFockian(orbital_space).parameters();
144
145 const auto& g_chemists = sq_hamiltonian.twoElectron();
146 const auto V_A = g_chemists.convertedToPhysicistsNotation().antisymmetrized().parameters();
147
148 const auto t2_amplitudes = T2Amplitudes<Scalar>::Perturbative(f, V_A, orbital_space);
149
151 }
152};
153
154
155} // namespace GQCP
Definition: CCSDEnvironment.hpp:39
ImplicitRankFourTensorSlice< Scalar > tau2_tilde
Definition: CCSDEnvironment.hpp:66
SquareRankFourTensor< Scalar > V_A
Definition: CCSDEnvironment.hpp:55
std::deque< T2Amplitudes< Scalar > > t2_amplitudes
Definition: CCSDEnvironment.hpp:49
ImplicitRankFourTensorSlice< Scalar > W2
Definition: CCSDEnvironment.hpp:62
_Scalar Scalar
Definition: CCSDEnvironment.hpp:42
CCSDEnvironment(const T2Amplitudes< Scalar > &t2_amplitudes, const SquareMatrix< Scalar > &f, const SquareRankFourTensor< Scalar > &V_A)
Definition: CCSDEnvironment.hpp:97
ImplicitMatrixSlice< Scalar > F1
Definition: CCSDEnvironment.hpp:57
ImplicitRankFourTensorSlice< Scalar > tau2
Definition: CCSDEnvironment.hpp:65
std::deque< VectorX< Scalar > > t1_amplitude_errors
Definition: CCSDEnvironment.hpp:51
CCSDEnvironment(const T1Amplitudes< Scalar > &t1_amplitudes, const T2Amplitudes< Scalar > &t2_amplitudes, const SquareMatrix< Scalar > &f, const SquareRankFourTensor< Scalar > &V_A)
Definition: CCSDEnvironment.hpp:82
SquareMatrix< Scalar > f
Definition: CCSDEnvironment.hpp:54
std::deque< VectorX< Scalar > > t2_amplitude_errors
Definition: CCSDEnvironment.hpp:52
ImplicitMatrixSlice< Scalar > F3
Definition: CCSDEnvironment.hpp:59
std::deque< Scalar > correlation_energies
Definition: CCSDEnvironment.hpp:46
static CCSDEnvironment< Scalar > PerturbativeCCD(const GSQHamiltonian< Scalar > &sq_hamiltonian, const OrbitalSpace &orbital_space)
Definition: CCSDEnvironment.hpp:140
std::deque< T1Amplitudes< Scalar > > t1_amplitudes
Definition: CCSDEnvironment.hpp:48
ImplicitMatrixSlice< Scalar > F2
Definition: CCSDEnvironment.hpp:58
static CCSDEnvironment< Scalar > PerturbativeCCSD(const GSQHamiltonian< Scalar > &sq_hamiltonian, const OrbitalSpace &orbital_space)
Definition: CCSDEnvironment.hpp:116
ImplicitRankFourTensorSlice< Scalar > W3
Definition: CCSDEnvironment.hpp:63
ImplicitRankFourTensorSlice< Scalar > W1
Definition: CCSDEnvironment.hpp:61
Definition: ImplicitMatrixSlice.hpp:38
Definition: ImplicitRankFourTensorSlice.hpp:38
Definition: OrbitalSpace.hpp:40
Definition: SQHamiltonian.hpp:54
enable_if_t< std::is_same< Z, GeneralSpinorTag >::value, ScalarSQOneElectronOperator > calculateInactiveFockian(const OrbitalSpace orbital_space) const
Definition: SQHamiltonian.hpp:465
const ScalarSQTwoElectronOperator & twoElectron() const
Definition: SQHamiltonian.hpp:338
Definition: SquareMatrix.hpp:39
Definition: SquareRankFourTensor.hpp:36
Definition: T1Amplitudes.hpp:40
static T1Amplitudes< Scalar > Perturbative(const SquareMatrix< Scalar > &f, const OrbitalSpace &orbital_space)
Definition: T1Amplitudes.hpp:97
Definition: T2Amplitudes.hpp:39
static T2Amplitudes< Scalar > Perturbative(const SquareMatrix< Scalar > &f, const SquareRankFourTensor< Scalar > &V_A, const OrbitalSpace &orbital_space)
Definition: T2Amplitudes.hpp:96
Definition: BaseOneElectronIntegralBuffer.hpp:25