Handler Class Reference

Handler Class Reference#

LibRPA: librpa::Handler Class Reference
LibRPA
librpa::Handler Class Reference

Main handler class for LibRPA computations. More...

#include <librpa.hpp>

Public Member Functions

 Handler ()
 Default constructor (creates null handler).
 
 Handler (MPI_Comm comm)
 Construct and initialize handler with MPI communicator.
 
const LibrpaHandlerget_c_handler () const
 Get underlying C handler (for internal use).
 
void init (MPI_Comm comm)
 Initialize handler with given MPI communicator.
 
void free ()
 Free handler and release resources.
 
 ~Handler ()
 Defatul destructor - automatically frees handler if not already freed.
 
void set_scf_dimension (int nspins, int nkpts, int nstates, int nbasis)
 Set SCF wavefunction dimension (numbers of spins, k-points, states, basis).
 
void set_wg_ekb_efermi (int nspins, int nkpts, int nstates, const double *wg, const double *ekb, double efermi)
 Set occupation numbers, eigenvalues, and Fermi level.
 
void set_wfc (int ispin, int ik, int nstates_local, int nbasis_local, const double *wfc_real, const double *wfc_imag)
 Set wavefunction coefficients (separated real/imag arrays).
 
void set_wfc_packed (int ispin, int ik, int nstates_local, int nbasis_local, const std::complex< double > *wfc)
 Set wavefunction coefficients (packed complex array).
 
void set_ao_basis_wfc (const std::vector< size_t > &nbs_wfc)
 Set atomic orbital basis size for wavefunctions.
 
void set_ao_basis_aux (const std::vector< size_t > &nbs_aux)
 Set auxiliary atomic orbital basis size.
 
void set_latvec_and_G (const double lat_mat[9], const double G_mat[9])
 Set lattice vectors and reciprocal lattice vectors.
 
void set_atoms (const std::vector< int > &types, const std::vector< double > &pos_cart)
 Set atom types and Cartesian coordinates.
 
void set_kgrids_kvec (int nk1, int nk2, int nk3, const double *kvecs)
 Set k-point grid vectors.
 
void set_ibz_mapping (const std::vector< int > &map_ibzk)
 Set mapping from full k-point grid to irreducibleBZ.
 
void set_lri_coeff (LibrpaParallelRouting routing, int I, int J, int nbasis_i, int nbasis_j, int naux_mu, const int R[3], const double *Cs_in)
 Set local RI coefficients.
 
void set_aux_bare_coulomb_k_atom_pair (int ik, int I, int J, int naux_mu, int naux_nu, const double *Vq_real_in, const double *Vq_imag_in, double vq_threshold)
 Set bare Coulomb matrix elements (atom-pair format).
 
void set_aux_cut_coulomb_k_atom_pair (int ik, int I, int J, int naux_mu, int naux_nu, const double *Vq_real_in, const double *Vq_imag_in, double vq_threshold)
 Set truncated Coulomb matrix elements (atom-pair format).
 
void set_aux_bare_coulomb_k_2d_block (int ik, int mu_begin, int mu_end, int nu_begin, int nu_end, const double *Vq_real_in, const double *Vq_imag_in)
 Set bare Coulomb matrix elements (2D block format).
 
void set_aux_cut_coulomb_k_2d_block (int ik, int mu_begin, int mu_end, int nu_begin, int nu_end, const double *Vq_real_in, const double *Vq_imag_in)
 Set truncated Coulomb matrix elements (2D block format).
 
void set_dielect_func_imagfreq (const std::vector< double > &omegas_imag, const std::vector< double > &dielect_func)
 Set dielectric function on imaginary frequency axis.
 
void set_band_kvec (int n_kpts_band, const double *kfrac_band)
 Set k-points for band structure calculations.
 
void set_band_occ_eigval (int n_spins, int n_kpts_band, int n_states, const double *occ, const double *eig)
 Set occupation numbers and eigenvalues for band k-points.
 
void set_wfc_band (int ispin, int ik_band, int nstates_local, int nbasis_local, const double *wfc_real, const double *wfc_imag)
 Set wavefunction for band k-point (separated real/imag).
 
void set_wfc_band_packed (int ispin, int ik_band, int nstates_local, int nbasis_local, const std::complex< double > *wfc)
 Set wavefunction for band k-point (packed complex).
 
void reset_band_data ()
 Reset band structure data.
 
void get_imaginary_frequency_grids (const Options &opts, std::vector< double > &omegas, std::vector< double > &weights)
 Construct and return frequency grids.
 
double get_rpa_correlation_energy (const Options &opts, std::vector< std::complex< double > > &rpa_corr_ibzk_contrib)
 Compute RPA correlation energy.
 
void build_exx (const Options &opts)
 Build exact-exchange matrix in real space.
 
std::vector< double > get_exx_pot_kgrid (const Options &opts, const int n_spins, const std::vector< int > &iks_this, int i_state_low, int i_state_high)
 Get exact-exchange potential for k-grid states.
 
std::vector< double > get_exx_pot_band_k (const Options &opts, const int n_spins, const std::vector< int > &iks_band_this, int i_state_low, int i_state_high)
 Get exact-exchange potential for band k-points.
 
void build_g0w0_sigma (const Options &opts)
 Build G0W0 self-energy matrix in real space.
 
std::vector< std::complex< double > > get_g0w0_sigc_kgrid (const Options &opts, const int n_spins, const std::vector< int > &iks_this, int i_state_low, int i_state_high, const std::vector< double > &vxc, const std::vector< double > &vexx)
 Get G0W0 correlation self-energy for k-grid states.
 
std::vector< std::complex< double > > get_g0w0_sigc_band_k (const Options &opts, const int n_spins, const std::vector< int > &iks_band_this, int i_state_low, int i_state_high, const std::vector< double > &vxc_band, const std::vector< double > &vexx_band)
 Get G0W0 correlation self-energy for band k-points.
 

Detailed Description

Main handler class for LibRPA computations.

This class wraps the C handler with RAII semantics for convenient resource management. It provides methods to set input data and perform RPA/EXX/G0W0 calculations.

Typical usage:

librpa::Handler h(MPI_COMM_WORLD);
h.set_scf_dimension(nspins, nkpts, nstates, nbasis);
// ... set more input data ...
double ec_rpa = h.get_rpa_correlation_energy(opts, ibzk_contrib);
h.free();
Main handler class for LibRPA computations.
Definition librpa.hpp:159
void init_global(Switch switch_redirect_stdout=LIBRPA_SWITCH_OFF, const char *redirect_path="stdout", Switch switch_process_output=LIBRPA_SWITCH_ON)
Initialize the global LibRPA environment.
void finalize_global(void)
Finalize the global LibRPA environment.

Constructor & Destructor Documentation

◆ Handler()

librpa::Handler::Handler ( MPI_Comm comm)

Construct and initialize handler with MPI communicator.

Parameters
commMPI communicator for parallel computation.

◆ ~Handler()

librpa::Handler::~Handler ( )

Defatul destructor - automatically frees handler if not already freed.

Note
Reply on free() to explicitly release resources.

Member Function Documentation

◆ build_exx()

void librpa::Handler::build_exx ( const Options & opts)

Build exact-exchange matrix in real space.

Parameters
[in]optsRuntime options.

◆ build_g0w0_sigma()

void librpa::Handler::build_g0w0_sigma ( const Options & opts)

Build G0W0 self-energy matrix in real space.

Parameters
[in]optsRuntime options.

◆ get_exx_pot_band_k()

std::vector< double > librpa::Handler::get_exx_pot_band_k ( const Options & opts,
const int n_spins,
const std::vector< int > & iks_band_this,
int i_state_low,
int i_state_high )

Get exact-exchange potential for band k-points.

Parameters
[in]optsRuntime options.
[in]n_spinsNumber of spin channels.
[in]iks_band_thisList of band k-point indices on this process.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
Returns
Exact-exchange potentials for band states.

◆ get_exx_pot_kgrid()

std::vector< double > librpa::Handler::get_exx_pot_kgrid ( const Options & opts,
const int n_spins,
const std::vector< int > & iks_this,
int i_state_low,
int i_state_high )

Get exact-exchange potential for k-grid states.

Parameters
[in]optsRuntime options.
[in]n_spinsNumber of spin channels.
[in]iks_thisList of k-point indices computed on this process.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
Returns
Exact-exchange potentials for selected states.

◆ get_g0w0_sigc_band_k()

std::vector< std::complex< double > > librpa::Handler::get_g0w0_sigc_band_k ( const Options & opts,
const int n_spins,
const std::vector< int > & iks_band_this,
int i_state_low,
int i_state_high,
const std::vector< double > & vxc_band,
const std::vector< double > & vexx_band )

Get G0W0 correlation self-energy for band k-points.

Parameters
[in]optsRuntime options.
[in]n_spinsNumber of spin channels.
[in]iks_band_thisList of band k-point indices on this process.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
[in]vxc_bandXC potential for band states.
[in]vexx_bandExact-exchange potential for band states.
Returns
Correlation self-energy for band states.

◆ get_g0w0_sigc_kgrid()

std::vector< std::complex< double > > librpa::Handler::get_g0w0_sigc_kgrid ( const Options & opts,
const int n_spins,
const std::vector< int > & iks_this,
int i_state_low,
int i_state_high,
const std::vector< double > & vxc,
const std::vector< double > & vexx )

Get G0W0 correlation self-energy for k-grid states.

Parameters
[in]optsRuntime options.
[in]n_spinsNumber of spin channels.
[in]iks_thisList of k-point indices on this process.
[in]i_state_lowFirst state index (inclusive).
[in]i_state_highLast state index (exclusive).
[in]vxcXC potential for selected states.
[in]vexxExact-exchange potential for selected states.
Returns
Correlation self-energy for selected states.

◆ get_rpa_correlation_energy()

double librpa::Handler::get_rpa_correlation_energy ( const Options & opts,
std::vector< std::complex< double > > & rpa_corr_ibzk_contrib )

Compute RPA correlation energy.

Parameters
[in]optsRuntime options.
[out]rpa_corr_ibzk_contribComplex RPA correlation contribution per k-point.
Returns
Total RPA correlation energy.

◆ init()

void librpa::Handler::init ( MPI_Comm comm)

Initialize handler with given MPI communicator.

Parameters
commMPI communicator.

The documentation for this class was generated from the following file: