ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
LR::KernelXC Class Reference

Calculate the exchange-correlation (XC) kernel ($f_{xc}=\delta^2E_xc/\delta\rho^2$) and store its components. More...

#include <xc_kernel.h>

Collaboration diagram for LR::KernelXC:

Classes

struct  ClosedShellGga
struct  GxcCoef
 The coefficients of $v^{(2)}(r)=\iint dr'dr''\,g^{xc}(r,r',r'')\rho^1(r')\rho^1(r'')$ for ONE spin combination, stored exactly as they appear in the final formula: $v^{(2)} = a_{s^2}s^2 + a_{st}\,s\,t + a_{t^2}t^2 + a_q\,q. More...

Public Types

enum  GxcSpin { NoGxc = 0 , Singlet = 1 , Triplet = 2 , BothSpins = 3 }
 Which spin combinations of the $g^{xc}$ coefficient set (GxcCoef) to build. More...
enum class  Purpose { LinearResponse , GroundStateResponse }
 GS response starts from raw sigma; non-finite HSE coefficients trigger a reported fallback. More...

Public Member Functions

 KernelXC (const ModulePW::PW_Basis &rho_basis, const UnitCell &ucell, const Charge &chg_gs, const Parallel_Grid &pgrid, const int &nspin, const std::string &kernel_name, const std::vector< std::string > &lr_init_xc_kernel, const bool openshell=false, const int gxc_spin=GxcSpin::NoGxc)
 KernelXC (Purpose purpose, const ModulePW::PW_Basis &rho_basis, const UnitCell &ucell, const Charge &chg_gs, const Parallel_Grid &pgrid, const int &nspin, const std::string &kernel_name, const std::vector< std::string > &lr_init_xc_kernel, bool openshell, int gxc_spin)
 ~KernelXC ()
int nspin () const
 Metadata belongs to this coefficient set, independent of later global XC changes.
int functional_type () const
const std::string & name () const
bool gs_sigma_fallback_used () const
 CREF (vrho)
 CREF (vsigma)
 CREF (v2rho2)
 CREF (v2rhosigma)
 CREF (v2sigma2)
 CREF (v3rho3)
 CREF (v3rho2sigma)
 CREF (v3rhosigma2)
 CREF (v3sigma3)
const ClosedShellGga & closed_shell_gga (const bool triplet) const
const GxcCoef & gxc (const bool triplet) const
const Tvec & sigma_jacobian () const
bool is_gga () const

Public Attributes

const bool & openshell = openshell_
const std::vector< std::vector< ModuleBase::Vector3< double > > > & drho_gs = drho_gs_

Private Types

using Tvec = std::vector<double>

Private Member Functions

void build_gxc_coef (GxcCoef &dst, const bool triplet, const int &nspin, const bool &is_gga)
 Fill dst for one spin combination. All the spin algebralives here, driven by the weight vectors that distinguish singlet from triplet – the two differ only in those weights.

Private Attributes

std::vector< double > vrho_
std::vector< double > vsigma_
std::vector< double > v2rho2_
std::vector< double > v2rhosigma_
std::vector< double > v2sigma2_
std::vector< std::vector< ModuleBase::Vector3< double > > > drho_gs_
 $\nabla\rho$ of the ground state, size: nspin*nrxx
ClosedShellGga closed_shell_gga_s_
ClosedShellGga closed_shell_gga_t_
Tvec v3rho3_
Tvec v3rho2sigma_
Tvec v3rhosigma2_
Tvec v3sigma3_
GxcCoef gxc_s_
GxcCoef gxc_t_
const int nspin_
const std::string kernel_name_
int functional_type_ = 0
const int gxc_spin_ = GxcSpin::NoGxc
 which GxcCoef sets to build, see GxcSpin
const Purpose purpose_
Tvec sigma_jacobian_
bool gs_sigma_fallback_used_ = false
const ModulePW::PW_Basis & rho_basis_
const bool openshell_ = false

Detailed Description

Calculate the exchange-correlation (XC) kernel ($f_{xc}=\delta^2E_xc/\delta\rho^2$) and store its components.

Member Typedef Documentation

◆ Tvec

using LR::KernelXC::Tvec = std::vector<double>
private

Member Enumeration Documentation

◆ GxcSpin

Which spin combinations of the $g^{xc}$ coefficient set (GxcCoef) to build.

Enumerator
NoGxc 
Singlet 
Triplet 
BothSpins 

◆ Purpose

enum class LR::KernelXC::Purpose
strong

GS response starts from raw sigma; non-finite HSE coefficients trigger a reported fallback.

Enumerator
LinearResponse 
GroundStateResponse 

Constructor & Destructor Documentation

◆ KernelXC() [1/2]

LR::KernelXC::KernelXC ( const ModulePW::PW_Basis & rho_basis,
const UnitCell & ucell,
const Charge & chg_gs,
const Parallel_Grid & pgrid,
const int & nspin,
const std::string & kernel_name,
const std::vector< std::string > & lr_init_xc_kernel,
const bool openshell = false,
const int gxc_spin = GxcSpin::NoGxc )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ KernelXC() [2/2]

LR::KernelXC::KernelXC ( Purpose purpose,
const ModulePW::PW_Basis & rho_basis,
const UnitCell & ucell,
const Charge & chg_gs,
const Parallel_Grid & pgrid,
const int & nspin,
const std::string & kernel_name,
const std::vector< std::string > & lr_init_xc_kernel,
bool openshell,
int gxc_spin )

Explicit response role; GS response requests only second derivatives. Density and grid are borrowed and never modified; their spin layouts must agree.

Here is the call graph for this function:

◆ ~KernelXC()

LR::KernelXC::~KernelXC ( )
inline

Member Function Documentation

◆ build_gxc_coef()

void LR::KernelXC::build_gxc_coef ( GxcCoef & dst,
const bool triplet,
const int & nspin,
const bool & is_gga )
private

Fill dst for one spin combination. All the spin algebralives here, driven by the weight vectors that distinguish singlet from triplet – the two differ only in those weights.

Here is the call graph for this function:

◆ closed_shell_gga()

const ClosedShellGga & LR::KernelXC::closed_shell_gga ( const bool triplet) const
inline
Here is the caller graph for this function:

◆ CREF() [1/9]

LR::KernelXC::CREF ( v2rho2 )

◆ CREF() [2/9]

LR::KernelXC::CREF ( v2rhosigma )

◆ CREF() [3/9]

LR::KernelXC::CREF ( v2sigma2 )

◆ CREF() [4/9]

LR::KernelXC::CREF ( v3rho2sigma )

◆ CREF() [5/9]

LR::KernelXC::CREF ( v3rho3 )

◆ CREF() [6/9]

LR::KernelXC::CREF ( v3rhosigma2 )

◆ CREF() [7/9]

LR::KernelXC::CREF ( v3sigma3 )

◆ CREF() [8/9]

LR::KernelXC::CREF ( vrho )

◆ CREF() [9/9]

LR::KernelXC::CREF ( vsigma )

◆ functional_type()

int LR::KernelXC::functional_type ( ) const
inline

◆ gs_sigma_fallback_used()

bool LR::KernelXC::gs_sigma_fallback_used ( ) const
inline

Construction metadata: true only after a collective HSE GS-response fallback. This flags an approximate orbital Hessian; the SCF potential is unchanged.

◆ gxc()

const GxcCoef & LR::KernelXC::gxc ( const bool triplet) const
inline

nspin=1 has no singlet/triplet distinction, so it always returns the one set that is built. Throws instead of handing back an empty set when the requested combination was not requested at construction – silently returning zeros would look like a physics bug.

Here is the caller graph for this function:

◆ is_gga()

bool LR::KernelXC::is_gga ( ) const
inline

Whether THIS kernel (built for its own functional name, which may differ from the ground state's dft_functional in a cross-functional run such as TDLDA@PBE) needs the GGA gradient terms. drho_gs_ is only ever filled when this kernel's own is_gga was true at construction (see f_xc_libxc), so its emptiness is a reliable per-kernel proxy – unlike the global XC_Functional::get_func_type(), which reflects the ground state's functional and disagrees with this kernel whenever the two differ.

Here is the caller graph for this function:

◆ name()

const std::string & LR::KernelXC::name ( ) const
inline

◆ nspin()

int LR::KernelXC::nspin ( ) const
inline

Metadata belongs to this coefficient set, independent of later global XC changes.

Here is the caller graph for this function:

◆ sigma_jacobian()

const Tvec & LR::KernelXC::sigma_jacobian ( ) const
inline

Componentwise derivative of prepared sigma; empty means identity. Borrowed for the kernel lifetime, point-major: one component at nspin=1, or (uu, ud, dd) at nspin=2. Only implicit coefficient derivatives use it.

Here is the caller graph for this function:

Member Data Documentation

◆ closed_shell_gga_s_

ClosedShellGga LR::KernelXC::closed_shell_gga_s_
private

◆ closed_shell_gga_t_

ClosedShellGga LR::KernelXC::closed_shell_gga_t_
private

◆ drho_gs

const std::vector<std::vector<ModuleBase::Vector3<double> > >& LR::KernelXC::drho_gs = drho_gs_

◆ drho_gs_

std::vector<std::vector<ModuleBase::Vector3<double> > > LR::KernelXC::drho_gs_
private

$\nabla\rho$ of the ground state, size: nspin*nrxx

◆ functional_type_

int LR::KernelXC::functional_type_ = 0
private

◆ gs_sigma_fallback_used_

bool LR::KernelXC::gs_sigma_fallback_used_ = false
private

◆ gxc_s_

GxcCoef LR::KernelXC::gxc_s_
private

◆ gxc_spin_

const int LR::KernelXC::gxc_spin_ = GxcSpin::NoGxc
private

which GxcCoef sets to build, see GxcSpin

◆ gxc_t_

GxcCoef LR::KernelXC::gxc_t_
private

◆ kernel_name_

const std::string LR::KernelXC::kernel_name_
private

◆ nspin_

const int LR::KernelXC::nspin_
private

◆ openshell

const bool& LR::KernelXC::openshell = openshell_

◆ openshell_

const bool LR::KernelXC::openshell_ = false
private

◆ purpose_

const Purpose LR::KernelXC::purpose_
private

◆ rho_basis_

const ModulePW::PW_Basis& LR::KernelXC::rho_basis_
private

◆ sigma_jacobian_

Tvec LR::KernelXC::sigma_jacobian_
private

◆ v2rho2_

std::vector<double> LR::KernelXC::v2rho2_
private

◆ v2rhosigma_

std::vector<double> LR::KernelXC::v2rhosigma_
private

◆ v2sigma2_

std::vector<double> LR::KernelXC::v2sigma2_
private

◆ v3rho2sigma_

Tvec LR::KernelXC::v3rho2sigma_
private

◆ v3rho3_

Tvec LR::KernelXC::v3rho3_
private

◆ v3rhosigma2_

Tvec LR::KernelXC::v3rhosigma2_
private

◆ v3sigma3_

Tvec LR::KernelXC::v3sigma3_
private

◆ vrho_

std::vector<double> LR::KernelXC::vrho_
private

◆ vsigma_

std::vector<double> LR::KernelXC::vsigma_
private

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