ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
ModuleDFPT::DFPT_PW::Impl Class Reference

#include <dfpt_pw_impl.h>

Collaboration diagram for ModuleDFPT::DFPT_PW::Impl:

Public Member Functions

 Impl ()
 ~Impl ()
void build_occ_kq (int q_idx)
double solve_displacement (int q_idx, int iat, int idir)
void solve_pos_resp (int q_idx)
 position legs Y^a_{k,v} = P_c x_a|psi_{k,v}> of the q = 0 mesh
void solve_efield_resp (int q_idx)
 E-field SCF response dpsi^E,a of the q = 0 mesh.
void assemble_v_sc (int q_idx, const ModuleBase::Vector3< double > &q_cart, const std::vector< std::complex< double > > &drho_in_g, std::vector< std::complex< double > > &v_sc_r) const

Private Member Functions

void check_metallic_occ (const ModuleBase::matrix &wg) const
void setup_q_list (UnitCell &ucell)
void init_submodules (const DFPT_PW_InitContext &ctx, int nk, int nbands, int npw_max, int nrxx, int nspin, int nat)
int occupied_band_count (int ik) const
void run_q0_pre (int q_idx)
double run_displacement_irrep_pass (int q_idx, int irrep)
void run_q0_post (int q_idx)
void symmetrize_q0_tensors ()
void run_assemble (int q_idx)
double sternheimer_per_band (int ik, int ib, const std::vector< std::vector< std::complex< double > > > &dv_sc, int nbands, int lin_max, double lin_thr)
void stash_converged_disp_response (int q_idx, int iat, int idir, const std::vector< std::complex< double > > &v_sc_r_last, int nk, int nbands)
void vel_diag_part (int ik, int a, int nbands, std::vector< std::vector< std::complex< double > > > &vel) const
void vel_nl_per_atom (int ik, int a, int it, int ia, int nbands, const std::vector< ModuleBase::Vector3< double > > &gk, std::vector< std::vector< std::complex< double > > > &vel)
void pos_per_band_solve (int ik, int a, int nbands, int lin_max, double lin_thr, std::vector< std::vector< std::vector< std::complex< double > > > > &yvec)
void efield_per_band_solve (int ik, int a, int nbands, int lin_max, double lin_thr, const std::vector< std::vector< std::vector< std::complex< double > > > > &yr, const std::vector< std::vector< std::complex< double > > > &dv_sc)
void stash_dpsi_efield (int q_idx, int a, int nk, int nbands)
bool wired () const

Private Attributes

DFPT_PW_Data data_
DFPT_Pert pert_
DFPT_Stern stern_
DFPT_Rho rho_
DFPT_Phon phon_
DFPT_Q0 q0_
DFPT_Metal metal_
ModuleCell::QList qlist_
std::unique_ptr< DFPT_HamiltShift > hamilt_
psi::Psi< std::complex< double > > gs_psi_
UnitCell * ucell_ = nullptr
ModulePW::PW_Basis * pw_rho_ = nullptr
ModulePW::PW_Basis_K * pw_wfc_ = nullptr
Structure_Factor * sf_ = nullptr
std::vector< double > veff_r_
std::vector< double > vxc_r_
ModuleBase::matrix wg_
ModuleBase::matrix eig_
const XC_First_Order * xc_ = nullptr
double nelec_ = 0.0
double ecutwfc_ = 0.0
const Plus_U_Base * dftu_ = nullptr
std::vector< std::vector< std::vector< std::complex< double > > > > occ_kq_
std::vector< std::vector< double > > eig_kq_
 remembers the (q_idx, ik) the shifted operator was last cached at
int last_q_ = -1
int last_ik_ = -1
int nqx_ = 1
int nqy_ = 1
int nqz_ = 1
std::string qfile_
double conv_thr_ = 1e-8
int max_iter_ = 100
int myrank_ = 0
double mix_beta_ = 0.4
std::string asr_type_ = "no"
 acoustic sum rule mode on the Gamma matrix
std::string mix_type_ = "v_sc_broyden"
 response SCF mixing scheme
double kerker_a2_ = 1.0
 Kerker screening a^2, 1/lat0^2 (rho_kerker only).
int broyden_ndim_ = 8
std::unique_ptr< Base_Mixing::Broyden_Mixing > vsc_broyden_
std::unique_ptr< Base_Mixing::Mixing_Data > vsc_broyden_mdata_

Friends

class DFPT_PW

Detailed Description

Private implementation body of DFPT_PW (opaque in the public header).

Only the constructors / destructor and the outward-facing per-solve hooks are public; all data members and per-solve helpers are private.

Constructor & Destructor Documentation

◆ Impl()

ModuleDFPT::DFPT_PW::Impl::Impl ( )

◆ ~Impl()

ModuleDFPT::DFPT_PW::Impl::~Impl ( )

Member Function Documentation

◆ assemble_v_sc()

void ModuleDFPT::DFPT_PW::Impl::assemble_v_sc ( int q_idx,
const ModuleBase::Vector3< double > & q_cart,
const std::vector< std::complex< double > > & drho_in_g,
std::vector< std::complex< double > > & v_sc_r ) const

per-iteration assembly of the screened response potential v_sc^q = v_Hartree(drho_in) + xc(drho_in) on the shared grid; shared by solve_displacement and solve_efield_resp so the real-space Hartree+XC add loop is not duplicated

Here is the caller graph for this function:

◆ build_occ_kq()

void ModuleDFPT::DFPT_PW::Impl::build_occ_kq ( int q_idx)

occupied-state projector set at k+q for every k of this q (nscf path: the k+q states come from a block-Davidson diagonalization of the full H(k+q) on the k+q ball, QE run_nscf alignment)

< empirical parameter: Davidson outer iterations per k+q ball

< empirical parameter: residual norm target (Ry); occ_kq_ feeds the P_c projector only, whose leakage at this level stays far below the response convergence threshold

< empirical parameter: kinetic-preconditioner floor (1/lat0^2); small enough that the near-Gamma plane waves (which dominate the valence top) are not suppressed in the expansion directions

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

◆ check_metallic_occ()

void ModuleDFPT::DFPT_PW::Impl::check_metallic_occ ( const ModuleBase::matrix & wg) const
private

< empirical parameter: relative band weight treated as metallic

Here is the call graph for this function:

◆ efield_per_band_solve()

void ModuleDFPT::DFPT_PW::Impl::efield_per_band_solve ( int ik,
int a,
int nbands,
int lin_max,
double lin_thr,
const std::vector< std::vector< std::vector< std::complex< double > > > > & yr,
const std::vector< std::vector< std::complex< double > > > & dv_sc )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_submodules()

void ModuleDFPT::DFPT_PW::Impl::init_submodules ( const DFPT_PW_InitContext & ctx,
int nk,
int nbands,
int npw_max,
int nrxx,
int nspin,
int nat )
private

◆ occupied_band_count()

int ModuleDFPT::DFPT_PW::Impl::occupied_band_count ( int ik) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pos_per_band_solve()

void ModuleDFPT::DFPT_PW::Impl::pos_per_band_solve ( int ik,
int a,
int nbands,
int lin_max,
double lin_thr,
std::vector< std::vector< std::vector< std::complex< double > > > > & yvec )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_assemble()

void ModuleDFPT::DFPT_PW::Impl::run_assemble ( int q_idx)
private

◆ run_displacement_irrep_pass()

double ModuleDFPT::DFPT_PW::Impl::run_displacement_irrep_pass ( int q_idx,
int irrep )
private
Here is the call graph for this function:

◆ run_q0_post()

void ModuleDFPT::DFPT_PW::Impl::run_q0_post ( int q_idx)
private
Here is the call graph for this function:

◆ run_q0_pre()

void ModuleDFPT::DFPT_PW::Impl::run_q0_pre ( int q_idx)
private
Here is the call graph for this function:

◆ setup_q_list()

void ModuleDFPT::DFPT_PW::Impl::setup_q_list ( UnitCell & ucell)
private
Here is the call graph for this function:

◆ solve_displacement()

double ModuleDFPT::DFPT_PW::Impl::solve_displacement ( int q_idx,
int iat,
int idir )

one self-consistent Sternheimer cycle for the displacement (iat, idir) at q; returns the achieved density residual (zero when unwired)

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

◆ solve_efield_resp()

void ModuleDFPT::DFPT_PW::Impl::solve_efield_resp ( int q_idx)

E-field SCF response dpsi^E,a of the q = 0 mesh.

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

◆ solve_pos_resp()

void ModuleDFPT::DFPT_PW::Impl::solve_pos_resp ( int q_idx)

position legs Y^a_{k,v} = P_c x_a|psi_{k,v}> of the q = 0 mesh

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

◆ stash_converged_disp_response()

void ModuleDFPT::DFPT_PW::Impl::stash_converged_disp_response ( int q_idx,
int iat,
int idir,
const std::vector< std::complex< double > > & v_sc_r_last,
int nk,
int nbands )
private
Here is the caller graph for this function:

◆ stash_dpsi_efield()

void ModuleDFPT::DFPT_PW::Impl::stash_dpsi_efield ( int q_idx,
int a,
int nk,
int nbands )
private
Here is the caller graph for this function:

◆ sternheimer_per_band()

double ModuleDFPT::DFPT_PW::Impl::sternheimer_per_band ( int ik,
int ib,
const std::vector< std::vector< std::complex< double > > > & dv_sc,
int nbands,
int lin_max,
double lin_thr )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ symmetrize_q0_tensors()

void ModuleDFPT::DFPT_PW::Impl::symmetrize_q0_tensors ( )
private

Project the q=0 response tensors (epsilon_inf, Born charges) onto the crystal point-group form after compute_born and before the ASR family and the LO-TO term consume them (QE zstar_eu/symtensor + dielec/symmatrix parity). No-op under nosym: the raw tensors stay visible as the audit channel for cross-code comparisons.

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

◆ vel_diag_part()

void ModuleDFPT::DFPT_PW::Impl::vel_diag_part ( int ik,
int a,
int nbands,
std::vector< std::vector< std::complex< double > > > & vel ) const
private
Here is the caller graph for this function:

◆ vel_nl_per_atom()

void ModuleDFPT::DFPT_PW::Impl::vel_nl_per_atom ( int ik,
int a,
int it,
int ia,
int nbands,
const std::vector< ModuleBase::Vector3< double > > & gk,
std::vector< std::vector< std::complex< double > > > & vel )
private
Here is the caller graph for this function:

◆ wired()

bool ModuleDFPT::DFPT_PW::Impl::wired ( ) const
private
Here is the caller graph for this function:

◆ DFPT_PW

friend class DFPT_PW
friend

Member Data Documentation

◆ asr_type_

std::string ModuleDFPT::DFPT_PW::Impl::asr_type_ = "no"
private

acoustic sum rule mode on the Gamma matrix

◆ broyden_ndim_

int ModuleDFPT::DFPT_PW::Impl::broyden_ndim_ = 8
private

Broyden history depth (rho/v_sc Broyden) Broyden on the screening potential for v_sc mode (separate instance from the density Broyden because the array length differs: nrxx vs npw)

◆ conv_thr_

double ModuleDFPT::DFPT_PW::Impl::conv_thr_ = 1e-8
private

◆ data_

DFPT_PW_Data ModuleDFPT::DFPT_PW::Impl::data_
private

◆ dftu_

const Plus_U_Base* ModuleDFPT::DFPT_PW::Impl::dftu_ = nullptr
private

occupied states at k+q on the k+q G list, [ik][occ m][igl]; rebuilt per q (they depend on q and k only); produced by the nscf diagonalization (DFPT_NSCF on the full H(k+q)), aligned with QE

◆ ecutwfc_

double ModuleDFPT::DFPT_PW::Impl::ecutwfc_ = 0.0
private

◆ eig_

ModuleBase::matrix ModuleDFPT::DFPT_PW::Impl::eig_
private

◆ eig_kq_

std::vector<std::vector<double> > ModuleDFPT::DFPT_PW::Impl::eig_kq_
private

remembers the (q_idx, ik) the shifted operator was last cached at

◆ gs_psi_

psi::Psi<std::complex<double> > ModuleDFPT::DFPT_PW::Impl::gs_psi_
private

◆ hamilt_

std::unique_ptr<DFPT_HamiltShift> ModuleDFPT::DFPT_PW::Impl::hamilt_
private

◆ kerker_a2_

double ModuleDFPT::DFPT_PW::Impl::kerker_a2_ = 1.0
private

Kerker screening a^2, 1/lat0^2 (rho_kerker only).

◆ last_ik_

int ModuleDFPT::DFPT_PW::Impl::last_ik_ = -1
private

◆ last_q_

int ModuleDFPT::DFPT_PW::Impl::last_q_ = -1
private

◆ max_iter_

int ModuleDFPT::DFPT_PW::Impl::max_iter_ = 100
private

◆ metal_

DFPT_Metal ModuleDFPT::DFPT_PW::Impl::metal_
private

◆ mix_beta_

double ModuleDFPT::DFPT_PW::Impl::mix_beta_ = 0.4
private

◆ mix_type_

std::string ModuleDFPT::DFPT_PW::Impl::mix_type_ = "v_sc_broyden"
private

response SCF mixing scheme

◆ myrank_

int ModuleDFPT::DFPT_PW::Impl::myrank_ = 0
private

MPI rank from the init context (0 for serial); used by the dyn file writer for the rank-0 output gate

◆ nelec_

double ModuleDFPT::DFPT_PW::Impl::nelec_ = 0.0
private

◆ nqx_

int ModuleDFPT::DFPT_PW::Impl::nqx_ = 1
private

◆ nqy_

int ModuleDFPT::DFPT_PW::Impl::nqy_ = 1
private

◆ nqz_

int ModuleDFPT::DFPT_PW::Impl::nqz_ = 1
private

◆ occ_kq_

std::vector<std::vector<std::vector<std::complex<double> > > > ModuleDFPT::DFPT_PW::Impl::occ_kq_
private

nscf eigenvalues at k+q, [ik][occ m] (Ry), ascending; diagnostic companion of occ_kq_ (the Sternheimer shift keeps using the GS eigenvalue of the coupled k band)

◆ pert_

DFPT_Pert ModuleDFPT::DFPT_PW::Impl::pert_
private

◆ phon_

DFPT_Phon ModuleDFPT::DFPT_PW::Impl::phon_
private

◆ pw_rho_

ModulePW::PW_Basis* ModuleDFPT::DFPT_PW::Impl::pw_rho_ = nullptr
private

◆ pw_wfc_

ModulePW::PW_Basis_K* ModuleDFPT::DFPT_PW::Impl::pw_wfc_ = nullptr
private

◆ q0_

DFPT_Q0 ModuleDFPT::DFPT_PW::Impl::q0_
private

◆ qfile_

std::string ModuleDFPT::DFPT_PW::Impl::qfile_
private

◆ qlist_

ModuleCell::QList ModuleDFPT::DFPT_PW::Impl::qlist_
private

◆ rho_

DFPT_Rho ModuleDFPT::DFPT_PW::Impl::rho_
private

◆ sf_

Structure_Factor* ModuleDFPT::DFPT_PW::Impl::sf_ = nullptr
private

◆ stern_

DFPT_Stern ModuleDFPT::DFPT_PW::Impl::stern_
private

◆ ucell_

UnitCell* ModuleDFPT::DFPT_PW::Impl::ucell_ = nullptr
private

◆ veff_r_

std::vector<double> ModuleDFPT::DFPT_PW::Impl::veff_r_
private

◆ vsc_broyden_

std::unique_ptr<Base_Mixing::Broyden_Mixing> ModuleDFPT::DFPT_PW::Impl::vsc_broyden_
private

◆ vsc_broyden_mdata_

std::unique_ptr<Base_Mixing::Mixing_Data> ModuleDFPT::DFPT_PW::Impl::vsc_broyden_mdata_
private

◆ vxc_r_

std::vector<double> ModuleDFPT::DFPT_PW::Impl::vxc_r_
private

ground-state XC potential (valence + core input), copied from the init context: the nlcc diagonal 2n+1 term consumes it; the copy owns the storage because the context points at caller stack state

◆ wg_

ModuleBase::matrix ModuleDFPT::DFPT_PW::Impl::wg_
private

◆ xc_

const XC_First_Order* ModuleDFPT::DFPT_PW::Impl::xc_ = nullptr
private

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