|
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 <fs_nonlocal_tools.h>
Public Member Functions | |
| FS_Nonlocal_tools (const pseudopot_cell_vnl *nlpp_in, const UnitCell *ucell_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 *p_ekb) | |
| ~FS_Nonlocal_tools () | |
| void | cal_vkb (const int &ik, const int &nbdall) |
| calculate the projectors |beta> | |
| void | cal_becp (const int &ik, const int &npm, const std::complex< FPTYPE > *ppsi, const int &nbd0=0) |
| calculate the becp = <psi|beta> for all beta functions | |
| void | reduce_pool_becp (const int &npm) |
| mpi_allreduce the becp in the pool | |
| void | cal_vkb_deri_s (const int &ik, const int &nbdall, const int &ipol, const int &jpol) |
| calculate vkb_deri | |
| void | cal_dbecp_s (const int &ik, const int &npm, const std::complex< FPTYPE > *ppsi, const int &nbd0=0) |
| 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_stress (const int &ik, const int &npm, const bool &occ, const int &ipol, const int &jpol, FPTYPE *stress, const int &nbd0=0) |
| calculate stress | |
| void | cal_vkb_deri_f (const int &ik, const int &nbdall, const int &ipol) |
| calculate vkb_deri | |
| void | cal_dbecp_f (const int &ik, const int &nbdall, const int &npm, const int &ipol, const std::complex< FPTYPE > *ppsi, const int &nbd0=0) |
| calculate the dbecp_i = <psi|\partial beta/\partial \tau^I_i> for all beta functions | |
| void | cal_force (const int &ik, const int &nbdall, const int &npm, const bool &occ, FPTYPE *force, const int &nbd0=0) |
| calculate the force^I_i = - \sum_{n,k}f_{nk} \sum_{lm,l'm'}D_{l,l'}^{I} becp * dbecp_i | |
| void | revert_vkb (const int &ik, const int &ipol) |
| revert the 0-value dvkbs for calculating the dbecp_i in the force calculation | |
Private Member Functions | |
| void | allocate_memory (const ModuleBase::matrix &wg, const ModuleBase::matrix *p_ekb) |
| allocate the memory for the variables | |
| void | delete_memory () |
| delete the memory for the variables | |
| void | transfer_gcar (const int &npw, const int &npw_max, const FPTYPE *gcar_in) |
| count zero gcar indexes and prepare zero_indexes, do gcar_y /= gcar_x, gcar_z /= gcar_y | |
| void | save_vkb (const int &npw, const int &ipol) |
| save the 0-value dvkbs for calculating the dbecp_i in the force calculation | |
Private Attributes | |
| const Structure_Factor * | sf_ |
| pointers to access the data without memory arrangement | |
| const pseudopot_cell_vnl * | nlpp_ |
| const UnitCell * | ucell_ |
| const K_Vectors * | kv_ |
| const ModulePW::PW_Basis_K * | wfc_basis_ |
| Device * | ctx = {} |
| the following variables are used for the calculation | |
| base_device::DEVICE_CPU * | cpu_ctx = {} |
| base_device::AbacusDevice_t | device = {} |
| int | nkb |
| int | nbands |
| int | max_nh = 0 |
| int | max_npw = 0 |
| int | ntype |
| bool | nondiagonal |
| 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 |
| 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 |
| FPTYPE * | d_wg = nullptr |
| pointers to access the data without memory arrangement | |
| FPTYPE * | d_wk = nullptr |
| FPTYPE * | d_ekb = nullptr |
| FPTYPE * | gcar = nullptr |
| FPTYPE * | deeq = 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 |
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::FS_Nonlocal_tools< FPTYPE, Device >::FS_Nonlocal_tools | ( | const pseudopot_cell_vnl * | nlpp_in, |
| const UnitCell * | ucell_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 * | p_ekb | ||
| ) |
| hamilt::FS_Nonlocal_tools< FPTYPE, Device >::~FS_Nonlocal_tools | ( | ) |
|
private |
allocate the memory for the variables
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_becp | ( | const int & | ik, |
| const int & | npm, | ||
| const std::complex< FPTYPE > * | ppsi, | ||
| const int & | nbd0 = 0 |
||
| ) |
calculate the becp = <psi|beta> for all beta functions
| ik | the index of k point |
| npm | the number of bands |
| ppsi | the wave functions |
| nbd0 | the start index of the bands |
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_dbecp_f | ( | const int & | ik, |
| const int & | nbdall, | ||
| const int & | npm, | ||
| const int & | ipol, | ||
| const std::complex< FPTYPE > * | ppsi, | ||
| const int & | nbd0 = 0 |
||
| ) |
calculate the dbecp_i = <psi|\partial beta/\partial \tau^I_i> for all beta functions
| ik | the index of k point |
| nbdall | the number of all bands, which is the dimension of dbecp and becp |
| npm | the number of bands |
| ipol | the index of the polar |
| ppsi | the wave functions |
| nbd0 | the start index of the bands |
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_dbecp_s | ( | const int & | ik, |
| const int & | npm, | ||
| const std::complex< FPTYPE > * | ppsi, | ||
| const int & | nbd0 = 0 |
||
| ) |
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
| ik | the index of k point |
| npm | the number of bands |
| ppsi | the wave functions |
| nbd0 | the start index of the bands |
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_force | ( | const int & | ik, |
| const int & | nbdall, | ||
| const int & | npm, | ||
| const bool & | occ, | ||
| FPTYPE * | force, | ||
| const int & | nbd0 = 0 |
||
| ) |
calculate the force^I_i = - \sum_{n,k}f_{nk} \sum_{lm,l'm'}D_{l,l'}^{I} becp * dbecp_i
| ik | the index of k point |
| npm | the number of bands |
| nbdall | the number of all bands, which is the dimension of dbecp and becp |
| nbd0 | start band index for dbecp and becp |
| occ | if use the occupation of the bands |
| force | [out] the force |
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_stress | ( | const int & | ik, |
| const int & | npm, | ||
| const bool & | occ, | ||
| const int & | ipol, | ||
| const int & | jpol, | ||
| FPTYPE * | stress, | ||
| const int & | nbd0 = 0 |
||
| ) |
calculate stress
| ik | the index of k point |
| npm | the number of bands |
| occ | if use the occupation of the bands |
| ipol | the i index of the direction |
| jpol | the j index of the direction |
| stress | [out] the stress tensor |
| nbd0 | the start index of the bands |
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_vkb | ( | const int & | ik, |
| const int & | nbdall | ||
| ) |
calculate the projectors |beta>
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_vkb_deri_f | ( | const int & | ik, |
| const int & | nbdall, | ||
| const int & | ipol | ||
| ) |
calculate vkb_deri
| ik | the index of k point |
| nbdall | the number of all bands, it decides the size of vkb_deri |
| ipol | the index of the polar |
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::cal_vkb_deri_s | ( | const int & | ik, |
| const int & | nbdall, | ||
| const int & | ipol, | ||
| const int & | jpol | ||
| ) |
calculate vkb_deri
| ik | the index of k point |
| nbdall | the number of all bands, it decides the size of vkb_deri |
| ipol | the i index of the direction |
| jpol | the j index of the direction |
|
private |
delete the memory for the variables
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::reduce_pool_becp | ( | const int & | npm | ) |
mpi_allreduce the becp in the pool
| void hamilt::FS_Nonlocal_tools< FPTYPE, Device >::revert_vkb | ( | const int & | ik, |
| const int & | ipol | ||
| ) |
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 |
allocate global memory on GPU device only
|
private |
|
private |
|
private |
|
private |
|
private |
pointers to access the data without memory arrangement
|
private |
|
private |
becp and dbecp:
|
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 |
------------------— Key variable ------------------— borrow the memory from the vkb in VNL_in_pw to calculate vkb and dvkb
|
private |
|
private |
|
private |
|
private |
pointers to access the data without memory arrangement
|
private |
|
private |
|
private |