|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#include <vnl_pw.h>
Public Member Functions | |
| pseudopot_cell_vnl () | |
| ~pseudopot_cell_vnl () | |
| void | init (const UnitCell &cell, Structure_Factor *psf_in, const ModulePW::PW_Basis_K *wfc_basis=nullptr, const bool allocate_vkb=true) |
| void | init_vnl (UnitCell &cell, const ModulePW::PW_Basis *rho_basis) |
| void | rescale_vnl (const double &omega_in) |
| void | ensure_vnl_range (const UnitCell &cell, const double &qmax) |
| Ensure four-point interpolation covers qmax (inverse Bohr), without changing dq. | |
| void | check_vnl_index (const double &index, const bool &derivative) const |
| Reject non-finite or out-of-range dimensionless interpolation indices before reading. | |
| double | table_dq () const |
| Return the momentum spacing shared by the radial projector and derivative tables. | |
| template<typename FPTYPE, typename Device> | |
| void | getvnl (Device *ctx, const UnitCell &ucell, const int &ik, const ModuleBase::Vector3< double > &vector_potential, std::complex< FPTYPE > *vkb_in) const |
| Build nonlocal projectors at G+k+A; pass zero A for ground-state calculations. | |
| void | init_vnl_alpha (const UnitCell &cell) |
| void | initgradq_vnl (const UnitCell &cell) |
| size_t | table_version () const |
| Generation of radial tables, including volume rescaling. | |
| void | ensure_grad_table (const UnitCell &cell) |
| Prepare the derivative table only when the radial table changed. | |
| std::complex< double > | Cal_C (int alpha, int lu, int mu, int L, int M) |
| double | CG (int l1, int m1, int l2, int m2, int L, int M) |
| void | print_vnl (std::ofstream &ofs) |
| void | radial_fft_q (const int ng, const int ih, const int jh, const int itype, const double *qnorm, const ModuleBase::matrix ylm, std::complex< double > *qg) const |
| Compute the radial Fourier transform of the Q functions. | |
| template<typename FPTYPE, typename Device> | |
| void | radial_fft_q (Device *ctx, const int ng, const int ih, const int jh, const int itype, const FPTYPE *qnorm, const FPTYPE *ylm, std::complex< FPTYPE > *qg) const |
| Compute the radial Fourier transform using raw CPU pointers. | |
| void | cal_effective_D (const ModuleBase::matrix &veff, const ModulePW::PW_Basis *rho_basis, UnitCell &cell) |
| calculate the effective coefficient matrix for non-local pseudopotential projectors | |
| template<typename FPTYPE> | |
| FPTYPE * | get_nhtol_data () const |
| template<typename FPTYPE> | |
| FPTYPE * | get_nhtolm_data () const |
| template<typename FPTYPE> | |
| FPTYPE * | get_indv_data () const |
| template<typename FPTYPE> | |
| FPTYPE * | get_tab_data () const |
| template<typename FPTYPE> | |
| FPTYPE * | get_deeq_data () const |
| template<typename FPTYPE> | |
| FPTYPE * | get_qq_nt_data () const |
| template<typename FPTYPE> | |
| std::complex< FPTYPE > * | get_qq_so_data () const |
| template<typename FPTYPE> | |
| std::complex< FPTYPE > * | get_vkb_data () const |
| template<typename FPTYPE> | |
| std::complex< FPTYPE > * | get_deeq_nc_data () const |
| void | release_memory () |
| template<> | |
| std::complex< float > * | get_vkb_data () const |
| template<> | |
| std::complex< double > * | get_vkb_data () const |
| template<> | |
| float * | get_nhtol_data () const |
| template<> | |
| double * | get_nhtol_data () const |
| template<> | |
| float * | get_nhtolm_data () const |
| template<> | |
| double * | get_nhtolm_data () const |
| template<> | |
| float * | get_indv_data () const |
| template<> | |
| double * | get_indv_data () const |
| template<> | |
| float * | get_tab_data () const |
| template<> | |
| double * | get_tab_data () const |
| template<> | |
| float * | get_deeq_data () const |
| template<> | |
| double * | get_deeq_data () const |
| template<> | |
| float * | get_qq_nt_data () const |
| template<> | |
| double * | get_qq_nt_data () const |
| template<> | |
| std::complex< float > * | get_vkb_data () const |
| template<> | |
| std::complex< double > * | get_vkb_data () const |
| template<> | |
| std::complex< float > * | get_deeq_nc_data () const |
| template<> | |
| std::complex< double > * | get_deeq_nc_data () const |
| template<> | |
| std::complex< float > * | get_qq_so_data () const |
| template<> | |
| std::complex< double > * | get_qq_so_data () const |
Private Member Functions | |
| void | fill_vnl_table (const UnitCell &cell) |
| Fill the allocated radial projector table using the original Bessel quadrature. | |
| void | sync_vnl_table () |
| Refresh aliases and allocated precision/device copies after radial-table changes. | |
| void | compute_qrad (UnitCell &cell) |
| Compute interpolation table qrad. | |
| void | newq (const ModuleBase::matrix &veff, const ModulePW::PW_Basis *rho_basis, UnitCell &cell) |
| computes the integral of the effective potential with the Q function | |
| void | newd_so (const int &iat, UnitCell &cell) |
| calculate D functions in the soc case when tvanp is true | |
| void | newd_nc (const int &iat, UnitCell &cell) |
| calculate D functions in the noncolin case when tvanp is true | |
Private Attributes | |
| double | table_dq_ = 0.0 |
| size_t | table_version_ = 1 |
| size_t | gradient_version_ = 0 |
| bool | memory_released = false |
| float * | s_nhtol = nullptr |
| float * | s_nhtolm = nullptr |
| float * | s_indv = nullptr |
| float * | s_tab = nullptr |
| std::complex< float > * | c_vkb = nullptr |
| double * | d_nhtol = nullptr |
| double * | d_nhtolm = nullptr |
| double * | d_indv = nullptr |
| double * | d_tab = nullptr |
| std::complex< double > * | z_vkb = nullptr |
| const ModulePW::PW_Basis_K * | wfcpw = nullptr |
| Soc | soc |
| double | omega_old = 0 |
| bool | use_gpu_ = false |
| pseudopot_cell_vnl::pseudopot_cell_vnl | ( | ) |
| pseudopot_cell_vnl::~pseudopot_cell_vnl | ( | ) |
| std::complex< double > pseudopot_cell_vnl::Cal_C | ( | int | alpha, |
| int | lu, | ||
| int | mu, | ||
| int | L, | ||
| int | M ) |
| void pseudopot_cell_vnl::cal_effective_D | ( | const ModuleBase::matrix & | veff, |
| const ModulePW::PW_Basis * | rho_basis, | ||
| UnitCell & | cell ) |
calculate the effective coefficient matrix for non-local pseudopotential projectors
Recalculate effective coefficient matrix for non-local pseudopotential.
| veff | effective potential |
| rho_basis | potential FFT grids |
| cell | UnitCell |
For norm-conserving (KB) pseudopotentials, copy dvan into deeq directly. For Vanderbilt USPP, call newq() to add the augmentation contribution, then rotate into deeq_nc if SOC/non-collinear is enabled.
| veff | effective potential on real-space grid |
| rho_basis | plane-wave basis for charge density FFT |
| cell | unit cell (read-only, but passed by reference for compatibility) |
| double pseudopot_cell_vnl::CG | ( | int | l1, |
| int | m1, | ||
| int | l2, | ||
| int | m2, | ||
| int | L, | ||
| int | M ) |
| void pseudopot_cell_vnl::check_vnl_index | ( | const double & | index, |
| const bool & | derivative ) const |
Reject non-finite or out-of-range dimensionless interpolation indices before reading.
|
private |
Compute interpolation table qrad.
Build the radial Fourier transform interpolation table qrad.
Compute interpolation table qrad(i,nm,l,nt) = Q^{(L)}_{nm,nt}(q_i) of angular momentum L, for atom of type nt, on grid q_i, where nm = combined index for n,m=1,nh(nt)
| cell | UnitCell |
For each Vanderbilt USPP pseudopotential, compute qrad(it, l, ijv, iq) = (4*pi/omega) * integral[ r^2 * j_l(q*r) * Q_{ij}(r) dr ] using Simpson integration on the pseudopotential radial grid.
| cell | unit cell (read-only, but passed by reference for compatibility) |
| void pseudopot_cell_vnl::ensure_grad_table | ( | const UnitCell & | cell | ) |
Prepare the derivative table only when the radial table changed.
| void pseudopot_cell_vnl::ensure_vnl_range | ( | const UnitCell & | cell, |
| const double & | qmax ) |
Ensure four-point interpolation covers qmax (inverse Bohr), without changing dq.
|
private |
Fill the allocated radial projector table using the original Bessel quadrature.
| double * pseudopot_cell_vnl::get_deeq_data | ( | ) | const |
| float * pseudopot_cell_vnl::get_deeq_data | ( | ) | const |
| FPTYPE * pseudopot_cell_vnl::get_deeq_data | ( | ) | const |
| std::complex< double > * pseudopot_cell_vnl::get_deeq_nc_data | ( | ) | const |
| std::complex< float > * pseudopot_cell_vnl::get_deeq_nc_data | ( | ) | const |
| std::complex< FPTYPE > * pseudopot_cell_vnl::get_deeq_nc_data | ( | ) | const |
| double * pseudopot_cell_vnl::get_indv_data | ( | ) | const |
| float * pseudopot_cell_vnl::get_indv_data | ( | ) | const |
| FPTYPE * pseudopot_cell_vnl::get_indv_data | ( | ) | const |
| double * pseudopot_cell_vnl::get_nhtol_data | ( | ) | const |
| float * pseudopot_cell_vnl::get_nhtol_data | ( | ) | const |
| FPTYPE * pseudopot_cell_vnl::get_nhtol_data | ( | ) | const |
| double * pseudopot_cell_vnl::get_nhtolm_data | ( | ) | const |
| float * pseudopot_cell_vnl::get_nhtolm_data | ( | ) | const |
| FPTYPE * pseudopot_cell_vnl::get_nhtolm_data | ( | ) | const |
| double * pseudopot_cell_vnl::get_qq_nt_data | ( | ) | const |
| float * pseudopot_cell_vnl::get_qq_nt_data | ( | ) | const |
| FPTYPE * pseudopot_cell_vnl::get_qq_nt_data | ( | ) | const |
| std::complex< double > * pseudopot_cell_vnl::get_qq_so_data | ( | ) | const |
| std::complex< float > * pseudopot_cell_vnl::get_qq_so_data | ( | ) | const |
| std::complex< FPTYPE > * pseudopot_cell_vnl::get_qq_so_data | ( | ) | const |
| double * pseudopot_cell_vnl::get_tab_data | ( | ) | const |
| float * pseudopot_cell_vnl::get_tab_data | ( | ) | const |
| FPTYPE * pseudopot_cell_vnl::get_tab_data | ( | ) | const |
| std::complex< float > * pseudopot_cell_vnl::get_vkb_data | ( | ) | const |
| std::complex< double > * pseudopot_cell_vnl::get_vkb_data | ( | ) | const |
| std::complex< double > * pseudopot_cell_vnl::get_vkb_data | ( | ) | const |
| std::complex< float > * pseudopot_cell_vnl::get_vkb_data | ( | ) | const |
| std::complex< FPTYPE > * pseudopot_cell_vnl::get_vkb_data | ( | ) | const |
| void pseudopot_cell_vnl::getvnl | ( | Device * | ctx, |
| const UnitCell & | ucell, | ||
| const int & | ik, | ||
| const ModuleBase::Vector3< double > & | vector_potential, | ||
| std::complex< FPTYPE > * | vkb_in ) const |
Build nonlocal projectors at G+k+A; pass zero A for ground-state calculations.
Calculate velocity-gauge nonlocal projectors at k+G+A(t).
| ctx | Device context. |
| ucell | Unit cell defining reciprocal-space units. |
| ik | K-point index. |
| vector_potential | Vector potential in Hartree atomic units. |
| vkb_in | Output projector buffer. |
The radial and angular projector factors use the kinetic momentum shifted by the Hartree-unit vector potential. The structure factor remains evaluated on the static reciprocal grid because its atom-dependent A phase cancels in each same-atom projector outer product.
| void pseudopot_cell_vnl::init | ( | const UnitCell & | cell, |
| Structure_Factor * | psf_in, | ||
| const ModulePW::PW_Basis_K * | wfc_basis = nullptr, | ||
| const bool | allocate_vkb = true ) |
| void pseudopot_cell_vnl::init_vnl | ( | UnitCell & | cell, |
| const ModulePW::PW_Basis * | rho_basis ) |
| void pseudopot_cell_vnl::init_vnl_alpha | ( | const UnitCell & | cell | ) |
| void pseudopot_cell_vnl::initgradq_vnl | ( | const UnitCell & | cell | ) |
|
private |
calculate D functions in the noncolin case when tvanp is true
Rotate deeq into deeq_nc for non-collinear magnetic case.
| iat | the index of atom |
| cell | UnitCell |
Combines the scalar deeq components into the Pauli-matrix representation of deeq_nc for non-collinear magnetism without SOC.
| iat | atom index |
| cell | unit cell |
|
private |
calculate D functions in the soc case when tvanp is true
Rotate deeq into deeq_nc for spin-orbit coupling case.
| iat | the index of atom |
| cell | UnitCell |
Uses the SOC rotation coefficients soc.fcoef to transform the scalar and magnetic (x, y, z) components of deeq into the full 2x2 spinor deeq_nc.
| iat | atom index |
| cell | unit cell |
|
private |
computes the integral of the effective potential with the Q function
Compute the augmentation charge contribution to deeq.
| veff | effective potential |
| rho_basis | potential FFT grids |
| cell | UnitCell |
For each USPP atom type, evaluate Q(G) on the FFT grid via radial_fft_q(), then compute the integral integral[ V_eff(r) * Q_{ij}(r) dr ] using gemm. The result is accumulated into deeq.
| veff | effective potential on real-space grid |
| rho_basis | plane-wave basis for charge density FFT |
| cell | unit cell |
| void pseudopot_cell_vnl::print_vnl | ( | std::ofstream & | ofs | ) |
| void pseudopot_cell_vnl::radial_fft_q | ( | const int | ng, |
| const int | ih, | ||
| const int | jh, | ||
| const int | itype, | ||
| const double * | qnorm, | ||
| const ModuleBase::matrix | ylm, | ||
| std::complex< double > * | qg ) const |
Compute the radial Fourier transform of the Q functions.
Interpolate the radial Q-function on given G-vectors (CPU matrix version).
The interpolation table for the radial Fourier transform is stored in qrad.
The formula implemented here is: [ q(g,i,j) = \sum_\text{lm} (-i)^l \text{ap}(\text{lm},i,j) \text{yr}_\text{lm}(g) \text{qrad}(g,l,i,j) ]
| ng | [in] the number of G vectors |
| ih | [in] the first index of Q |
| jh | [in] the second index of Q |
| itype | [in] the atomic type |
| qnorm | [in] the norm of q+g vectors |
| ylm | [in] the real spherical harmonics |
| qg | [out] the Fourier transform of interest |
This is the CPU-only version that works with ModuleBase::matrix for Ylm. It is kept for backward compatibility with older callers.
| ng | number of G-vectors |
| ih | first beta function index |
| jh | second beta function index |
| itype | atom type index |
| qnorm | |G| values (size ng) |
| ylm | real spherical harmonics matrix |
| qg | output Q(G) array (size ng) |
| void pseudopot_cell_vnl::radial_fft_q | ( | Device * | ctx, |
| const int | ng, | ||
| const int | ih, | ||
| const int | jh, | ||
| const int | itype, | ||
| const FPTYPE * | qnorm, | ||
| const FPTYPE * | ylm, | ||
| std::complex< FPTYPE > * | qg ) const |
Compute the radial Fourier transform using raw CPU pointers.
Interpolate the radial Q-function on given G-vectors (CPU raw-pointer template version).
This template is instantiated for CPU float and double precision only.
This version works with raw CPU pointers. The angular momentum l is determined from the combined lm index.
| ctx | CPU device context |
| ng | number of G-vectors |
| ih | first beta function index |
| jh | second beta function index |
| itype | atom type index |
| qnorm | |G| values (size ng) |
| ylm | real spherical harmonics array (size ng * 49) |
| qg | output Q(G) array (size ng) |
| void pseudopot_cell_vnl::release_memory | ( | ) |
| void pseudopot_cell_vnl::rescale_vnl | ( | const double & | omega_in | ) |
|
private |
Refresh aliases and allocated precision/device copies after radial-table changes.
|
inline |
Return the momentum spacing shared by the radial projector and derivative tables.
|
inline |
Generation of radial tables, including volume rescaling.
| ModuleBase::realArray pseudopot_cell_vnl::ap |
| std::complex<float>* pseudopot_cell_vnl::c_deeq_nc = nullptr |
| std::complex<float>* pseudopot_cell_vnl::c_qq_so = nullptr |
|
private |
| double pseudopot_cell_vnl::cell_factor = 0.0 |
| double* pseudopot_cell_vnl::d_deeq = nullptr |
|
private |
|
private |
|
private |
| double* pseudopot_cell_vnl::d_qq_nt = nullptr |
|
private |
| ModuleBase::realArray pseudopot_cell_vnl::deeq |
| ModuleBase::ComplexArray pseudopot_cell_vnl::deeq_nc |
| ModuleBase::realArray pseudopot_cell_vnl::dvan |
| ModuleBase::ComplexArray pseudopot_cell_vnl::dvan_so |
|
private |
| ModuleBase::IntArray pseudopot_cell_vnl::ijtoh |
| ModuleBase::matrix pseudopot_cell_vnl::indv |
| std::vector<int> pseudopot_cell_vnl::indv_ijkb0 |
| int pseudopot_cell_vnl::lmaxkb = 0 |
| int pseudopot_cell_vnl::lmaxq = 0 |
| ModuleBase::IntArray pseudopot_cell_vnl::lpl |
| ModuleBase::IntArray pseudopot_cell_vnl::lpx |
|
private |
| bool pseudopot_cell_vnl::multi_proj = false |
| int pseudopot_cell_vnl::nbetam = 0 |
| int pseudopot_cell_vnl::nhm = 0 |
| ModuleBase::matrix pseudopot_cell_vnl::nhtoj |
| ModuleBase::matrix pseudopot_cell_vnl::nhtol |
| ModuleBase::matrix pseudopot_cell_vnl::nhtolm |
| int pseudopot_cell_vnl::nkb = 0 |
|
private |
| Structure_Factor* pseudopot_cell_vnl::psf = nullptr |
| ModuleBase::realArray pseudopot_cell_vnl::qq_at |
| ModuleBase::realArray pseudopot_cell_vnl::qq_nt |
| ModuleBase::ComplexArray pseudopot_cell_vnl::qq_so |
| ModuleBase::realArray pseudopot_cell_vnl::qrad |
| float* pseudopot_cell_vnl::s_deeq = nullptr |
|
private |
|
private |
|
private |
| float* pseudopot_cell_vnl::s_qq_nt = nullptr |
|
private |
|
private |
| ModuleBase::realArray pseudopot_cell_vnl::tab |
| ModuleBase::realArray pseudopot_cell_vnl::tab_alpha |
| ModuleBase::realArray pseudopot_cell_vnl::tab_at |
| ModuleBase::realArray pseudopot_cell_vnl::tab_dq |
|
private |
|
private |
|
private |
|
mutable |
| std::complex<double>*** pseudopot_cell_vnl::vkb1_alpha |
| std::complex<double>*** pseudopot_cell_vnl::vkb_alpha |
| int pseudopot_cell_vnl::vkbnc = 0 |
|
private |
| std::complex<double>* pseudopot_cell_vnl::z_deeq_nc = nullptr |
| std::complex<double>* pseudopot_cell_vnl::z_qq_so = nullptr |
|
private |