votca 2026-dev
Loading...
Searching...
No Matches
votca::xtp::GW Class Reference

#include <gw.h>

Collaboration diagram for votca::xtp::GW:

Classes

struct  options
class  QPFunc

Public Member Functions

 GW (Logger &log, TCMatrix_gwbse &Mmn, const Eigen::MatrixXd &vxc, const Eigen::VectorXd &dft_energies)
void configure (const options &opt)
Index ScreeningBuilds () const
 Screening builds and QP iterations of the last evGW run.
Index QPIterations () const
Index TrackedLocalSolves () const
 Level solves of the last evGW run done by root tracking (locally).
Eigen::VectorXd getGWAResults () const
void setReactionField (const Eigen::MatrixXd &R)
 Screen by a static polarizable environment (embedded GW).
void setCoreExchange (const Eigen::MatrixXd &X)
const Eigen::MatrixXd & getSigmaReac () const
void CalculateGWPerturbation ()
void CalculateHQP ()
void CalculateQSGW ()
 Run quasiparticle self-consistent GW (QSGW).
const Eigen::MatrixXd & getQSGWRotation () const
const Eigen::VectorXd & getQSGWSeedEnergies () const
 Return the seed (G0W0/evGW) energies that QSGW started from.
void PrintQSGW_Energies (const std::string &seed_label, const Eigen::VectorXd &seed_energies, const Eigen::VectorXd &qsgw_energies) const
 Print a two-column comparison of seed (G0W0 or evGW) vs converged QSGW quasiparticle energies.
void PrintQSGW_Composition (double threshold=0.01) const
 Print the dominant DFT-KS orbital contributions to each converged QSGW quasiparticle state.
Eigen::MatrixXd getHQP () const
Eigen::SelfAdjointEigenSolver< Eigen::MatrixXd > DiagonalizeQPHamiltonian () const
void PlotSigma (std::string filename, Index steps, double spacing, std::string states) const
Eigen::VectorXd RPAInputEnergies () const

Private Types

using EvalStage = qp_solver::EvalStage
using QPStats = qp_solver::Stats
using QPRootCandidate = qp_solver::RootCandidate
using QPWindowDiagnostics = qp_solver::WindowDiagnostics

Private Member Functions

void DressForEnvironment ()
void PrintReactionFieldShifts () const
double CalcHomoLumoShift (Eigen::VectorXd frequencies) const
Eigen::VectorXd ScissorShift_DFTlevel (const Eigen::VectorXd &dft_energies) const
void PrintQP_Energies (const Eigen::VectorXd &qp_diag_energies) const
void PrintGWA_Energies () const
Eigen::VectorXd SolveQP (const Eigen::VectorXd &frequencies) const
boost::optional< qp_solver::RootCandidate > SolveQP_Tracked (double intercept0, double frequency0, Index gw_level, QPStats *stats) const
void RecordCompetingRoots (Index gw_level, const std::vector< QPRootCandidate > &roots, double chosen) const
void PrintCompetingRoots (Log::Level level) const
boost::optional< double > SolveQP_Grid (double intercept0, double frequency0, Index gw_level, QPStats *stats=nullptr) const
boost::optional< double > SolveQP_Grid_Windowed (double intercept0, double frequency0, Index gw_level, double left_limit, double right_limit, bool allow_rejected_return=true, QPStats *stats=nullptr) const
boost::optional< double > SolveQP_Grid_Windowed_Adaptive (double intercept0, double frequency0, Index gw_level, double left_limit, double right_limit, bool allow_rejected_return=true, QPStats *stats=nullptr) const
boost::optional< double > SolveQP_Grid_Windowed_Dense (double intercept0, double frequency0, Index gw_level, double left_limit, double right_limit, bool allow_rejected_return=true, QPStats *stats=nullptr) const
boost::optional< double > SolveQP_FixedPoint (double intercept0, double frequency0, Index gw_level, QPStats *stats=nullptr) const
boost::optional< double > SolveQP_Linearisation (double intercept0, double frequency0, Index gw_level, QPStats *stats=nullptr) const
bool Converged (const Eigen::VectorXd &e1, const Eigen::VectorXd &e2, double epsilon) const
boost::optional< QPRootCandidate > RefineQPInterval (double lowerbound, double f_lowerbound, double upperbound, double f_upperbound, const QPFunc &f, double reference) const

Private Attributes

Index qptotal_
DFTTimings timings_
Eigen::MatrixXd Sigma_x_
Eigen::MatrixXd Sigma_c_
Eigen::MatrixXd reaction_field_
Eigen::MatrixXd dressing_
Eigen::MatrixXd Sigma_reac_
Eigen::MatrixXd qsgw_rotation_
Eigen::VectorXd qsgw_seed_energies_
Eigen::VectorXd qsgw_final_energies_
options opt_
std::unique_ptr< Sigma_base > sigma_ = nullptr
Logger & log_
TCMatrix_gwbse & Mmn_
const Eigen::MatrixXd & vxc_
const Eigen::VectorXd & dft_energies_
Eigen::MatrixXd core_exchange_
Index screening_builds_ = 0
Index qp_iterations_ = 0
Index gw_sc_iteration_
RPA rpa_
double qp_midgap_ = 0.0
std::vector< qp_solver::CompetingRoots > competing_roots_
Eigen::VectorXd tracked_root_
Eigen::VectorXd tracked_Z_
Eigen::VectorXd tracked_change_
bool tracking_active_ = false
Index tracked_local_ = 0
Index tracked_local_total_ = 0

Detailed Description

Definition at line 39 of file gw.h.

Member Typedef Documentation

◆ EvalStage

Definition at line 41 of file gw.h.

◆ QPRootCandidate

Definition at line 43 of file gw.h.

◆ QPStats

Definition at line 42 of file gw.h.

◆ QPWindowDiagnostics

Definition at line 44 of file gw.h.

Constructor & Destructor Documentation

◆ GW()

votca::xtp::GW::GW ( Logger & log,
TCMatrix_gwbse & Mmn,
const Eigen::MatrixXd & vxc,
const Eigen::VectorXd & dft_energies )
inline

Definition at line 47 of file gw.h.

Member Function Documentation

◆ CalcHomoLumoShift()

double votca::xtp::GW::CalcHomoLumoShift ( Eigen::VectorXd frequencies) const
private

Definition at line 118 of file gw.cc.

◆ CalculateGWPerturbation()

void votca::xtp::GW::CalculateGWPerturbation ( )

Definition at line 283 of file gw.cc.

◆ CalculateHQP()

void votca::xtp::GW::CalculateHQP ( )

Definition at line 1138 of file gw.cc.

◆ CalculateQSGW()

void votca::xtp::GW::CalculateQSGW ( )

Run quasiparticle self-consistent GW (QSGW).

At each iteration:

  1. Compute the full off-diagonal self-energy matrix tilde_Sigma (symmetrised static approximation) in the current QP basis.
  2. Diagonalise H_QSGW = diag(e_DFT - v_xc) + tilde_Sigma to obtain new QP energies and a rotation matrix U.
  3. Rotate the three-centre integrals Mmn via U so that W and Sigma are computed from the updated QP wavefunctions next iteration. Converges when max|e_QP^{k+1} - e_QP^k| < qsgw_sc_limit.

The accumulated rotation U (DFT MOs -> converged QP wavefunctions) is stored in qsgw_rotation_ and returned via getQSGWRotation(). QPdiag energies and eigenvectors are set to the converged QSGW values.

Definition at line 1178 of file gw.cc.

◆ configure()

void votca::xtp::GW::configure ( const options & opt)

Definition at line 39 of file gw.cc.

◆ Converged()

bool votca::xtp::GW::Converged ( const Eigen::VectorXd & e1,
const Eigen::VectorXd & e2,
double epsilon ) const
private

Definition at line 1125 of file gw.cc.

◆ DiagonalizeQPHamiltonian()

Eigen::SelfAdjointEigenSolver< Eigen::MatrixXd > votca::xtp::GW::DiagonalizeQPHamiltonian ( ) const

Definition at line 131 of file gw.cc.

◆ DressForEnvironment()

void votca::xtp::GW::DressForEnvironment ( )
private

Definition at line 74 of file gw.cc.

◆ getGWAResults()

Eigen::VectorXd votca::xtp::GW::getGWAResults ( ) const

Definition at line 545 of file gw.cc.

◆ getHQP()

Eigen::MatrixXd votca::xtp::GW::getHQP ( ) const

Definition at line 125 of file gw.cc.

◆ getQSGWRotation()

const Eigen::MatrixXd & votca::xtp::GW::getQSGWRotation ( ) const
inline

Return the accumulated QSGW rotation matrix U (DFT MOs -> QP wavefunctions)

Definition at line 206 of file gw.h.

◆ getQSGWSeedEnergies()

const Eigen::VectorXd & votca::xtp::GW::getQSGWSeedEnergies ( ) const
inline

Return the seed (G0W0/evGW) energies that QSGW started from.

Definition at line 209 of file gw.h.

◆ getSigmaReac()

const Eigen::MatrixXd & votca::xtp::GW::getSigmaReac ( ) const
inline

Definition at line 178 of file gw.h.

◆ PlotSigma()

void votca::xtp::GW::PlotSigma ( std::string filename,
Index steps,
double spacing,
std::string states ) const

Definition at line 1482 of file gw.cc.

◆ PrintCompetingRoots()

void votca::xtp::GW::PrintCompetingRoots ( Log::Level level) const
private

Definition at line 556 of file gw.cc.

◆ PrintGWA_Energies()

void votca::xtp::GW::PrintGWA_Energies ( ) const
private

Definition at line 138 of file gw.cc.

◆ PrintQP_Energies()

void votca::xtp::GW::PrintQP_Energies ( const Eigen::VectorXd & qp_diag_energies) const
private

Definition at line 248 of file gw.cc.

◆ PrintQSGW_Composition()

void votca::xtp::GW::PrintQSGW_Composition ( double threshold = 0.01) const

Print the dominant DFT-KS orbital contributions to each converged QSGW quasiparticle state.

For each QP state n, prints the KS orbitals m with |U_{mn}|^2 > threshold, where U = qsgw_rotation_ (columns = QP states in DFT-KS basis).

Parameters
thresholdMinimum weight to print (default 0.01 = 1%)

Definition at line 178 of file gw.cc.

◆ PrintQSGW_Energies()

void votca::xtp::GW::PrintQSGW_Energies ( const std::string & seed_label,
const Eigen::VectorXd & seed_energies,
const Eigen::VectorXd & qsgw_energies ) const

Print a two-column comparison of seed (G0W0 or evGW) vs converged QSGW quasiparticle energies.

Parameters
seed_labelLabel for the seed column, e.g. "G0W0" or "evGW".
seed_energiesQP energies from the seed calculation (Ha).
qsgw_energiesConverged QSGW eigenvalues (Ha).

Definition at line 221 of file gw.cc.

◆ PrintReactionFieldShifts()

void votca::xtp::GW::PrintReactionFieldShifts ( ) const
private

Definition at line 84 of file gw.cc.

◆ QPIterations()

Index votca::xtp::GW::QPIterations ( ) const
inline

Definition at line 141 of file gw.h.

◆ RecordCompetingRoots()

void votca::xtp::GW::RecordCompetingRoots ( Index gw_level,
const std::vector< QPRootCandidate > & roots,
double chosen ) const
inlineprivate

Definition at line 411 of file gw.h.

◆ RefineQPInterval()

boost::optional< QPRootCandidate > votca::xtp::GW::RefineQPInterval ( double lowerbound,
double f_lowerbound,
double upperbound,
double f_upperbound,
const QPFunc & f,
double reference ) const
private

◆ RPAInputEnergies()

Eigen::VectorXd votca::xtp::GW::RPAInputEnergies ( ) const
inline

Definition at line 245 of file gw.h.

◆ ScissorShift_DFTlevel()

Eigen::VectorXd votca::xtp::GW::ScissorShift_DFTlevel ( const Eigen::VectorXd & dft_energies) const
private

Definition at line 275 of file gw.cc.

◆ ScreeningBuilds()

Index votca::xtp::GW::ScreeningBuilds ( ) const
inline

Screening builds and QP iterations of the last evGW run.

Definition at line 140 of file gw.h.

◆ setCoreExchange()

void votca::xtp::GW::setCoreExchange ( const Eigen::MatrixXd & X)
inline

Exchange with occupied levels below rpamin (frozen core), in the DFT MO basis of the GW window: added to Sigma_x, which otherwise only sums over the occupied levels in Mmn (from rpamin on). See TCMatrix_gwbse::CoreExchange.

Definition at line 177 of file gw.h.

◆ setReactionField()

void votca::xtp::GW::setReactionField ( const Eigen::MatrixXd & R)

Screen by a static polarizable environment (embedded GW).

R is the environment reaction field in the fill-time auxiliary frame of the three-centre integrals, as EnvironmentScreening::SymmetrizedReactionField returns it. Set before CalculateGWPerturbation; an empty matrix (the default) switches it off.

It enters twice, splitting W = u + (W - u) with u = v + v_reac:

  • u: v gives the exchange as always, and nothing else; v_reac gives a static COH+SEX self-energy (Sigma_base::CalcReactionFieldMatrix). By its physics that is correlation – it is part of W - v – and it is kept as the frequency-independent part of Sigma_c, apart from the dynamic part, and added wherever Sigma_c is: getHQP, the QP equation, evGW, QSGW. getSigmaReac() returns it; zero without an environment. It is printed as S-R next to S-X and S-C.
  • W - u: the correlation of the QM electrons, now interacting through u and screened by the environment as well, W = [u^-1 - chi0]^-1 = S [1 - S chi0 S]^-1 S, S = (1 + R)^(1/2). That is the unchanged RPA and correlation machinery run on M S, so the integrals are dressed (TCMatrix_gwbse::DressAuxIndex) after the static terms are formed and before the first screening. They stay dressed when GW is done; the caller undresses them if it needs the bare ones.

Definition at line 68 of file gw.cc.

◆ SolveQP()

Eigen::VectorXd votca::xtp::GW::SolveQP ( const Eigen::VectorXd & frequencies) const
private

Definition at line 581 of file gw.cc.

◆ SolveQP_FixedPoint()

boost::optional< double > votca::xtp::GW::SolveQP_FixedPoint ( double intercept0,
double frequency0,
Index gw_level,
QPStats * stats = nullptr ) const
private

Definition at line 1107 of file gw.cc.

◆ SolveQP_Grid()

boost::optional< double > votca::xtp::GW::SolveQP_Grid ( double intercept0,
double frequency0,
Index gw_level,
QPStats * stats = nullptr ) const
private

Definition at line 1031 of file gw.cc.

◆ SolveQP_Grid_Windowed()

boost::optional< double > votca::xtp::GW::SolveQP_Grid_Windowed ( double intercept0,
double frequency0,
Index gw_level,
double left_limit,
double right_limit,
bool allow_rejected_return = true,
QPStats * stats = nullptr ) const
private

Definition at line 977 of file gw.cc.

◆ SolveQP_Grid_Windowed_Adaptive()

boost::optional< double > votca::xtp::GW::SolveQP_Grid_Windowed_Adaptive ( double intercept0,
double frequency0,
Index gw_level,
double left_limit,
double right_limit,
bool allow_rejected_return = true,
QPStats * stats = nullptr ) const
private

Definition at line 771 of file gw.cc.

◆ SolveQP_Grid_Windowed_Dense()

boost::optional< double > votca::xtp::GW::SolveQP_Grid_Windowed_Dense ( double intercept0,
double frequency0,
Index gw_level,
double left_limit,
double right_limit,
bool allow_rejected_return = true,
QPStats * stats = nullptr ) const
private

Definition at line 846 of file gw.cc.

◆ SolveQP_Linearisation()

boost::optional< double > votca::xtp::GW::SolveQP_Linearisation ( double intercept0,
double frequency0,
Index gw_level,
QPStats * stats = nullptr ) const
private

Definition at line 752 of file gw.cc.

◆ SolveQP_Tracked()

boost::optional< qp_solver::RootCandidate > votca::xtp::GW::SolveQP_Tracked ( double intercept0,
double frequency0,
Index gw_level,
QPStats * stats ) const
private

Definition at line 730 of file gw.cc.

◆ TrackedLocalSolves()

Index votca::xtp::GW::TrackedLocalSolves ( ) const
inline

Level solves of the last evGW run done by root tracking (locally).

Definition at line 143 of file gw.h.

Member Data Documentation

◆ competing_roots_

std::vector<qp_solver::CompetingRoots> votca::xtp::GW::competing_roots_
mutableprivate

Definition at line 398 of file gw.h.

◆ core_exchange_

Eigen::MatrixXd votca::xtp::GW::core_exchange_
private

Definition at line 278 of file gw.h.

◆ dft_energies_

const Eigen::VectorXd& votca::xtp::GW::dft_energies_
private

Definition at line 276 of file gw.h.

◆ dressing_

Eigen::MatrixXd votca::xtp::GW::dressing_
private

Definition at line 257 of file gw.h.

◆ gw_sc_iteration_

Index votca::xtp::GW::gw_sc_iteration_
private

Definition at line 281 of file gw.h.

◆ log_

Logger& votca::xtp::GW::log_
private

Definition at line 273 of file gw.h.

◆ Mmn_

TCMatrix_gwbse& votca::xtp::GW::Mmn_
private

Definition at line 274 of file gw.h.

◆ opt_

options votca::xtp::GW::opt_
private

Definition at line 270 of file gw.h.

◆ qp_iterations_

Index votca::xtp::GW::qp_iterations_ = 0
private

Definition at line 280 of file gw.h.

◆ qp_midgap_

double votca::xtp::GW::qp_midgap_ = 0.0
mutableprivate

Definition at line 395 of file gw.h.

◆ qptotal_

Index votca::xtp::GW::qptotal_
private

Definition at line 250 of file gw.h.

◆ qsgw_final_energies_

Eigen::VectorXd votca::xtp::GW::qsgw_final_energies_
private

Definition at line 268 of file gw.h.

◆ qsgw_rotation_

Eigen::MatrixXd votca::xtp::GW::qsgw_rotation_
private

Definition at line 261 of file gw.h.

◆ qsgw_seed_energies_

Eigen::VectorXd votca::xtp::GW::qsgw_seed_energies_
private

Definition at line 263 of file gw.h.

◆ reaction_field_

Eigen::MatrixXd votca::xtp::GW::reaction_field_
private

Definition at line 256 of file gw.h.

◆ rpa_

RPA votca::xtp::GW::rpa_
private

Definition at line 283 of file gw.h.

◆ screening_builds_

Index votca::xtp::GW::screening_builds_ = 0
private

Definition at line 279 of file gw.h.

◆ sigma_

std::unique_ptr<Sigma_base> votca::xtp::GW::sigma_ = nullptr
private

Definition at line 272 of file gw.h.

◆ Sigma_c_

Eigen::MatrixXd votca::xtp::GW::Sigma_c_
private

Definition at line 255 of file gw.h.

◆ Sigma_reac_

Eigen::MatrixXd votca::xtp::GW::Sigma_reac_
private

Definition at line 259 of file gw.h.

◆ Sigma_x_

Eigen::MatrixXd votca::xtp::GW::Sigma_x_
private

Definition at line 254 of file gw.h.

◆ timings_

DFTTimings votca::xtp::GW::timings_
mutableprivate

Definition at line 252 of file gw.h.

◆ tracked_change_

Eigen::VectorXd votca::xtp::GW::tracked_change_
mutableprivate

Definition at line 404 of file gw.h.

◆ tracked_local_

Index votca::xtp::GW::tracked_local_ = 0
mutableprivate

Definition at line 406 of file gw.h.

◆ tracked_local_total_

Index votca::xtp::GW::tracked_local_total_ = 0
mutableprivate

Definition at line 407 of file gw.h.

◆ tracked_root_

Eigen::VectorXd votca::xtp::GW::tracked_root_
mutableprivate

Definition at line 402 of file gw.h.

◆ tracked_Z_

Eigen::VectorXd votca::xtp::GW::tracked_Z_
mutableprivate

Definition at line 403 of file gw.h.

◆ tracking_active_

bool votca::xtp::GW::tracking_active_ = false
mutableprivate

Definition at line 405 of file gw.h.

◆ vxc_

const Eigen::MatrixXd& votca::xtp::GW::vxc_
private

Definition at line 275 of file gw.h.


The documentation for this class was generated from the following files:
  • xtp/include/votca/xtp/gw.h
  • xtp/src/libxtp/gwbse/gw.cc