librpa_compute.h File Reference

librpa_compute.h File Reference#

LibRPA: librpa_compute.h File Reference
LibRPA
librpa_compute.h File Reference

Computing data APIs for LibRPA. More...

#include "librpa_handler.h"
#include "librpa_options.h"
Include dependency graph for librpa_compute.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void librpa_get_imaginary_frequency_grids (LibrpaHandler *h, const LibrpaOptions *p_opts, double *omegas, double *weights)
 Construct and return frequency grids for numerical integration.
 
double librpa_get_rpa_correlation_energy (LibrpaHandler *h, const LibrpaOptions *p_opts, int n_ibz_kpoints, double *rpa_corr_ibzk_contrib_re, double *rpa_corr_ibzk_contrib_im)
 Compute RPA correlation energy.
 
void librpa_build_exx (LibrpaHandler *h, const LibrpaOptions *p_opts)
 Build exact-exchange matrix.
 
void librpa_get_exx_pot_kgrid (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_this, const int *iks_this, int i_state_low, int i_state_high, double *vexx)
 Obtain exact-exchange potential for selected states.
 
void librpa_get_exx_pot_band_k (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_band_this, const int *iks_band_this, int i_state_low, int i_state_high, double *vexx_band)
 Obtain exact-exchange potential for selected states at band k-points.
 
void librpa_build_g0w0_sigma (LibrpaHandler *h, const LibrpaOptions *p_opts)
 Build self-energy matrix of G0W0, including the correlation and exchange contributions.
 
void librpa_get_g0w0_sigc_kgrid (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_this, const int *iks_this, int i_state_low, int i_state_high, const double *vxc, const double *vexx, double *sigc_re, double *sigc_im)
 Obtain correlation self-energies for selected states.
 
void librpa_get_g0w0_qpe_kgrid (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_this, const int *iks_this, int i_state_low, int i_state_high, const double *vxc, const double *vexx, double *sigc_re, double *sigc_im, double *eqp)
 Obtain correlation self-energies and QP energies for selected states.
 
void librpa_get_g0w0_spectral_function_kgrid (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_this, const int *iks_this, int i_state_low, int i_state_high, const int n_omegas, const double *omegas, const double *vxc, const double *vexx, double *spectral_function, double *sigc)
 Obtain spectral functions for selected k-grid states.
 
void librpa_get_g0w0_sigc_band_k (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_band_this, const int *iks_band_this, int i_state_low, int i_state_high, const double *vxc_band, const double *vexx_band, double *sigc_band_re, double *sigc_band_im)
 Obtain correlation self-energies for selected states at band k-points.
 
void librpa_get_g0w0_qpe_band_k (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_band_this, const int *iks_band_this, int i_state_low, int i_state_high, const double *vxc_band, const double *vexx_band, double *sigc_band_re, double *sigc_band_im, double *eqp_band)
 Obtain correlation self-energies and QP energies for selected band-k states.
 
void librpa_get_g0w0_spectral_function_band_k (LibrpaHandler *h, const LibrpaOptions *p_opts, const int n_spins, const int n_kpts_band_this, const int *iks_band_this, int i_state_low, int i_state_high, const int n_omegas, const double *omegas, const double *vxc_band, const double *vexx_band, double *spectral_function_band, double *sigc_band)
 Obtain spectral functions for selected band-k states.
 

Detailed Description

Computing data APIs for LibRPA.

Function Documentation

◆ librpa_build_exx()

void librpa_build_exx ( LibrpaHandler * h,
const LibrpaOptions * p_opts )

Build exact-exchange matrix.

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.

◆ librpa_build_g0w0_sigma()

void librpa_build_g0w0_sigma ( LibrpaHandler * h,
const LibrpaOptions * p_opts )

Build self-energy matrix of G0W0, including the correlation and exchange contributions.

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.

◆ librpa_get_exx_pot_band_k()

void librpa_get_exx_pot_band_k ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_band_this,
const int * iks_band_this,
int i_state_low,
int i_state_high,
double * vexx_band )

Obtain exact-exchange potential for selected states at band k-points.

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_band_thisNumber of k-points to compute on this process.
[in]iks_band_this(Global) index of k-points that this process compute. Each process can have different indices. Must be a subset of band k-points at which the eigenvetors are parsed.
[in]i_state_lowIndex of the first state to compute the potential (inclusive)
[in]i_state_highIndex of the last state to compute the potential (exclusive)
[out]vexx_bandExact-exchange potential for selected states at band k-points. It should be at least as long as n_spins * n_kpts_band_this * (i_state_high - i_state_low).

◆ librpa_get_exx_pot_kgrid()

void librpa_get_exx_pot_kgrid ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_this,
const int * iks_this,
int i_state_low,
int i_state_high,
double * vexx )

Obtain exact-exchange potential for selected states.

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_thisNumber of k-points to compute on this process.
[in]iks_this(Global) index of k-points that this process compute. Each process can have different indices. Must be a subset of k-points at which the eigenvetors are parsed.
[in]i_state_lowIndex of the first state to compute the potential (inclusive)
[in]i_state_highIndex of the last state to compute the potential (exclusive)
[out]vexxExact-exchange potential for selected states. It should be at least as long as n_spins * n_kpts_local * (i_state_high - i_state_low).

◆ librpa_get_g0w0_qpe_band_k()

void librpa_get_g0w0_qpe_band_k ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_band_this,
const int * iks_band_this,
int i_state_low,
int i_state_high,
const double * vxc_band,
const double * vexx_band,
double * sigc_band_re,
double * sigc_band_im,
double * eqp_band )

Obtain correlation self-energies and QP energies for selected band-k states.

Same inputs and SigC outputs as librpa_get_g0w0_sigc_band_k. If p_opts->use_hedin_shift is enabled, the QP solver evaluates

\[\Sigma_c(E - E_F - \Delta). \]

If p_opts->istate_ref_hedin_shift is negative, Delta is computed separately for each selected band state. Otherwise, that absolute zero-based reference state at each band k-point and spin provides Delta for all states in the same channel.

Parameters
[in]hLibRPA handler.
[in]p_optsRuntime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_band_thisNumber of band k-points computed on this process.
[in]iks_band_thisGlobal indices of those band k-points.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
[in]vxc_bandXC potential for the selected band states.
[in]vexx_bandExact-exchange potential for the selected band states.
[out]sigc_band_reReal part of the correlation self-energy.
[out]sigc_band_imImaginary part of the correlation self-energy.
[out]eqp_bandQuasi-particle energy solved by the selected QPE solver. It should be at least as long as sigc_band_re/sigc_band_im.

◆ librpa_get_g0w0_qpe_kgrid()

void librpa_get_g0w0_qpe_kgrid ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_this,
const int * iks_this,
int i_state_low,
int i_state_high,
const double * vxc,
const double * vexx,
double * sigc_re,
double * sigc_im,
double * eqp )

Obtain correlation self-energies and QP energies for selected states.

Same inputs and SigC outputs as librpa_get_g0w0_sigc_kgrid. If p_opts->use_hedin_shift is enabled, the QP solver evaluates

\[\Sigma_c(E - E_F - \Delta). \]

If p_opts->istate_ref_hedin_shift is negative, Delta is computed separately for each selected state. Otherwise, that absolute zero-based reference state at each k-point and spin provides Delta for all states in the same channel.

Parameters
[in]hLibRPA handler.
[in]p_optsRuntime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_thisNumber of k-points computed on this process.
[in]iks_thisGlobal indices of those k-points.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
[in]vxcXC potential for the selected states.
[in]vexxExact-exchange potential for the selected states.
[out]sigc_reReal part of the correlation self-energy.
[out]sigc_imImaginary part of the correlation self-energy.
[out]eqpQuasi-particle energy solved by the selected QPE solver. It should be at least as long as sigc_re/sigc_im.

◆ librpa_get_g0w0_sigc_band_k()

void librpa_get_g0w0_sigc_band_k ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_band_this,
const int * iks_band_this,
int i_state_low,
int i_state_high,
const double * vxc_band,
const double * vexx_band,
double * sigc_band_re,
double * sigc_band_im )

Obtain correlation self-energies for selected states at band k-points.

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_band_thisNumber of k-points to compute on this process.
[in]iks_band_this(Global) index of k-points that this process compute. Each process can have different indices. Must be a subset of k-points at which the eigenvetors are parsed.
[in]i_state_lowIndex of the first state to compute the potential (inclusive)
[in]i_state_highIndex of the last state to compute the potential (exclusive)
[in]vxc_bandexchange-correlation potential of the selected states at band k-points.
[in]vexx_bandExact-exchange potential for the selected states at band k-points. It should be at least as long as n_spins * n_kpts_band_this * (i_state_high - i_state_low). It can be obtained using librpa_get_exx_pot_kgrid.
[out]sigc_band_reReal-part of the correlation self-energy for the selected states. For option_qpe_solver=2, this is the perturbative effective real contribution that reconstructs the perturbative QP energy. It should be at least as long as n_spins * n_kpts_band_this * (i_state_high - i_state_low).
[out]sigc_band_imSame as sigc_band_re, but for the imaginary part.

◆ librpa_get_g0w0_sigc_kgrid()

void librpa_get_g0w0_sigc_kgrid ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_this,
const int * iks_this,
int i_state_low,
int i_state_high,
const double * vxc,
const double * vexx,
double * sigc_re,
double * sigc_im )

Obtain correlation self-energies for selected states.

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_thisNumber of k-points to compute on this process.
[in]iks_this(Global) index of k-points that this process compute. Each process can have different indices. Must be a subset of k-points at which the eigenvetors are parsed.
[in]i_state_lowIndex of the first state to compute the potential (inclusive)
[in]i_state_highIndex of the last state to compute the potential (exclusive)
[in]vxcexchange-correlation potential of the selected states.
[in]vexxExact-exchange potential for the selected states. It should be at least as long as n_spins * n_kpoints_local * (i_state_high - i_state_low). It can be obtained using librpa_get_exx_pot_kgrid.
[out]sigc_reReal-part of the correlation self-energy for the selected states. For option_qpe_solver=2, this is the perturbative effective real contribution that reconstructs the perturbative QP energy. It should be at least as long as n_spins * n_kpoints_local * (i_state_high - i_state_low).
[out]sigc_imSame as sigc_re, but for the imaginary part.

◆ librpa_get_g0w0_spectral_function_band_k()

void librpa_get_g0w0_spectral_function_band_k ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_band_this,
const int * iks_band_this,
int i_state_low,
int i_state_high,
const int n_omegas,
const double * omegas,
const double * vxc_band,
const double * vexx_band,
double * spectral_function_band,
double * sigc_band )

Obtain spectral functions for selected band-k states.

Same convention as librpa_get_g0w0_spectral_function_kgrid, but evaluates states at band k-points.

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_band_thisNumber of band k-points to compute on this process.
[in]iks_band_thisGlobal band-k indices computed on this process.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
[in]n_omegasNumber of real-frequency points.
[in]omegasReal-frequency points, in Hartree.
[in]vxc_bandXC potential for selected band states.
[in]vexx_bandExact-exchange potential for selected band states.
[out]spectral_function_bandSpectral functions. This output array should be at least as long as n_spins * n_kpts_band_this * (i_state_high - i_state_low) * n_omegas. The order is [spin][band k-point][state][omega].
[out]sigc_bandOptional continued correlation self-energy. Pass nullptr if this output is not needed. If present, this is a packed complex<double> buffer with the same [spin][band k-point][state][omega] order as spectral_function_band.

◆ librpa_get_g0w0_spectral_function_kgrid()

void librpa_get_g0w0_spectral_function_kgrid ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
const int n_spins,
const int n_kpts_this,
const int * iks_this,
int i_state_low,
int i_state_high,
const int n_omegas,
const double * omegas,
const double * vxc,
const double * vexx,
double * spectral_function,
double * sigc )

Obtain spectral functions for selected k-grid states.

Computes spectral functions under the diagonal approximation of the Green's function: \(A_{n\mathbf{k}}(\omega) = -\pi^{-1}\mathrm{Im}\,G_{n\mathbf{k}}(\omega)\).

Parameters
[in]hPointer to LibRPA handler.
[in]p_optsPointer to runtime options.
[in]n_spinsNumber of spin channels.
[in]n_kpts_thisNumber of k-points to compute on this process.
[in]iks_thisGlobal k-point indices computed on this process.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
[in]n_omegasNumber of real-frequency points.
[in]omegasReal-frequency points, in Hartree.
[in]vxcXC potential for selected states.
[in]vexxExact-exchange potential for selected states.
[out]spectral_functionSpectral functions. This output array should be at least as long as n_spins * n_kpts_this * (i_state_high - i_state_low) * n_omegas. The order is [spin][k-point][state][omega].
[out]sigcOptional continued correlation self-energy. Pass nullptr if this output is not needed. If present, this is a packed complex<double> buffer with the same [spin][k-point][state][omega] order as spectral_function.

◆ librpa_get_imaginary_frequency_grids()

void librpa_get_imaginary_frequency_grids ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
double * omegas,
double * weights )

Construct and return frequency grids for numerical integration.

Generates the frequency points and quadrature weights based on the grid type specified in the options (e.g., Gauss-Legendre, Minimax, etc.).

Parameters
[in]hHandler.
[in]p_optsRuntime options.
[out]omegasArray of frequency points (size: opts->nfreq).
[out]weightsArray of quadrature weights (size: opts->nfreq).

◆ librpa_get_rpa_correlation_energy()

double librpa_get_rpa_correlation_energy ( LibrpaHandler * h,
const LibrpaOptions * p_opts,
int n_ibz_kpoints,
double * rpa_corr_ibzk_contrib_re,
double * rpa_corr_ibzk_contrib_im )

Compute RPA correlation energy.

Calculates the RPA correlation energy using the input data (wavefunctions, Coulomb matrices, etc.) that has been set via the input parsing functions.

Parameters
[in]hHandler.
[in]p_optsRuntime options.
[in]n_ibz_kpointsNumber of irreducible k-points.
[out]rpa_corr_ibzk_contrib_reReal part of correlation energy per IBZ k-point.
[out]rpa_corr_ibzk_contrib_imImaginary part of correlation energy per IBZ k-point.
Returns
Total RPA correlation energy (real part).