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

#include <gw.h>

Collaboration diagram for votca::xtp::GW:

Classes

struct  options
struct  sigma_dump_options
 Options of DumpSigma (energies in Hartree unless noted). More...
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)
void DumpSigma (const sigma_dump_options &dopt, const std::string &gw_mode, const std::string &version)
 Write the self-energy and screening data of the finished GW (G0W0 or evGW, ppm or exact) to a separate HDF5 file.
void setKeepScreeningData (bool keep)
 Call after configure and before CalculateGWPerturbation.
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

Eigen::MatrixXd SigmaCurves (const std::vector< Index > &levels, Index steps, double spacing) const
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_
bool keep_screening_data_ = false
Eigen::VectorXd qp_solution_
Eigen::VectorXd rpa_energies_solved_
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 122 of file gw.cc.

◆ CalculateGWPerturbation()

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

Definition at line 287 of file gw.cc.

◆ CalculateHQP()

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

Definition at line 1144 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 1184 of file gw.cc.

◆ configure()

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

Definition at line 43 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 1131 of file gw.cc.

◆ DiagonalizeQPHamiltonian()

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

Definition at line 135 of file gw.cc.

◆ DressForEnvironment()

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

Definition at line 78 of file gw.cc.

◆ DumpSigma()

void votca::xtp::GW::DumpSigma ( const sigma_dump_options & dopt,
const std::string & gw_mode,
const std::string & version )

Write the self-energy and screening data of the finished GW (G0W0 or evGW, ppm or exact) to a separate HDF5 file.

Call after CalculateHQP. Per QP level: the static parts, Sigma_c, its first two derivatives and Z at the QP solution, Sigma_c at the DFT energy, competing roots; for levels up to levels_emax_ev also the binned pole spectrum and Sigma_c on the imaginary axis mu + i nu. The screening: mode frequencies and strengths, and W_c in the plasmon-pole frame (static weights, moments, eps^-1(i nu) diagonal). The evaluator must have kept its screening data (Sigma_base::setKeepScreeningData, set by setKeepScreeningData here before CalculateGWPerturbation).

Definition at line 1723 of file gw.cc.

◆ getGWAResults()

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

Definition at line 551 of file gw.cc.

◆ getHQP()

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

Definition at line 129 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 217 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 220 of file gw.h.

◆ getSigmaReac()

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

Definition at line 189 of file gw.h.

◆ PlotSigma()

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

E_QP(omega) = e_DFT + Sigma_x - v_xc + Sigma_c(omega) on a grid of steps points around the DFT energy for the given states (absolute MO indices), with the energies in G of the last QP solve.

Definition at line 1663 of file gw.cc.

◆ PrintCompetingRoots()

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

Definition at line 562 of file gw.cc.

◆ PrintGWA_Energies()

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

Definition at line 142 of file gw.cc.

◆ PrintQP_Energies()

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

Definition at line 252 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 182 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 225 of file gw.cc.

◆ PrintReactionFieldShifts()

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

Definition at line 88 of file gw.cc.

◆ QPIterations()

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

Definition at line 152 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 470 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 296 of file gw.h.

◆ ScissorShift_DFTlevel()

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

Definition at line 279 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 151 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 188 of file gw.h.

◆ setKeepScreeningData()

void votca::xtp::GW::setKeepScreeningData ( bool keep)
inline

Call after configure and before CalculateGWPerturbation.

Definition at line 289 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 72 of file gw.cc.

◆ SigmaCurves()

Eigen::MatrixXd votca::xtp::GW::SigmaCurves ( const std::vector< Index > & levels,
Index steps,
double spacing ) const
private

Sigma_c(omega) for the levels (QP-window indices), row i on the grid e_dft + (k - (steps-1)/2) spacing; uses the current RPA energies.

Definition at line 1631 of file gw.cc.

◆ SolveQP()

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

Definition at line 587 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 1113 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 1037 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 983 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 777 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 852 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 758 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 736 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 154 of file gw.h.

Member Data Documentation

◆ competing_roots_

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

Definition at line 457 of file gw.h.

◆ core_exchange_

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

Definition at line 337 of file gw.h.

◆ dft_energies_

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

Definition at line 335 of file gw.h.

◆ dressing_

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

Definition at line 316 of file gw.h.

◆ gw_sc_iteration_

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

Definition at line 340 of file gw.h.

◆ keep_screening_data_

bool votca::xtp::GW::keep_screening_data_ = false
private

Definition at line 306 of file gw.h.

◆ log_

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

Definition at line 332 of file gw.h.

◆ Mmn_

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

Definition at line 333 of file gw.h.

◆ opt_

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

Definition at line 329 of file gw.h.

◆ qp_iterations_

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

Definition at line 339 of file gw.h.

◆ qp_midgap_

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

Definition at line 454 of file gw.h.

◆ qp_solution_

Eigen::VectorXd votca::xtp::GW::qp_solution_
private

Definition at line 308 of file gw.h.

◆ qptotal_

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

Definition at line 301 of file gw.h.

◆ qsgw_final_energies_

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

Definition at line 327 of file gw.h.

◆ qsgw_rotation_

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

Definition at line 320 of file gw.h.

◆ qsgw_seed_energies_

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

Definition at line 322 of file gw.h.

◆ reaction_field_

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

Definition at line 315 of file gw.h.

◆ rpa_

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

Definition at line 342 of file gw.h.

◆ rpa_energies_solved_

Eigen::VectorXd votca::xtp::GW::rpa_energies_solved_
private

Definition at line 309 of file gw.h.

◆ screening_builds_

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

Definition at line 338 of file gw.h.

◆ sigma_

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

Definition at line 331 of file gw.h.

◆ Sigma_c_

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

Definition at line 314 of file gw.h.

◆ Sigma_reac_

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

Definition at line 318 of file gw.h.

◆ Sigma_x_

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

Definition at line 313 of file gw.h.

◆ timings_

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

Definition at line 311 of file gw.h.

◆ tracked_change_

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

Definition at line 463 of file gw.h.

◆ tracked_local_

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

Definition at line 465 of file gw.h.

◆ tracked_local_total_

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

Definition at line 466 of file gw.h.

◆ tracked_root_

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

Definition at line 461 of file gw.h.

◆ tracked_Z_

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

Definition at line 462 of file gw.h.

◆ tracking_active_

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

Definition at line 464 of file gw.h.

◆ vxc_

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

Definition at line 334 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