votca 2024.1-dev
Loading...
Searching...
No Matches
sigma_ppm.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20// VOTCA includes
22#include <votca/tools/globals.h>
23
24// Local VOTCA includes
25#include "sigma_ppm.h"
26#include "votca/xtp/ppm.h"
28
29namespace votca {
30namespace xtp {
31
36
38 double frequency) const {
39 const Index lumo = opt_.homo + 1;
40 const double eta2 = opt_.eta * opt_.eta;
41 const Index levelsum = Mmn_.nsize(); // total number of bands
42 const Index qpmin_offset = opt_.qpmin - opt_.rpamin;
43 double sigma = 0.0;
44 for (Index i_aux = 0; i_aux < Mmn_.auxsize(); i_aux++) {
45 // the ppm_weights smaller 1.e-5 are set to zero in rpa.cc
46 // PPM_construct_parameters
47 if (ppm_.getPpm_weight()(i_aux) < 1.e-9) {
48 continue;
49 }
50 const double ppm_freq = ppm_.getPpm_freq()(i_aux);
51 const double fac = 0.5 * ppm_.getPpm_weight()(i_aux) * ppm_freq;
52 const Eigen::ArrayXd Mmn2 =
53 Mmn_[gw_level + qpmin_offset].col(i_aux).cwiseAbs2();
54 Eigen::ArrayXd temp = frequency - rpa_.getRPAInputEnergies().array();
55 temp.segment(0, lumo) += ppm_freq;
56 temp.segment(lumo, levelsum - lumo) -= ppm_freq;
57 Eigen::ArrayXd denom = temp.abs2() + eta2;
58 sigma += fac * (Mmn2 * temp / denom).sum();
59 }
60 return sigma;
61}
62
64 double frequency) const {
65 const Index lumo = opt_.homo + 1;
66 const double eta2 = opt_.eta * opt_.eta;
67 const Index levelsum = Mmn_.nsize(); // total number of bands
68 const Index qpmin_offset = opt_.qpmin - opt_.rpamin;
69 double dsigma_domega = 0.0;
70 for (Index i_aux = 0; i_aux < Mmn_.auxsize(); i_aux++) {
71 // the ppm_weights smaller 1.e-5 are set to zero in rpa.cc
72 // PPM_construct_parameters
73 if (ppm_.getPpm_weight()(i_aux) < 1.e-9) {
74 continue;
75 }
76 const double ppm_freq = ppm_.getPpm_freq()(i_aux);
77 const double fac = 0.5 * ppm_.getPpm_weight()(i_aux) * ppm_freq;
78 const Eigen::ArrayXd Mmn2 =
79 Mmn_[gw_level + qpmin_offset].col(i_aux).cwiseAbs2();
80 Eigen::ArrayXd temp = frequency - rpa_.getRPAInputEnergies().array();
81 temp.segment(0, lumo) += ppm_freq;
82 temp.segment(lumo, levelsum - lumo) -= ppm_freq;
83 Eigen::ArrayXd denom = temp.abs2() + eta2;
84 dsigma_domega += fac * ((eta2 - temp.abs2()) * Mmn2 / denom.abs2()).sum();
85 }
86 return dsigma_domega;
87}
88
90 Index gw_level2,
91 double frequency1,
92 double frequency2) const {
93 const Index lumo = opt_.homo + 1;
94 const double eta2 = opt_.eta * opt_.eta;
95 const Index levelsum = Mmn_.nsize(); // total number of bands
96 const Index auxsize = Mmn_.auxsize(); // size of the GW basis
97 const Eigen::VectorXd ppm_weight = ppm_.getPpm_weight();
98 const Eigen::VectorXd ppm_freqs = ppm_.getPpm_freq();
99 const Index qpmin_offset = opt_.qpmin - opt_.rpamin;
100 const Eigen::VectorXd RPAEnergies = rpa_.getRPAInputEnergies();
101 double sigma_c = 0;
102 for (Index i_aux = 0; i_aux < auxsize; i_aux++) {
103 // the ppm_weights smaller 1.e-5 are set to zero in rpa.cc
104 // PPM_construct_parameters
105 if (ppm_weight(i_aux) < 1.e-9) {
106 continue;
107 }
108 const double ppm_freq = ppm_freqs(i_aux);
109 const double fac = 0.25 * ppm_weight(i_aux) * ppm_freq;
110 const Eigen::MatrixXd& Mmn1 = Mmn_[gw_level1 + qpmin_offset];
111 const Eigen::MatrixXd& Mmn2 = Mmn_[gw_level2 + qpmin_offset];
112 const Eigen::ArrayXd Mmn1xMmn2 =
113 Mmn1.col(i_aux).cwiseProduct(Mmn2.col(i_aux));
114 Eigen::ArrayXd temp1 = RPAEnergies;
115 temp1.segment(0, lumo) -= ppm_freq;
116 temp1.segment(lumo, levelsum - lumo) += ppm_freq;
117 Eigen::ArrayXd temp2 = (frequency2 - temp1);
118 temp1 = (frequency1 - temp1);
119 sigma_c +=
120 fac * ((temp1 / (temp1.abs2() + eta2) + temp2 / (temp2.abs2() + eta2)) *
121 Mmn1xMmn2)
122 .sum();
123 }
124 return sigma_c;
125}
126
127} // namespace xtp
128} // namespace votca
const Eigen::MatrixXd & getPpm_phi() const
Definition ppm.h:43
void PPM_construct_parameters(const RPA &rpa)
Definition ppm.cc:29
const Eigen::VectorXd & getPpm_weight() const
Definition ppm.h:39
const Eigen::VectorXd & getPpm_freq() const
Definition ppm.h:41
const Eigen::VectorXd & getRPAInputEnergies() const
Definition rpa.h:57
double CalcCorrelationOffDiagElement(Index gw_level1, Index gw_level2, double frequency1, double frequency2) const final
Definition sigma_ppm.cc:89
double CalcCorrelationDiagElement(Index gw_level, double frequency) const final
Definition sigma_ppm.cc:37
void PrepareScreening() final
Definition sigma_ppm.cc:32
double CalcCorrelationDiagElementDerivative(Index gw_level, double frequency) const final
Definition sigma_ppm.cc:63
TCMatrix_gwbse & Mmn_
Definition sigma_base.h:79
void MultiplyRightWithAuxMatrix(const Eigen::MatrixXd &matrix)
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26