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

#include <pot_hxc_lrtd.h>

Inheritance diagram for LR::PotHxcLR:
Collaboration diagram for LR::PotHxcLR:

Classes

struct  Scratch

Public Types

enum  SpinType {
  S1 = 0 , S2_singlet = 1 , S2_triplet = 2 , S2_updown = 3 ,
  S2_gs = 4 , S1_gs = 5
}
enum  XCType { None = 0 , LDA = 1 , GGA = 2 , HYB_GGA = 4 }
 XCType here is to determin the method of integration from kernel to potential, not the way calculating the kernel. More...

Public Member Functions

 PotHxcLR (std::shared_ptr< const KernelXC > kernel, const ModulePW::PW_Basis &rho_basis, const UnitCell &ucell, const int nrxx, const int nspin, const SpinType &st)
 ~PotHxcLR ()
virtual void cal_v_eff (double **rho, const UnitCell &ucell, ModuleBase::matrix &v_eff, const std::vector< int > &ispin_op={ 0, 0 }) const override
const KernelXC & xc_kernel_components () const
Public Member Functions inherited from LR::PotLRBase
 PotLRBase (const ModulePW::PW_Basis &rho_basis, const int &nspin, const int &nrxx, const double &tpiba)
const ModulePW::PW_Basis & get_rho_basis () const

Private Types

using Tfunc

Private Member Functions

void set_integral_func (const SpinType &s, const XCType &xc)
void add_v_hartree (const UnitCell &ucell, ModuleBase::matrix &v_eff, const double factor) const
void build_spin_combos (const bool gga)

Static Private Member Functions

static Scratch & scratch ()

Private Attributes

const std::shared_ptr< const KernelXC > xc_kernel_components_
const SpinType spin_type_ = SpinType::S1
XCType xc_type_ = XCType::None
std::map< SpinType, Tfunc > kernel_to_potential_
std::vector< double > v2rho2_comb_
std::vector< double > vsigma_comb_
 GGA only.

Additional Inherited Members

Public Attributes inherited from LR::PotLRBase
const int & nrxx = nrxx_
const int & nspin = nspin_
Protected Attributes inherited from LR::PotLRBase
const ModulePW::PW_Basis & rho_basis_
const int nspin_ = 1
const int nrxx_ = 1
const double & tpiba_

Member Typedef Documentation

◆ Tfunc

using LR::PotHxcLR::Tfunc
private
Initial value:
std::function<void(const double* const ,
const std::vector<int>& ispin_op) >
Definition matrix.h:15

Member Enumeration Documentation

◆ SpinType

S1: the nspin=1 singlet LR kernel, 2*K^Hartree + 2*K^xc. The factor 2 on both terms is what makes it equal to S2_singlet. S1_gs: the nspin=1 counterpart of S2_gs, i.e. the ground-state Hxc kernel K^Hartree + K^xc = S1 / 2. This is what pot_hxc_gs needs at nspin=1. S2_singlet: 2*K^Hartree + K^xc_{upup} + K^xc_{updown} S2_triplet: K^xc_{upup} - K^xc_{updown} S2_updown: K^Hartree + (K^xc_{upup}, K^xc_{updown}, K^xc_{downup} or K^xc_{downdown}), according to ispin_op (for spin-polarized systems) S2_gs: the nspin=2 ground-state Hxc kernel K^Hartree + (K^xc_{upup} + K^xc_{updown})/2 = S2_singlet / 2. Used for pot_hxc_gs in LR gradients, where the convention is K_Hxc(singlet) = 2 * pot_hxc_gs. The 1/2 on the xc part is not a convention but the chain rule: the derivative is taken w.r.t. the total density matrix, and $\partial v_u/\partial\rho = (f_{uu}+f_{ud})/2$ because $\rho_u=\rho_d=\rho/2$. The Hartree part needs no halving. Do NOT use S1 here when nspin=2: KernelXC is built with the input nspin, so the kernel arrays carry 3 spin components per grid point while the S1 integrand indexes them as if there were 1.

Enumerator
S1 
S2_singlet 
S2_triplet 
S2_updown 
S2_gs 
S1_gs 

◆ XCType

XCType here is to determin the method of integration from kernel to potential, not the way calculating the kernel.

Enumerator
None 
LDA 
GGA 
HYB_GGA 

Constructor & Destructor Documentation

◆ PotHxcLR()

LR::PotHxcLR::PotHxcLR ( std::shared_ptr< const KernelXC > kernel,
const ModulePW::PW_Basis & rho_basis,
const UnitCell & ucell,
const int nrxx,
const int nspin,
const SpinType & st )

Bind an already-evaluated, shared coefficient set; never evaluate XC here. nspin must match the kernel. Its own metadata selects the integration path, regardless of which functional was initialized most recently elsewhere.

Here is the call graph for this function:

◆ ~PotHxcLR()

LR::PotHxcLR::~PotHxcLR ( )
inline

Member Function Documentation

◆ add_v_hartree()

void LR::PotHxcLR::add_v_hartree ( const UnitCell & ucell,
ModuleBase::matrix & v_eff,
const double factor ) const
private

Hartree potential of the transition density, built from scratch().rhog and accumulated into v_eff scaled by factor. Replaces H_Hartree_pw::v_hartree, which for the LR use case (a) re-did the forward FFT of $\rho^X$ that the GGA branch needs anyway, (b) accumulated a Hartree "energy" of the transition density and pushed it through Parallel_Reduce::reduce_pool on every call – a per-call collective whose result is never read, and which clobbers the global H_Hartree_pw::hartree_energy – and (c) returned a full matrix by value, to which v_eff += 2 * (...) then added a second temporary of the same size.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_spin_combos()

void LR::PotHxcLR::build_spin_combos ( const bool gga)
private
Here is the caller graph for this function:

◆ cal_v_eff()

void LR::PotHxcLR::cal_v_eff ( double ** rho,
const UnitCell & ucell,
ModuleBase::matrix & v_eff,
const std::vector< int > & ispin_op = { 0,0 } ) const
overridevirtual

Implements LR::PotLRBase.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scratch()

PotHxcLR::Scratch & LR::PotHxcLR::scratch ( )
staticprivate
Here is the caller graph for this function:

◆ set_integral_func()

void LR::PotHxcLR::set_integral_func ( const SpinType & s,
const XCType & xc )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_kernel_components()

const KernelXC & LR::PotHxcLR::xc_kernel_components ( ) const
inline
Here is the caller graph for this function:

Member Data Documentation

◆ kernel_to_potential_

std::map<SpinType, Tfunc> LR::PotHxcLR::kernel_to_potential_
private

◆ spin_type_

const SpinType LR::PotHxcLR::spin_type_ = SpinType::S1
private

◆ v2rho2_comb_

std::vector<double> LR::PotHxcLR::v2rho2_comb_
private

◆ vsigma_comb_

std::vector<double> LR::PotHxcLR::vsigma_comb_
private

GGA only.

◆ xc_kernel_components_

const std::shared_ptr<const KernelXC> LR::PotHxcLR::xc_kernel_components_
private

different components of local and semi-local xc kernels: LDA: v2rho2 GGA: v2rho2, v2rhosigma, v2sigma2 meta-GGA: v2rho2, v2rhosigma, v2sigma2, v2rholap, v2rhotau, v2sigmalap, v2sigmatau, v2laptau, v2lap2, v2tau2 To allow different potential objects sharing the same kernel.

◆ xc_type_

XCType LR::PotHxcLR::xc_type_ = XCType::None
private

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