GQCP
Loading...
Searching...
No Matches
GHFElectronicEnergyCalculation.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#include "QCModel/HF/GHF.hpp"
24
25
26namespace GQCP {
27
28
34template <typename _Scalar>
36 public Step<GHFSCFEnvironment<_Scalar>> {
37
38public:
39 using Scalar = _Scalar;
41
42
43public:
44 /*
45 * OVERRIDDEN PUBLIC METHODS
46 */
47
51 std::string description() const override {
52 return "Calculate the current electronic GHF energy and place it in the environment.";
53 }
54
55
61 void execute(Environment& environment) override {
62
63 const auto& P = environment.density_matrices.back(); // The most recent density matrix.
64 const ScalarGSQOneElectronOperator<Scalar> F {environment.fock_matrices.back()}; // The most recent Fock matrix.
65 const auto& H_core = environment.sq_hamiltonian.core(); // The core Hamiltonian matrix.
66
67 const auto E_electronic = QCModel::GHF<Scalar>::calculateElectronicEnergy(P, H_core, F);
68 environment.electronic_energies.push_back(E_electronic);
69 }
70};
71
72
73} // namespace GQCP
Definition: GHFElectronicEnergyCalculation.hpp:36
void execute(Environment &environment) override
Definition: GHFElectronicEnergyCalculation.hpp:61
_Scalar Scalar
Definition: GHFElectronicEnergyCalculation.hpp:39
std::string description() const override
Definition: GHFElectronicEnergyCalculation.hpp:51
Definition: GHFSCFEnvironment.hpp:45
GSQHamiltonian< Scalar > sq_hamiltonian
Definition: GHFSCFEnvironment.hpp:64
std::deque< G1DM< Scalar > > density_matrices
Definition: GHFSCFEnvironment.hpp:60
std::deque< Scalar > electronic_energies
Definition: GHFSCFEnvironment.hpp:53
std::deque< ScalarGSQOneElectronOperator< Scalar > > fock_matrices
Definition: GHFSCFEnvironment.hpp:61
Definition: GSQOneElectronOperator.hpp:42
static Scalar calculateElectronicEnergy(const G1DM< Scalar > &P, const ScalarGSQOneElectronOperator< Scalar > &H_core, const ScalarGSQOneElectronOperator< Scalar > &F)
Definition: GHF.hpp:103
Definition: Step.hpp:37
Definition: BaseOneElectronIntegralBuffer.hpp:25