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

Density-functional perturbation theory driver (plane waves). More...

#include <dfpt_pw.h>

Collaboration diagram for ModuleDFPT::DFPT_PW:

Classes

class  Impl

Public Member Functions

 DFPT_PW ()
 ~DFPT_PW ()
void init (UnitCell &ucell, const psi::Psi< std::complex< double > > &psi, ModulePW::PW_Basis *pw_rho, ModulePW::PW_Basis_K *pw_wfc, Structure_Factor *sf, const std::vector< double > &veff_r, const ModuleBase::matrix &wg, const ModuleBase::matrix &eig, const XC_First_Order *xc, double nelec, double ecutwfc, const Plus_U_Base *dftu, int myrank)
void init (const DFPT_PW_InitContext &ctx)
void run ()
bool get_with_u () const
bool get_u_active () const
std::vector< double > get_phonon_freq (int q_idx) const
ModuleBase::matrix get_dielectric_tensor () const
ModuleBase::matrix get_born_charges (int atom_idx) const
void set_qfile (const std::string &filename)
 q-point source: a q list file overrides the Monkhorst-Pack q mesh
void set_qmesh (int nqx, int nqy, int nqz)
void set_conv_thr (double thr)
void set_max_iter (int max_iter)
void set_lin_conv_thr (double thr)
void set_lin_max_iter (int max_iter)
void set_mix_beta (double beta)
void set_asr (const std::string &asr_type)
void set_mix_type (const std::string &mix_type)
void set_kerker_a2 (double a2)
 Kerker screening a^2 in 1/lat0^2 units (rho_kerker scheme only).
void set_broyden_ndim (int ndim)
 Broyden history depth (broyden scheme only).
void set_compute_q0 (bool flag)
 q = 0 response switches (epsilon_inf / Born charges / LO-TO)
void set_loto (bool flag)
void set_loto_dir (const ModuleBase::Vector3< double > &dir)
int get_nq () const
 number of q points of the current list (q file or q mesh)
ModuleBase::Vector3< double > get_qvec (int q_idx) const
 direct (reciprocal-lattice fractional) coordinates of q_idx
ModuleBase::Vector3< double > get_loto_dir () const
std::vector< double > get_phon_freq_loto () const
std::string format_q_report (int q_idx) const
std::string format_loto_report () const
const DFPT_PW_Data & get_data () const
int get_myrank () const

Private Attributes

std::unique_ptr< Impl > pimpl_

Detailed Description

Density-functional perturbation theory driver (plane waves).

C7 wiring: init receives the converged ground state (psi, wg, eig), the shared-grid plane-wave bases, the real-space effective potential and the first-order XC kernel contract; run() then drives, per irreducible q, the per-displacement self-consistent Sternheimer cycle build_dv (bare external) -> [ dv_sc = v_hartree_q(drho_in) + xc_->apply(drho_in) -> Sternheimer solve of (H(k+q) - eps_n) P_c dpsi = -P_c (dV_ext

  • dV_sc)|psi_n> with the k+q occupied states as the projector -> compute_drho -> mix_drho ]* -> accumulate_electron -> assemble -> diagonalize (+ LO-TO at q = 0). With null bases (design-phase skeleton) run() keeps the documented first-iteration-converged fallback of the irrep bookkeeping loop.

Constructor & Destructor Documentation

◆ DFPT_PW()

ModuleDFPT::DFPT_PW::DFPT_PW ( )

◆ ~DFPT_PW()

ModuleDFPT::DFPT_PW::~DFPT_PW ( )

Member Function Documentation

◆ format_loto_report()

std::string ModuleDFPT::DFPT_PW::format_loto_report ( ) const

◆ format_q_report()

std::string ModuleDFPT::DFPT_PW::format_q_report ( int q_idx) const

formatted per-q frequency report (deterministic layout, pinned by the serial format regression test); the LO-TO variant is empty when no corrected frequencies are available

◆ get_born_charges()

ModuleBase::matrix ModuleDFPT::DFPT_PW::get_born_charges ( int atom_idx) const

◆ get_data()

const DFPT_PW_Data & ModuleDFPT::DFPT_PW::get_data ( ) const

read-only access to the data layer (consumed by the dyn file writer in the esolver post-processing)

Here is the caller graph for this function:

◆ get_dielectric_tensor()

ModuleBase::matrix ModuleDFPT::DFPT_PW::get_dielectric_tensor ( ) const

◆ get_loto_dir()

ModuleBase::Vector3< double > ModuleDFPT::DFPT_PW::get_loto_dir ( ) const

◆ get_myrank()

int ModuleDFPT::DFPT_PW::get_myrank ( ) const

the MPI rank passed at init (0 for serial); consumed by the dyn file writer for the rank-0 output gate

◆ get_nq()

int ModuleDFPT::DFPT_PW::get_nq ( ) const

number of q points of the current list (q file or q mesh)

◆ get_phon_freq_loto()

std::vector< double > ModuleDFPT::DFPT_PW::get_phon_freq_loto ( ) const

signed Gamma frequencies (cm^-1) after the LO-TO correction; empty when loto is off or the correction has not run

◆ get_phonon_freq()

std::vector< double > ModuleDFPT::DFPT_PW::get_phonon_freq ( int q_idx) const

◆ get_qvec()

ModuleBase::Vector3< double > ModuleDFPT::DFPT_PW::get_qvec ( int q_idx) const

direct (reciprocal-lattice fractional) coordinates of q_idx

◆ get_u_active()

bool ModuleDFPT::DFPT_PW::get_u_active ( ) const

◆ get_with_u()

bool ModuleDFPT::DFPT_PW::get_with_u ( ) const

DFT+U reservation accessors (U0): with_u() reports whether a DFT+U provider is wired (dft_plus_u enabled upstream); u_active() further requires the provider to be usable (occupation matrices initialized). init() rejects a wired provider explicitly: every DFPT U hook is a no-op reservation, so a DFT+U ground state must not run DFPT until the first-order U response (U1) is implemented.

◆ init() [1/2]

void ModuleDFPT::DFPT_PW::init ( const DFPT_PW_InitContext & ctx)

Single-context init carrying the twelve parameters as named fields so the function body stays under the coding-rule parameter-count budget. Semantics are identical to the overload above.

Here is the call graph for this function:

◆ init() [2/2]

void ModuleDFPT::DFPT_PW::init ( UnitCell & ucell,
const psi::Psi< std::complex< double > > & psi,
ModulePW::PW_Basis * pw_rho,
ModulePW::PW_Basis_K * pw_wfc,
Structure_Factor * sf,
const std::vector< double > & veff_r,
const ModuleBase::matrix & wg,
const ModuleBase::matrix & eig,
const XC_First_Order * xc,
double nelec,
double ecutwfc,
const Plus_U_Base * dftu,
int myrank )
inline

Package-and-forward convenience wrapper: the former 12-argument signature is retained for backward compatibility with the small number of call sites (esolver_dfpt_pw.cpp + three test fixtures), and the actual validation/submodule wiring happens in the InitContext overload below. Keeping the thin wrapper inline avoids a separate TU and gives the call-site aggregate initialization the same performance as a direct call.

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

◆ run()

void ModuleDFPT::DFPT_PW::run ( )
Here is the call graph for this function:

◆ set_asr()

void ModuleDFPT::DFPT_PW::set_asr ( const std::string & asr_type)

acoustic sum rule on the Gamma dynamical matrix ("no" | "simple" | "crystal"); applied to the raw matrix before the LO-TO term

◆ set_broyden_ndim()

void ModuleDFPT::DFPT_PW::set_broyden_ndim ( int ndim)

Broyden history depth (broyden scheme only).

◆ set_compute_q0()

void ModuleDFPT::DFPT_PW::set_compute_q0 ( bool flag)

q = 0 response switches (epsilon_inf / Born charges / LO-TO)

◆ set_conv_thr()

void ModuleDFPT::DFPT_PW::set_conv_thr ( double thr)
Here is the caller graph for this function:

◆ set_kerker_a2()

void ModuleDFPT::DFPT_PW::set_kerker_a2 ( double a2)

Kerker screening a^2 in 1/lat0^2 units (rho_kerker scheme only).

◆ set_lin_conv_thr()

void ModuleDFPT::DFPT_PW::set_lin_conv_thr ( double thr)

dedicated knobs of the inner Sternheimer linear solve; non-positive values keep the historical inherit-from-outer behavior

Here is the caller graph for this function:

◆ set_lin_max_iter()

void ModuleDFPT::DFPT_PW::set_lin_max_iter ( int max_iter)
Here is the caller graph for this function:

◆ set_loto()

void ModuleDFPT::DFPT_PW::set_loto ( bool flag)

◆ set_loto_dir()

void ModuleDFPT::DFPT_PW::set_loto_dir ( const ModuleBase::Vector3< double > & dir)

q->0 direction of the non-analytic (LO-TO) term: any non-null vector is normalized to a unit direction by the data layer; the default is the isotropic (1,1,1)/sqrt(3). Consumed by run() so no direction is hardcoded in the driver anymore.

◆ set_max_iter()

void ModuleDFPT::DFPT_PW::set_max_iter ( int max_iter)
Here is the caller graph for this function:

◆ set_mix_beta()

void ModuleDFPT::DFPT_PW::set_mix_beta ( double beta)

◆ set_mix_type()

void ModuleDFPT::DFPT_PW::set_mix_type ( const std::string & mix_type)

response SCF mixing scheme: "rho_plain" (beta only), "rho_kerker" (screen f_g = |G+q|^2/(|G+q|^2+a^2), a^2 via set_kerker_a2), "rho_broyden" (Modified Broyden on the density), or the potential mixes "v_sc_plain" / "v_sc_broyden" (handled in solve_displacement)

◆ set_qfile()

void ModuleDFPT::DFPT_PW::set_qfile ( const std::string & filename)

q-point source: a q list file overrides the Monkhorst-Pack q mesh

◆ set_qmesh()

void ModuleDFPT::DFPT_PW::set_qmesh ( int nqx,
int nqy,
int nqz )

Member Data Documentation

◆ pimpl_

std::unique_ptr<Impl> ModuleDFPT::DFPT_PW::pimpl_
private

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