|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Density-functional perturbation theory driver (plane waves). More...
#include <dfpt_pw.h>
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_ |
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
| ModuleDFPT::DFPT_PW::DFPT_PW | ( | ) |
| ModuleDFPT::DFPT_PW::~DFPT_PW | ( | ) |
| std::string ModuleDFPT::DFPT_PW::format_loto_report | ( | ) | const |
| 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
| ModuleBase::matrix ModuleDFPT::DFPT_PW::get_born_charges | ( | int | atom_idx | ) | const |
| 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)
| ModuleBase::matrix ModuleDFPT::DFPT_PW::get_dielectric_tensor | ( | ) | const |
| ModuleBase::Vector3< double > ModuleDFPT::DFPT_PW::get_loto_dir | ( | ) | const |
| 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
| int ModuleDFPT::DFPT_PW::get_nq | ( | ) | const |
number of q points of the current list (q file or q mesh)
| 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
| std::vector< double > ModuleDFPT::DFPT_PW::get_phonon_freq | ( | int | q_idx | ) | const |
| ModuleBase::Vector3< double > ModuleDFPT::DFPT_PW::get_qvec | ( | int | q_idx | ) | const |
direct (reciprocal-lattice fractional) coordinates of q_idx
| bool ModuleDFPT::DFPT_PW::get_u_active | ( | ) | const |
| 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.
| 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.
|
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.
| void ModuleDFPT::DFPT_PW::run | ( | ) |
| 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
| void ModuleDFPT::DFPT_PW::set_broyden_ndim | ( | int | ndim | ) |
Broyden history depth (broyden scheme only).
| void ModuleDFPT::DFPT_PW::set_compute_q0 | ( | bool | flag | ) |
q = 0 response switches (epsilon_inf / Born charges / LO-TO)
| void ModuleDFPT::DFPT_PW::set_conv_thr | ( | double | thr | ) |
| void ModuleDFPT::DFPT_PW::set_kerker_a2 | ( | double | a2 | ) |
Kerker screening a^2 in 1/lat0^2 units (rho_kerker scheme only).
| 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
| void ModuleDFPT::DFPT_PW::set_lin_max_iter | ( | int | max_iter | ) |
| void ModuleDFPT::DFPT_PW::set_loto | ( | bool | flag | ) |
| 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.
| void ModuleDFPT::DFPT_PW::set_max_iter | ( | int | max_iter | ) |
| void ModuleDFPT::DFPT_PW::set_mix_beta | ( | double | beta | ) |
| 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)
| void ModuleDFPT::DFPT_PW::set_qfile | ( | const std::string & | filename | ) |
q-point source: a q list file overrides the Monkhorst-Pack q mesh
| void ModuleDFPT::DFPT_PW::set_qmesh | ( | int | nqx, |
| int | nqy, | ||
| int | nqz ) |
|
private |