33#pragma omp parallel for schedule(dynamic)
41 double frequency)
const {
49 const Eigen::ArrayXd res_12 =
residues_[gw_level].col(s).cwiseAbs2();
51 temp.segment(0, n_occ) += eigenvalue;
52 temp.segment(n_occ, n_unocc) -= eigenvalue;
53 const Eigen::ArrayXd denom = temp.abs2() + eta2;
54 sigma += (res_12 * temp / denom).sum();
60 Index gw_level,
double frequency)
const {
65 double dsigma_domega = 0.0;
68 const Eigen::ArrayXd res_12 =
residues_[gw_level].col(s).cwiseAbs2();
70 temp.segment(0, n_occ) += eigenvalue;
71 temp.segment(n_occ, n_unocc) -= eigenvalue;
72 const Eigen::ArrayXd denom = temp.abs2() + eta2;
73 dsigma_domega += ((eta2 - temp.abs2()) * res_12 / denom.abs2()).sum();
75 return 2 * dsigma_domega;
81 double frequency2)
const {
88 for (
Index s = 0; s < rpasize; s++) {
90 const Eigen::VectorXd& res1 =
residues_[gw_level1].col(s);
91 const Eigen::VectorXd& res2 =
residues_[gw_level2].col(s);
92 const Eigen::VectorXd res_12 = res1.cwiseProduct(res2);
94 temp1.segment(0, n_occ) += eigenvalue;
95 temp1.segment(n_occ, n_unocc) -= eigenvalue;
96 const Eigen::ArrayXd temp2 = temp1 + frequency2;
98 const Eigen::ArrayXd numer1 = res_12.array() * temp1;
99 const Eigen::ArrayXd numer2 = res_12.array() * temp2;
100 const Eigen::ArrayXd denom1 = temp1.abs2() + eta2;
101 const Eigen::ArrayXd denom2 = temp2.abs2() + eta2;
102 sigma_c += 0.5 * ((numer1 / denom1) + (numer2 / denom2)).sum();
105 return 2.0 * sigma_c;
109 const Eigen::MatrixXd& XpY)
const {
113 const Index rpasize = n_occ * n_unocc;
116 const Eigen::MatrixXd& Mmn_i =
Mmn_[gw_level + qpoffset];
117 Eigen::MatrixXd res = Eigen::MatrixXd::Zero(
rpatotal_, rpasize);
118 for (
Index v = 0; v < n_occ; v++) {
119 auto Mmn_v =
Mmn_[v].middleRows(n_occ, n_unocc);
120 auto fc = Mmn_v * Mmn_i.transpose();
121 auto XpY_v = XpY.middleRows(vc.
I(v, 0), n_unocc);
122 res += fc.transpose() * XpY_v;
const Eigen::VectorXd & getRPAInputEnergies() const
rpa_eigensolution Diagonalize_H2p() const
Eigen::MatrixXd CalcResidues(Index gw_level, const Eigen::MatrixXd &XpY) const
std::vector< Eigen::MatrixXd > residues_
double CalcCorrelationDiagElementDerivative(Index gw_level, double frequency) const final
void PrepareScreening() final
double CalcCorrelationDiagElement(Index gw_level, double frequency) const final
Eigen::VectorXd rpa_omegas_
double CalcCorrelationOffDiagElement(Index gw_level1, Index gw_level2, double frequency1, double frequency2) const final
This class transforms a pair of indices v,c into a compound index I, via I=ctotal*v+c the fast dimens...
Index I(Index v, Index c) const
base class for all analysis tools