votca 2024.1-dev
Loading...
Searching...
No Matches
ImaginaryAxisIntegration.cc
Go to the documentation of this file.
1
2/*
3 * Copyright 2009-2023 The VOTCA Development Team
4 * (http://www.votca.org)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License")
7 *
8 * You may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
22
26
27namespace votca {
28namespace xtp {
29
31 const Eigen::VectorXd& energies, const TCMatrix_gwbse& Mmn)
32 : energies_(energies), Mmn_(Mmn) {}
33
35 options opt, const RPA& rpa, const Eigen::MatrixXd& kDielMxInv_zero) {
36 opt_ = opt;
38 gq_->configure(opt_.order);
39
40 CalcDielInvVector(rpa, kDielMxInv_zero);
41}
42
43// This function calculates and stores inverses of the microscopic dielectric
44// matrix in a matrix vector
46 const RPA& rpa, const Eigen::MatrixXd& kDielMxInv_zero) {
47 dielinv_matrices_r_.resize(gq_->Order());
48
49 for (Index j = 0; j < gq_->Order(); j++) {
50 double newpoint = gq_->ScaledPoint(j);
51 Eigen::MatrixXd eps_inv_j = rpa.calculate_epsilon_i(newpoint).inverse();
52 eps_inv_j.diagonal().array() -= 1.0;
54 -eps_inv_j +
55 kDielMxInv_zero * std::exp(-std::pow(opt_.alpha * newpoint, 2));
56 }
57}
58
60 public:
61 FunctionEvaluation(const Eigen::MatrixXd& Imx, const Eigen::ArrayXcd& DeltaE,
62 const std::vector<Eigen::MatrixXd>& dielinv_matrices_r)
63 : Imx_(Imx), DeltaE_(DeltaE), dielinv_matrices_r_(dielinv_matrices_r) {};
64
65 double operator()(Index j, double point, bool symmetry) const {
66 Eigen::VectorXcd denominator;
67 const std::complex<double> cpoint(0.0, point);
68 if (symmetry) {
69 denominator =
70 (DeltaE_ + cpoint).cwiseInverse() + (DeltaE_ - cpoint).cwiseInverse();
71 } else {
72 denominator = (DeltaE_ + cpoint).cwiseInverse();
73 }
74 return 0.5 / tools::conv::Pi *
75 ((Imx_ * (dielinv_matrices_r_[j].conjugate()))
76 .cwiseProduct(denominator.asDiagonal() * Imx_))
77 .sum()
78 .real();
79 }
80
81 private:
82 const Eigen::MatrixXd& Imx_;
83 const Eigen::ArrayXcd& DeltaE_;
84 const std::vector<Eigen::MatrixXd>& dielinv_matrices_r_;
85};
86
87double ImaginaryAxisIntegration::SigmaGQDiag(double frequency, Index gw_level,
88 double eta) const {
89 Index lumo = opt_.homo + 1;
90 const Index occ = lumo - opt_.rpamin;
91 const Index unocc = opt_.rpamax - opt_.homo;
92 Index gw_level_offset = gw_level + opt_.qpmin - opt_.rpamin;
93 const Eigen::MatrixXd& Imx = Mmn_[gw_level_offset];
94 Eigen::ArrayXcd DeltaE = frequency - energies_.array();
95 DeltaE.imag().head(occ) = eta;
96 DeltaE.imag().tail(unocc) = -eta;
98 return gq_->Integrate(f);
99}
100
101} // namespace xtp
102
103} // namespace votca
virtual std::unique_ptr< T > Create(const key_t &key, args_t &&...arguments)
const std::vector< Eigen::MatrixXd > & dielinv_matrices_r_
double operator()(Index j, double point, bool symmetry) const
FunctionEvaluation(const Eigen::MatrixXd &Imx, const Eigen::ArrayXcd &DeltaE, const std::vector< Eigen::MatrixXd > &dielinv_matrices_r)
double SigmaGQDiag(double frequency, Index gw_level, double eta) const
void CalcDielInvVector(const RPA &rpa, const Eigen::MatrixXd &kDielMxInv_zero)
std::vector< Eigen::MatrixXd > dielinv_matrices_r_
ImaginaryAxisIntegration(const Eigen::VectorXd &energies, const TCMatrix_gwbse &Mmn)
void configure(options opt, const RPA &rpa, const Eigen::MatrixXd &kDielMxInv_zero)
std::unique_ptr< GaussianQuadratureBase > gq_
Eigen::MatrixXd calculate_epsilon_i(double frequency) const
Definition rpa.h:47
const double Pi
Definition constants.h:36
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26