GQCP
Loading...
Searching...
No Matches
DiagonalRHFFockMatrixObjective.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
21#include "QCModel/HF/RHF.hpp"
22
23
24namespace GQCP {
25
26
32template <typename _Scalar>
34
35public:
36 using Scalar = _Scalar;
37
38
39private:
40 double precision; // The precision with which the diagonality of the Fock matrix should be checked.
41 RSQHamiltonian<Scalar> sq_hamiltonian; // The Hamiltonian expressed in a scalar basis.
42
43
44public:
45 /*
46 * CONSTRUCTORS
47 */
48
52 DiagonalRHFFockMatrixObjective(const RSQHamiltonian<Scalar>& sq_hamiltonian, const double precision = 1.0e-08) :
53 precision {precision},
54 sq_hamiltonian {sq_hamiltonian} {}
55
56
57 /*
58 * PUBLIC METHODS
59 */
60
66 bool isSatisfiedWith(const QCModel::RHF<Scalar>& rhf_parameters) const {
67
68 // Prepare the calculation of the Fock matrix in the spinor basis.
69 const auto N_P = rhf_parameters.numberOfElectronPairs();
70 const auto C = rhf_parameters.expansion();
71 const auto D = QCModel::RHF<Scalar>::calculateScalarBasis1DM(C, 2 * N_P);
72
73 // Calculate the Fock matrix in the orthonormal spinor and check if it is diagonal.
74 auto F_orthonormal = QCModel::RHF<Scalar>::calculateScalarBasisFockMatrix(D, this->sq_hamiltonian); // The converged Fock matrix (expressed in the scalar orbital basis).
75 F_orthonormal.transform(C); // Now in the orthonormal spinor basis.
76 return F_orthonormal.parameters().isDiagonal(this->precision);
77 }
78};
79
80
81} // namespace GQCP
Definition: DiagonalRHFFockMatrixObjective.hpp:33
DiagonalRHFFockMatrixObjective(const RSQHamiltonian< Scalar > &sq_hamiltonian, const double precision=1.0e-08)
Definition: DiagonalRHFFockMatrixObjective.hpp:52
_Scalar Scalar
Definition: DiagonalRHFFockMatrixObjective.hpp:36
bool isSatisfiedWith(const QCModel::RHF< Scalar > &rhf_parameters) const
Definition: DiagonalRHFFockMatrixObjective.hpp:66
Definition: RHF.hpp:49
Orbital1DM< Scalar > calculateScalarBasis1DM() const
Definition: RHF.hpp:709
static ScalarRSQOneElectronOperator< Scalar > calculateScalarBasisFockMatrix(const Orbital1DM< Scalar > &D, const RSQHamiltonian< Scalar > &sq_hamiltonian)
Definition: RHF.hpp:750
size_t numberOfElectronPairs() const
Definition: RHF.hpp:852
const RTransformation< Scalar > & expansion() const
Definition: RHF.hpp:847
Definition: SQHamiltonian.hpp:54
Definition: BaseOneElectronIntegralBuffer.hpp:25