GQCP
Loading...
Searching...
No Matches
CIElectricalResponseSolver.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// #include "Processing/Properties/BaseElectricalResponseSolver.hpp"
21// #include "QCModel/CI/LinearExpansion.hpp"
22
23
24// namespace GQCP {
25
26
27// /**
28// * A class whose instances can solve the response equations for CI.
29// */
30// template <typename _ONVBasis>
31// class CIElectricalResponseSolver: public BaseElectricalResponseSolver {
32// public:
33// using ONVBasis = _ONVBasis;
34
35
36// private:
37// LinearExpansion<ONVBasis> linear_expansion; // the CI linear expansion
38
39
40// public:
41// // CONSTRUCTORS
42
43// /**
44// * @param linear_expansion the CI linear expansion
45// */
46// CIElectricalResponseSolver(const LinearExpansion<ONVBasis>& linear_expansion) :
47// linear_expansion {linear_expansion} {}
48
49
50// // PUBLIC OVERRIDDEN METHODS
51
52// /**
53// * @param sq_hamiltonian the Hamiltonian expressed in an orthonormal orbital basis
54// *
55// * @return the parameter response constant (k_p), i.e. the second-order parameter partial derivative of the CI energy function
56// */
57// // SquareMatrix<double> calculateParameterResponseConstant(const RSQHamiltonian<double>& sq_hamiltonian) const override {
58
59// // // k_p for CI models is just the electronic Hamiltonian evaluated in the ONV basis
60// // return 2 * this->linear_expansion.onvBasis().evaluateOperatorDense(sq_hamiltonian, true); // true: need to calculate diagonal values as well
61// // }
62
63// /**
64// * @param dipole_op the dipole integrals in an orthonormal orbital basis
65// *
66// * @return the parameter response force (F_p), i.e. the first-order parameter partial derivative of the perturbation derivative of the CI energy function
67// */
68// Matrix<double, Dynamic, 3> calculateParameterResponseForce(const VectorRSQOneElectronOperator<double>& dipole_op) const override {
69
70// // Prepare some variables.
71// const auto dim = this->linear_expansion.onvBasis().dimension();
72// const auto& c = this->linear_expansion.coefficients();
73
74// // F_p for CI is related to the matrix-vector product of the total dipole operator and the CI expansion.
75// Matrix<double, Dynamic, 3> F_p = Matrix<double, Dynamic, 3>::Zero(dim, 3);
76// for (size_t m = 0; m < 3; m++) { // m loops over the components of the electrical dipole
77// const auto& mu_m = dipole_op[m];
78
79// // Calculate the matrix-vector product of the dipole operator and the CI expansion.
80// const auto diagonal = this->linear_expansion.onvBasis().evaluateOperatorDiagonal(mu_m);
81// F_p.col(m) = -2 * this->linear_expansion.onvBasis().evaluateOperatorMatrixVectorProduct(mu_m, c, diagonal);
82// }
83
84// return F_p;
85// }
86// };
87
88
89// } // namespace GQCP