GQCP
Loading...
Searching...
No Matches
CCSDEnergyCalculation.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
23
24
25namespace GQCP {
26
27
33template <typename _Scalar>
35 public Step<CCSDEnvironment<_Scalar>> {
36
37public:
38 using Scalar = _Scalar;
40
41
42public:
43 /*
44 * PUBLIC OVERRIDDEN METHODS
45 */
46
50 std::string description() const override {
51 return "Calculate the current CCSD electronic correlation energy.";
52 }
53
54
60 void execute(Environment& environment) override {
61
62 // Prepare some variables.
63 const auto& f = environment.f;
64 const auto& V_A = environment.V_A;
65 const auto& t1 = environment.t1_amplitudes.back();
66 const auto& t2 = environment.t2_amplitudes.back();
67
68 // Calculate the current correlation energy and push it to the environment.
69 const auto current_correlation_energy = QCModel::CCSD<Scalar>::calculateCorrelationEnergy(f, V_A, t1, t2);
70 environment.correlation_energies.push_back(current_correlation_energy);
71 }
72};
73
74
75} // namespace GQCP
Definition: CCSDEnergyCalculation.hpp:35
void execute(Environment &environment) override
Definition: CCSDEnergyCalculation.hpp:60
std::string description() const override
Definition: CCSDEnergyCalculation.hpp:50
_Scalar Scalar
Definition: CCSDEnergyCalculation.hpp:38
Definition: CCSDEnvironment.hpp:39
SquareRankFourTensor< Scalar > V_A
Definition: CCSDEnvironment.hpp:55
std::deque< T2Amplitudes< Scalar > > t2_amplitudes
Definition: CCSDEnvironment.hpp:49
SquareMatrix< Scalar > f
Definition: CCSDEnvironment.hpp:54
std::deque< Scalar > correlation_energies
Definition: CCSDEnvironment.hpp:46
std::deque< T1Amplitudes< Scalar > > t1_amplitudes
Definition: CCSDEnvironment.hpp:48
static Scalar calculateCorrelationEnergy(const SquareMatrix< Scalar > &f, const SquareRankFourTensor< Scalar > &V_A, const T1Amplitudes< Scalar > &t1, const T2Amplitudes< Scalar > &t2)
Definition: CCSD.hpp:77
Definition: Step.hpp:37
Definition: BaseOneElectronIntegralBuffer.hpp:25