|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#include <dfpt_pw_data.h>
Public Member Functions | |
| DFPT_PW_Data () | |
| ~DFPT_PW_Data () | |
| void | init (ModuleCell::QList *qlist, int nk, int nbands, int npw_max, int nrxx, int nspin, int nat, const Plus_U_Base *dftu) |
| void | clean () |
| int | get_nq () const |
| ModuleBase::Vector3< double > | get_qvec (int q_idx) const |
| int | get_nirr (int q_idx) const |
| std::vector< int > | get_irrep_modes (int q_idx, int irrep) const |
| void | set_dpsi (int q_idx, int k_idx, int band_idx, const std::vector< std::complex< double > > &psi) |
| std::vector< std::complex< double > > | get_dpsi (int q_idx, int k_idx, int band_idx) const |
| void | set_drho_r (int q_idx, int spin, const std::vector< double > &rho) |
| std::vector< double > | get_drho_r (int q_idx, int spin) const |
| void | set_drho_g (int q_idx, int spin, const std::vector< std::complex< double > > &rho) |
| void | set_drhoc_g (int q_idx, const std::vector< std::complex< double > > &rho_c) |
| std::vector< std::complex< double > > | get_drhoc_g (int q_idx) const |
| std::vector< std::complex< double > > | get_drho_g (int q_idx, int spin) const |
| void | set_dv_r (int q_idx, int spin, const std::vector< double > &v) |
| std::vector< double > | get_dv_r (int q_idx, int spin) const |
| void | set_dv_recip_c (int q_idx, int spin, const std::vector< std::complex< double > > &v) |
| std::vector< std::complex< double > > | get_dv_recip_c (int q_idx, int spin) const |
| void | set_dv_rc (int q_idx, int spin, const std::vector< std::complex< double > > &v) |
| std::vector< std::complex< double > > | get_dv_rc (int q_idx, int spin) const |
| void | set_dynmat (int q_idx, const ModuleBase::ComplexMatrix &dm) |
| ModuleBase::ComplexMatrix | get_dynmat (int q_idx) const |
| void | set_dynmat_raw (int q_idx, const ModuleBase::ComplexMatrix &dm) |
| ModuleBase::ComplexMatrix | get_dynmat_raw (int q_idx) const |
| bool | has_dynmat_raw (int q_idx) const |
| void | set_phon_freq (int q_idx, const std::vector< double > &freq) |
| std::vector< double > | get_phon_freq (int q_idx) const |
| void | set_dielectric (const ModuleBase::matrix &eps) |
| ModuleBase::matrix | get_dielectric () const |
| void | set_born (int atom_idx, const ModuleBase::matrix &z) |
| ModuleBase::matrix | get_born (int atom_idx) const |
| void | set_compute_q0 (bool flag) |
| bool | get_compute_q0 () const |
| void | set_loto (bool flag) |
| bool | get_loto () const |
| void | set_loto_dir (const ModuleBase::Vector3< double > &dir) |
| ModuleBase::Vector3< double > | get_loto_dir () const |
| void | set_phon_freq_loto (const std::vector< double > &freq) |
| std::vector< double > | get_phon_freq_loto () const |
| void | set_pert_atom (int atom_idx) |
| int | get_pert_atom () const |
| void | set_pert_dir (int dir) |
| int | get_pert_dir () const |
| void | set_is_metal (bool flag) |
| bool | get_is_metal () const |
| void | set_dmu (double dmu) |
| double | get_dmu () const |
| void | set_max_iter (int iter) |
| int | get_max_iter () const |
| void | set_conv_thr (double thr) |
| double | get_conv_thr () const |
| void | set_lin_max_iter (int iter) |
| int | get_lin_max_iter () const |
| void | set_lin_conv_thr (double thr) |
| double | get_lin_conv_thr () const |
| void | set_converged (int q_idx, int irrep, bool flag) |
| bool | get_converged (int q_idx, int irrep) const |
| void | add_residual (int q_idx, int irrep, double r) |
| std::vector< double > | get_residuals (int q_idx, int irrep) const |
| void | set_current_iter (int q_idx, int irrep, int iter) |
| int | get_current_iter (int q_idx, int irrep) const |
| bool | with_u () const |
| bool | u_active () const |
| const Plus_U_Base * | get_dftu () const |
| void | set_docc (int q_idx, const std::vector< std::complex< double > > &occ) |
| std::vector< std::complex< double > > | get_docc (int q_idx) const |
| void | set_vsc_r (int atom_idx, int dir, const std::vector< std::complex< double > > &v) |
| std::vector< std::complex< double > > | get_vsc_r (int atom_idx, int dir) const |
| void | set_drho_disp (int atom_idx, int dir, const std::vector< std::complex< double > > &rho) |
| std::vector< std::complex< double > > | get_drho_disp (int atom_idx, int dir) const |
| void | set_dpsi_disp (int atom_idx, int dir, const std::vector< std::vector< std::vector< std::complex< double > > > > &d) |
| std::vector< std::vector< std::vector< std::complex< double > > > > | get_dpsi_disp (int atom_idx, int dir) const |
| void | set_pos_resp (int dir, const std::vector< std::vector< std::vector< std::complex< double > > > > &y) |
| std::vector< std::vector< std::vector< std::complex< double > > > > | get_pos_resp (int dir) const |
| void | set_dpsi_efield (int dir, const std::vector< std::vector< std::vector< std::complex< double > > > > &d) |
| std::vector< std::vector< std::vector< std::complex< double > > > > | get_dpsi_efield (int dir) const |
Private Member Functions | |
| void | allocate_memory () |
| void | deallocate_memory () |
Private Attributes | |
| ModuleCell::QList * | qlist_ = nullptr |
| int | nk_ = 0 |
| int | nbands_ = 0 |
| int | npw_max_ = 0 |
| int | nrxx_ = 0 |
| int | nspin_ = 1 |
| int | nat_ = 0 |
| std::vector< std::vector< std::vector< std::vector< std::complex< double > > > > > | dpsi_ |
| std::vector< std::vector< std::vector< double > > > | drho_r_ |
| std::vector< std::vector< std::vector< std::complex< double > > > > | drho_g_ |
| q-shifted first-order core density (G space), [q] | |
| std::vector< std::vector< std::complex< double > > > | drhoc_g_ |
| std::vector< std::vector< std::vector< double > > > | dv_r_ |
| std::vector< std::vector< std::vector< std::complex< double > > > > | dv_recip_c_ |
| std::vector< std::vector< std::vector< std::complex< double > > > > | dv_rc_ |
| std::vector< ModuleBase::ComplexMatrix > | dynmat_ |
| std::vector< ModuleBase::ComplexMatrix > | dynmat_raw_ |
| pre-ASR / pre-LO-TO copies for the dyn file output ([q]) | |
| std::vector< std::vector< double > > | phon_freq_ |
| bool | compute_q0_ = false |
| bool | loto_ = false |
| ModuleBase::Vector3< double > | loto_dir_ {1.0 / std::sqrt(3.0), 1.0 / std::sqrt(3.0), 1.0 / std::sqrt(3.0)} |
| std::vector< double > | phon_freq_loto_ |
| int | pert_atom_ = -1 |
| int | pert_dir_ = -1 |
| ModuleBase::matrix | dielectric_ |
| std::vector< ModuleBase::matrix > | born_ |
| bool | is_metal_ = false |
| double | dmu_ = 0.0 |
| const Plus_U_Base * | dftu_ = nullptr |
| DFT+U reservation state (U0). | |
| std::vector< std::vector< std::complex< double > > > | docc_ |
| std::vector< std::vector< std::complex< double > > > | vsc_r_ |
| converged v_sc per displacement (atom, dir): [3*nat] entries | |
| std::vector< std::vector< std::complex< double > > > | drho_disp_ |
| converged first-order density per displacement (atom, dir): [3*nat] | |
| std::vector< std::vector< std::vector< std::vector< std::complex< double > > > > > | dpsi_disp_ |
| converged dpsi per displacement (atom, dir): [3*nat][k][band] entries | |
| std::vector< std::vector< std::vector< std::vector< std::complex< double > > > > > | pos_resp_ |
| std::vector< std::vector< std::vector< std::vector< std::complex< double > > > > > | dpsi_efield_ |
| converged E-field response dpsi^E per direction: [3][k][band] | |
| int | max_iter_ = 100 |
| double | conv_thr_ = 1e-8 |
| int | lin_max_iter_ = 0 |
| double | lin_conv_thr_ = -1.0 |
| per-(q, irrep) SCF ledger (B4: absorbed from DFPT_IrrepData) | |
| std::map< std::pair< int, int >, bool > | converged_ |
| std::map< std::pair< int, int >, std::vector< double > > | residuals_ |
| std::map< std::pair< int, int >, int > | current_iter_ |
| bool | is_initialized_ = false |
| ModuleDFPT::DFPT_PW_Data::DFPT_PW_Data | ( | ) |
| ModuleDFPT::DFPT_PW_Data::~DFPT_PW_Data | ( | ) |
| void ModuleDFPT::DFPT_PW_Data::add_residual | ( | int | q_idx, |
| int | irrep, | ||
| double | r ) |
|
private |
| void ModuleDFPT::DFPT_PW_Data::clean | ( | ) |
|
private |
| ModuleBase::matrix ModuleDFPT::DFPT_PW_Data::get_born | ( | int | atom_idx | ) | const |
|
inline |
|
inline |
| bool ModuleDFPT::DFPT_PW_Data::get_converged | ( | int | q_idx, |
| int | irrep ) const |
| int ModuleDFPT::DFPT_PW_Data::get_current_iter | ( | int | q_idx, |
| int | irrep ) const |
|
inline |
| ModuleBase::matrix ModuleDFPT::DFPT_PW_Data::get_dielectric | ( | ) | const |
|
inline |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_docc | ( | int | q_idx | ) | const |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_dpsi | ( | int | q_idx, |
| int | k_idx, | ||
| int | band_idx ) const |
| std::vector< std::vector< std::vector< std::complex< double > > > > ModuleDFPT::DFPT_PW_Data::get_dpsi_disp | ( | int | atom_idx, |
| int | dir ) const |
| std::vector< std::vector< std::vector< std::complex< double > > > > ModuleDFPT::DFPT_PW_Data::get_dpsi_efield | ( | int | dir | ) | const |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_drho_disp | ( | int | atom_idx, |
| int | dir ) const |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_drho_g | ( | int | q_idx, |
| int | spin ) const |
| std::vector< double > ModuleDFPT::DFPT_PW_Data::get_drho_r | ( | int | q_idx, |
| int | spin ) const |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_drhoc_g | ( | int | q_idx | ) | const |
| std::vector< double > ModuleDFPT::DFPT_PW_Data::get_dv_r | ( | int | q_idx, |
| int | spin ) const |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_dv_rc | ( | int | q_idx, |
| int | spin ) const |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_dv_recip_c | ( | int | q_idx, |
| int | spin ) const |
| ModuleBase::ComplexMatrix ModuleDFPT::DFPT_PW_Data::get_dynmat | ( | int | q_idx | ) | const |
| ModuleBase::ComplexMatrix ModuleDFPT::DFPT_PW_Data::get_dynmat_raw | ( | int | q_idx | ) | const |
| std::vector< int > ModuleDFPT::DFPT_PW_Data::get_irrep_modes | ( | int | q_idx, |
| int | irrep ) const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| int ModuleDFPT::DFPT_PW_Data::get_nirr | ( | int | q_idx | ) | const |
| int ModuleDFPT::DFPT_PW_Data::get_nq | ( | ) | const |
|
inline |
|
inline |
| std::vector< double > ModuleDFPT::DFPT_PW_Data::get_phon_freq | ( | int | q_idx | ) | const |
|
inline |
| std::vector< std::vector< std::vector< std::complex< double > > > > ModuleDFPT::DFPT_PW_Data::get_pos_resp | ( | int | dir | ) | const |
| ModuleBase::Vector3< double > ModuleDFPT::DFPT_PW_Data::get_qvec | ( | int | q_idx | ) | const |
| std::vector< double > ModuleDFPT::DFPT_PW_Data::get_residuals | ( | int | q_idx, |
| int | irrep ) const |
| std::vector< std::complex< double > > ModuleDFPT::DFPT_PW_Data::get_vsc_r | ( | int | atom_idx, |
| int | dir ) const |
| bool ModuleDFPT::DFPT_PW_Data::has_dynmat_raw | ( | int | q_idx | ) | const |
| void ModuleDFPT::DFPT_PW_Data::init | ( | ModuleCell::QList * | qlist, |
| int | nk, | ||
| int | nbands, | ||
| int | npw_max, | ||
| int | nrxx, | ||
| int | nspin, | ||
| int | nat, | ||
| const Plus_U_Base * | dftu ) |
| void ModuleDFPT::DFPT_PW_Data::set_born | ( | int | atom_idx, |
| const ModuleBase::matrix & | z ) |
|
inline |
|
inline |
| void ModuleDFPT::DFPT_PW_Data::set_converged | ( | int | q_idx, |
| int | irrep, | ||
| bool | flag ) |
Per-(q, irrep) SCF convergence ledger (B4: sunk from the retired DFPT_IrrepData adapter). The irrep dimension is a stage-A slot: today the single fallback irrep 0 carries the full 3N displacement basis, and DFPT_PW::run records one ledger entry per outer SCF pass (worst displacement residual of the pass); missing keys read as not-converged / empty history / iteration 0.
| void ModuleDFPT::DFPT_PW_Data::set_current_iter | ( | int | q_idx, |
| int | irrep, | ||
| int | iter ) |
| void ModuleDFPT::DFPT_PW_Data::set_dielectric | ( | const ModuleBase::matrix & | eps | ) |
|
inline |
| void ModuleDFPT::DFPT_PW_Data::set_docc | ( | int | q_idx, |
| const std::vector< std::complex< double > > & | occ ) |
first-order occupation matrix (docc) storage, indexed by q. lazy allocation: unset / out-of-range reads return an empty vector.
| void ModuleDFPT::DFPT_PW_Data::set_dpsi | ( | int | q_idx, |
| int | k_idx, | ||
| int | band_idx, | ||
| const std::vector< std::complex< double > > & | psi ) |
| void ModuleDFPT::DFPT_PW_Data::set_dpsi_disp | ( | int | atom_idx, |
| int | dir, | ||
| const std::vector< std::vector< std::vector< std::complex< double > > > > & | d ) |
converged dpsi of displacement (atom, dir), indexed [k][band]; the two-pass 2n+1 accumulation reads it back after all displacements of the basis have been solved (the working dpsi slots get overwritten by later solves).
| void ModuleDFPT::DFPT_PW_Data::set_dpsi_efield | ( | int | dir, |
| const std::vector< std::vector< std::vector< std::complex< double > > > > & | d ) |
converged screened E-field response dpsi^E(dir) of the q = 0 mesh (QE solve_e + dfpt_kernel fixed point on the rhs -(Y^dir + dV_sc^E|psi>)), indexed [dir][k][band]
| void ModuleDFPT::DFPT_PW_Data::set_drho_disp | ( | int | atom_idx, |
| int | dir, | ||
| const std::vector< std::complex< double > > & | rho ) |
converged first-order density response (G space) of displacement (atom, dir): the two-pass 2n+1 accumulation needs it to rebuild the nlcc kernel input f_xc.(drho_val + drhoc) per displacement, after the working drho slots hold the last solved displacement
| void ModuleDFPT::DFPT_PW_Data::set_drho_g | ( | int | q_idx, |
| int | spin, | ||
| const std::vector< std::complex< double > > & | rho ) |
| void ModuleDFPT::DFPT_PW_Data::set_drho_r | ( | int | q_idx, |
| int | spin, | ||
| const std::vector< double > & | rho ) |
| void ModuleDFPT::DFPT_PW_Data::set_drhoc_g | ( | int | q_idx, |
| const std::vector< std::complex< double > > & | rho_c ) |
q-shifted first-order core-density amplitude (G space, npw); zero-size means no nlcc atoms / not yet computed
| void ModuleDFPT::DFPT_PW_Data::set_dv_r | ( | int | q_idx, |
| int | spin, | ||
| const std::vector< double > & | v ) |
| void ModuleDFPT::DFPT_PW_Data::set_dv_rc | ( | int | q_idx, |
| int | spin, | ||
| const std::vector< std::complex< double > > & | v ) |
| void ModuleDFPT::DFPT_PW_Data::set_dv_recip_c | ( | int | q_idx, |
| int | spin, | ||
| const std::vector< std::complex< double > > & | v ) |
First-order perturbation potential dV stored as complex plane-wave coefficients (indexed by the rho-grid ig) and as the corresponding complex real-space array on the shared FFT grid (C1). The reciprocal coefficients already carry the -i(Delta+q) prefactor and the atomic phase exp(i(Delta+q).tau); the real-space array is their inverse Fourier transform, so that dV.psi is a plain cyclic convolution on the shared grid (apply_dv needs no extra q-phase).
| void ModuleDFPT::DFPT_PW_Data::set_dynmat | ( | int | q_idx, |
| const ModuleBase::ComplexMatrix & | dm ) |
The dynamical matrix at a generic q is complex Hermitian; stored as a ModuleBase::ComplexMatrix (C5), consumed by DFPT_Phon::diagonalize through the LapackConnector::zheev wrapper.
| void ModuleDFPT::DFPT_PW_Data::set_dynmat_raw | ( | int | q_idx, |
| const ModuleBase::ComplexMatrix & | dm ) |
stash the raw (pre-ASR, pre-LO-TO) dynamical matrix for the dyn file output; the working dynmat_ is mutated in place by apply_asr and add_loto at Gamma, so the file writer needs this untouched copy
|
inline |
|
inline |
|
inline |
Dedicated knobs of the inner Sternheimer linear solve. Both default to the inherit sentinel: unless set explicitly they track the outer mixing values (the historical single-knob behavior), so existing INPUT files are unaffected.
|
inline |
| void ModuleDFPT::DFPT_PW_Data::set_loto_dir | ( | const ModuleBase::Vector3< double > & | dir | ) |
q->0 direction of the non-analytic (LO-TO) term, as a unit vector. The setter normalizes; a null vector falls back to the isotropic default (1,1,1)/sqrt(3) (documented cubic-crystal default; a general direction control arrives with the irrep machinery of stage A).
< empirical parameter: norm below which the direction input is null
|
inline |
|
inline |
The perturbation currently being solved: displacement of which linear atom index (over all atoms) and along which cartesian direction. Set by DFPT_Pert::build_dv and consumed by DFPT_Pert::apply_dv so the Stern solver can keep applying the same perturbation per irrep without re-passing (atom,dir) on every matrix-vector product.
|
inline |
| void ModuleDFPT::DFPT_PW_Data::set_phon_freq | ( | int | q_idx, |
| const std::vector< double > & | freq ) |
|
inline |
signed Gamma frequencies (cm^-1) after the non-analytic LO-TO term along loto_dir_; empty until add_loto + diagonalize_loto have run
| void ModuleDFPT::DFPT_PW_Data::set_pos_resp | ( | int | dir, |
| const std::vector< std::vector< std::vector< std::complex< double > > > > & | y ) |
conduction-projected position operator P_c r_dir |u_(k,band)> of the q = 0 mesh, solved exactly as a linear response ((H - eps_band) Y = -(i/tpiba) dH/dk_dir |u>), indexed [dir][k][band]; the screened Born charge contraction <dpsi^kappa|P_c r|u> avoids the empty-eigenvector truncation of the explicit r-matrix sum
| void ModuleDFPT::DFPT_PW_Data::set_vsc_r | ( | int | atom_idx, |
| int | dir, | ||
| const std::vector< std::complex< double > > & | v ) |
converged screened response potential of displacement (atom, dir): the real-space q-shifted complex amplitude v_sc used by the last Sternheimer iteration of that displacement. The 2n+1 accumulation needs it to complete the term2 cross section 2<dpsi^a|dV_ext^b + dV_sc^b|psi> (screening channel).
| bool ModuleDFPT::DFPT_PW_Data::u_active | ( | ) | const |
|
inline |
DFT+U interface reservation (U0): the DFPT modules never read global input state directly; the esolver layer decides whether DFT+U is active and passes a non-null Plus_U_Base* only then. with_u(): a DFT+U provider is wired (dft_plus_u enabled upstream). u_active(): the provider is additionally usable (occupation matrices initialized, which the ground state does when DFT+U actually runs; a provider without them stays inactive).
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
DFT+U reservation state (U0).
|
private |
|
private |
|
private |
|
private |
first-order wavefunction response, indexed [q][k][band]; each entry is the dpsi on the k+q basis for that band (a vector of complex coefficients).
|
private |
converged dpsi per displacement (atom, dir): [3*nat][k][band] entries
|
private |
converged E-field response dpsi^E per direction: [3][k][band]
|
private |
converged first-order density per displacement (atom, dir): [3*nat]
|
private |
q-shifted first-order core density (G space), [q]
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
pre-ASR / pre-LO-TO copies for the dyn file output ([q])
|
private |
|
private |
|
private |
per-(q, irrep) SCF ledger (B4: absorbed from DFPT_IrrepData)
|
private |
inner Sternheimer knobs; <=0 / <=0.0 is the inherit sentinel resolved at read time by the getters (keeps tracking the outer values until set explicitly)
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
conduction-projected position response P_c r_dir|u> per direction: [3][k][band] entries
|
private |
|
private |
|
private |
converged v_sc per displacement (atom, dir): [3*nat] entries