|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Nonlocal pseudopotential tools in plane wave basis set. used for calculating force and stress for different algorithm the main functions are: More...
#include <onsite_proj_tools.h>
Public Member Functions | |
| Onsite_Proj_tools (const pseudopot_cell_vnl *nlpp_in, const UnitCell *ucell_in, const psi::Psi< std::complex< FPTYPE >, Device > *psi_in, const K_Vectors *kv_in, const ModulePW::PW_Basis_K *wfc_basis_in, const Structure_Factor *sf_in, const ModuleBase::matrix &wg, const ModuleBase::matrix &ekb) | |
| Onsite_Proj_tools (const std::vector< int > &nproj, const std::vector< int > &lproj, const ModuleBase::realArray &tab, const ModuleBase::matrix &nhtol, std::complex< FPTYPE > *vkb_buf, const UnitCell *ucell_in, const psi::Psi< std::complex< FPTYPE >, Device > *psi_in, const K_Vectors *kv_in, const ModulePW::PW_Basis_K *wfc_basis_in, const Structure_Factor *sf_in, const ModuleBase::matrix &wg, const ModuleBase::matrix &ekb) | |
| ~Onsite_Proj_tools () | |
| void | cal_becp (int ik, int npm, std::complex< FPTYPE > *becp_in=nullptr, const std::complex< FPTYPE > *ppsi_in=nullptr, int npwx=0) |
| calculate the becp = <psi|beta> for all beta functions | |
| void | cal_becp (int ik, int npm, std::complex< FPTYPE > *becp_in, const std::complex< FPTYPE > *ppsi_in, int npwx, const ModuleBase::Vector3< double > &vector_potential, std::complex< FPTYPE > *host_becp) |
| Gauge-covariant projection at the explicit endpoint vector potential (inverse Bohr). | |
| void | refresh_table () |
| Invalidate projectors after resizing the borrowed radial interpolation table. | |
| void | invalidate_proj () |
| Rebuild overlap projectors on the next call after atomic coordinates change. | |
| void | cal_dbecp_s (int ik, int npm, int ipol, int jpol) |
| calculate the dbecp_{ij} = <psi|\partial beta/\partial varepsilon_{ij}> for all beta functions stress_{ij} = -1/omega \sum_{n,k}f_{nk} \sum_I \sum_{lm,l'm'}D_{l,l'}^{I} becp * dbecp_{ij} also calculated | |
| void | cal_dbecp_f (int ik, int npm, int ipol) |
| calculate the dbecp_i = <psi|\partial beta/\partial \tau^I_i> for all beta functions | |
| void | cal_force_dftu (int ik, int npm, FPTYPE *force, const int *l_channel, const std::complex< FPTYPE > *pot_onsite, const int size_pot_onsite, const FPTYPE *h_wg) |
| void | cal_force_dspin (int ik, int npm, FPTYPE *force, const ModuleBase::Vector3< double > *lambda, const FPTYPE *h_wg) |
| double | cal_stress_dftu (int ik, int npm, const int *l_channel, const std::complex< FPTYPE > *pot_onsite, const int size_pot_onsite, const FPTYPE *h_wg) |
| double | cal_stress_dspin (int ik, int npm, const ModuleBase::Vector3< double > *lambda, const FPTYPE *h_wg) |
| std::complex< FPTYPE > * | get_becp () const |
| std::complex< FPTYPE > * | get_dbecp () const |
Private Member Functions | |
| void | allocate_memory (const ModuleBase::matrix &wg, const ModuleBase::matrix &ekb, const std::vector< int > &nproj, const std::vector< int > &nch) |
| allocate the memory for the variables | |
| void | delete_memory () |
| delete the memory for the variables | |
| void | transfer_gcar (int npw, int npw_max, const ModuleBase::Vector3< FPTYPE > *gcar_in) |
| count zero gcar indexes and prepare zero_indexes, do gcar_y /= gcar_x, gcar_z /= gcar_y | |
| void | save_vkb (int npw, int ipol) |
| save the 0-value dvkbs for calculating the dbecp_i in the force calculation | |
| void | revert_vkb (int npw, int ipol) |
| revert the 0-value dvkbs for calculating the dbecp_i in the force calculation | |
Private Attributes | |
| const Structure_Factor * | sf_ = nullptr |
| pointers to access the data without memory arrangement | |
| const pseudopot_cell_vnl * | nlpp_ = nullptr |
| const UnitCell * | ucell_ = nullptr |
| const psi::Psi< std::complex< FPTYPE >, Device > * | psi_ |
| const K_Vectors * | kv_ = nullptr |
| const ModulePW::PW_Basis_K * | wfc_basis_ = nullptr |
| Device * | ctx = {} |
| the following variables are used for the calculation | |
| base_device::DEVICE_CPU * | cpu_ctx = {} |
| base_device::AbacusDevice_t | device = {} |
| int | nkb = 0 |
| int | nbands = 0 |
| int | deeq_dims [4] = {0, 0, 0, 0} |
| int | deeq_nc_dims [4] = {0, 0, 0, 0} |
| int | current_ik = -1 |
| ModuleBase::Vector3< double > | current_a_ |
| int | max_nh = 0 |
| int | max_npw = 0 |
| int | ntype = 0 |
| bool | nondiagonal = false |
| int | pre_ik_s = -1 |
| int | pre_ik_f = -1 |
| int * | atom_nh = nullptr |
| int * | atom_na = nullptr |
| std::vector< int > | h_atom_nh |
| std::vector< int > | h_atom_na |
| std::vector< int > | nproj |
| int * | gcar_zero_indexes = nullptr |
| the following variables are used for transfer gcar and reuse the values of vkb for force calculation | |
| int | gcar_zero_counts [3] = {0, 0, 0} |
| std::complex< FPTYPE > * | vkb_save = nullptr |
| const ModuleBase::realArray * | tabtpr = nullptr |
| pointers to access the data without memory arrangement | |
| const ModuleBase::matrix * | nhtol = nullptr |
| int | lprojmax = -1 |
| FPTYPE * | d_wg = nullptr |
| FPTYPE * | d_ekb = nullptr |
| FPTYPE * | gcar = nullptr |
| FPTYPE * | deeq = nullptr |
| std::complex< FPTYPE > * | deeq_nc = nullptr |
| FPTYPE * | kvec_c = nullptr |
| FPTYPE * | qq_nt = nullptr |
| std::complex< FPTYPE > * | ppcell_vkb = nullptr |
| std::vector< FPTYPE > | g_plus_k |
| FPTYPE * | hd_ylm = nullptr |
| allocate memory on CPU/GPU device | |
| FPTYPE * | hd_ylm_deri = nullptr |
| FPTYPE * | hd_vq = nullptr |
| FPTYPE * | hd_vq_deri = nullptr |
| std::complex< FPTYPE > * | hd_sk = nullptr |
| FPTYPE * | d_g_plus_k = nullptr |
| allocate global memory on GPU device only | |
| FPTYPE * | d_pref = nullptr |
| FPTYPE * | d_gk = nullptr |
| FPTYPE * | d_vq_tab = nullptr |
| std::vector< int > | dvkb_indexes |
| int * | d_dvkb_indexes = nullptr |
| std::complex< FPTYPE > * | d_pref_in = nullptr |
| std::complex< FPTYPE > * | dbecp = nullptr |
| becp and dbecp: | |
| std::complex< FPTYPE > * | becp = nullptr |
| std::vector< std::complex< FPTYPE > > | host_becp_ |
Nonlocal pseudopotential tools in plane wave basis set. used for calculating force and stress for different algorithm the main functions are:
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
rename the operators for CPU/GPU device
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| hamilt::Onsite_Proj_tools< FPTYPE, Device >::Onsite_Proj_tools | ( | const pseudopot_cell_vnl * | nlpp_in, |
| const UnitCell * | ucell_in, | ||
| const psi::Psi< std::complex< FPTYPE >, Device > * | psi_in, | ||
| const K_Vectors * | kv_in, | ||
| const ModulePW::PW_Basis_K * | wfc_basis_in, | ||
| const Structure_Factor * | sf_in, | ||
| const ModuleBase::matrix & | wg, | ||
| const ModuleBase::matrix & | ekb ) |
| hamilt::Onsite_Proj_tools< FPTYPE, Device >::Onsite_Proj_tools | ( | const std::vector< int > & | nproj, |
| const std::vector< int > & | lproj, | ||
| const ModuleBase::realArray & | tab, | ||
| const ModuleBase::matrix & | nhtol, | ||
| std::complex< FPTYPE > * | vkb_buf, | ||
| const UnitCell * | ucell_in, | ||
| const psi::Psi< std::complex< FPTYPE >, Device > * | psi_in, | ||
| const K_Vectors * | kv_in, | ||
| const ModulePW::PW_Basis_K * | wfc_basis_in, | ||
| const Structure_Factor * | sf_in, | ||
| const ModuleBase::matrix & | wg, | ||
| const ModuleBase::matrix & | ekb ) |
| hamilt::Onsite_Proj_tools< FPTYPE, Device >::~Onsite_Proj_tools | ( | ) |
|
private |
allocate the memory for the variables
| void hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_becp | ( | int | ik, |
| int | npm, | ||
| std::complex< FPTYPE > * | becp_in, | ||
| const std::complex< FPTYPE > * | ppsi_in, | ||
| int | npwx, | ||
| const ModuleBase::Vector3< double > & | vector_potential, | ||
| std::complex< FPTYPE > * | host_becp ) |
Gauge-covariant projection at the explicit endpoint vector potential (inverse Bohr).
| host_becp | Optional caller-owned host buffer for the pool-reduced overlaps; may be nullptr. |
| void hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_becp | ( | int | ik, |
| int | npm, | ||
| std::complex< FPTYPE > * | becp_in = nullptr, | ||
| const std::complex< FPTYPE > * | ppsi_in = nullptr, | ||
| int | npwx = 0 ) |
calculate the becp = <psi|beta> for all beta functions
| template void hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_dbecp_f | ( | int | ik, |
| int | npm, | ||
| int | ipol ) |
calculate the dbecp_i = <psi|\partial beta/\partial \tau^I_i> for all beta functions
| template void hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_dbecp_s | ( | int | ik, |
| int | npm, | ||
| int | ipol, | ||
| int | jpol ) |
calculate the dbecp_{ij} = <psi|\partial beta/\partial varepsilon_{ij}> for all beta functions stress_{ij} = -1/omega \sum_{n,k}f_{nk} \sum_I \sum_{lm,l'm'}D_{l,l'}^{I} becp * dbecp_{ij} also calculated
| template void hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_force_dftu | ( | int | ik, |
| int | npm, | ||
| FPTYPE * | force, | ||
| const int * | l_channel, | ||
| const std::complex< FPTYPE > * | pot_onsite, | ||
| const int | size_pot_onsite, | ||
| const FPTYPE * | h_wg ) |
| template void hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_force_dspin | ( | int | ik, |
| int | npm, | ||
| FPTYPE * | force, | ||
| const ModuleBase::Vector3< double > * | lambda, | ||
| const FPTYPE * | h_wg ) |
| template double hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_stress_dftu | ( | int | ik, |
| int | npm, | ||
| const int * | l_channel, | ||
| const std::complex< FPTYPE > * | pot_onsite, | ||
| const int | size_pot_onsite, | ||
| const FPTYPE * | h_wg ) |
| template double hamilt::Onsite_Proj_tools< FPTYPE, Device >::cal_stress_dspin | ( | int | ik, |
| int | npm, | ||
| const ModuleBase::Vector3< double > * | lambda, | ||
| const FPTYPE * | h_wg ) |
|
private |
delete the memory for the variables
|
inline |
|
inline |
| template void hamilt::Onsite_Proj_tools< FPTYPE, Device >::invalidate_proj | ( | ) |
Rebuild overlap projectors on the next call after atomic coordinates change.
| template void hamilt::Onsite_Proj_tools< FPTYPE, Device >::refresh_table | ( | ) |
Invalidate projectors after resizing the borrowed radial interpolation table.
|
private |
revert the 0-value dvkbs for calculating the dbecp_i in the force calculation
|
private |
save the 0-value dvkbs for calculating the dbecp_i in the force calculation
|
private |
count zero gcar indexes and prepare zero_indexes, do gcar_y /= gcar_x, gcar_z /= gcar_y
|
private |
|
private |
|
private |
|
private |
|
private |
the following variables are used for the calculation
|
private |
|
private |
|
private |
|
private |
|
private |
allocate global memory on GPU device only
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
becp and dbecp:
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
the following variables are used for the calculation allocate memory on CPU device only
|
private |
|
private |
|
private |
the following variables are used for transfer gcar and reuse the values of vkb for force calculation
----------------------— Key optimization ----------------------—
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
allocate memory on CPU/GPU device
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
------------------— Key variable ------------------— borrow the memory from the vkb in VNL_in_pw to calculate vkb and dvkb
|
private |
|
private |
|
private |
|
private |
|
private |
pointers to access the data without memory arrangement
|
private |
pointers to access the data without memory arrangement
|
private |
|
private |
|
private |