GQCP
Loading...
Searching...
No Matches
CIEnvironment.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
23
24namespace GQCP {
25namespace CIEnvironment {
26
27
39template <typename Hamiltonian, typename ONVBasis>
40auto Dense(const Hamiltonian& hamiltonian, const ONVBasis& onv_basis) -> EigenproblemEnvironment<typename Hamiltonian::Scalar> {
41
42 using Scalar = typename Hamiltonian::Scalar; // The scalar type of a Hamiltonian element.
43
44 // Determine the dense matrix representation of the Hamiltonian in the given ONV basis, and supply it to an `EigenproblemEnvironment`.
45 const auto H = onv_basis.evaluateOperatorDense(hamiltonian);
47}
48
49
62template <typename Hamiltonian, typename ONVBasis>
63EigenproblemEnvironment<double> Iterative(const Hamiltonian& hamiltonian, const ONVBasis& onv_basis, const MatrixX<double>& V) {
64
65 // Determine the diagonal of the Hamiltonian matrix representation, and supply a matrix-vector product function to the `EigenproblemEnvironment`.
66 const auto diagonal = onv_basis.evaluateOperatorDiagonal(hamiltonian);
67 const auto matvec_function = [&hamiltonian, &onv_basis](const VectorX<double>& x) { return onv_basis.evaluateOperatorMatrixVectorProduct(hamiltonian, x); };
68
69 return EigenproblemEnvironment<double>::Iterative(matvec_function, diagonal, V);
70}
71
72
73} // namespace CIEnvironment
74} // namespace GQCP
Definition: EigenproblemEnvironment.hpp:35
static EigenproblemEnvironment Iterative(const VectorFunction< Scalar > &matrix_vector_product_function, const VectorX< Scalar > &diagonal, const MatrixX< Scalar > &V)
Definition: EigenproblemEnvironment.hpp:130
static EigenproblemEnvironment Dense(const SquareMatrix< Scalar > &A)
Definition: EigenproblemEnvironment.hpp:121
Definition: Matrix.hpp:47
auto Dense(const Hamiltonian &hamiltonian, const ONVBasis &onv_basis) -> EigenproblemEnvironment< typename Hamiltonian::Scalar >
Definition: CIEnvironment.hpp:40
EigenproblemEnvironment< double > Iterative(const Hamiltonian &hamiltonian, const ONVBasis &onv_basis, const MatrixX< double > &V)
Definition: CIEnvironment.hpp:63
Definition: BaseOneElectronIntegralBuffer.hpp:25
@ x
Definition: CartesianDirection.hpp:28