ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
ModulePW::PW_Basis_K Class Reference

Special pw_basis class. It includes different k-points. More...

#include <pw_basis_k.h>

Inheritance diagram for ModulePW::PW_Basis_K:
Collaboration diagram for ModulePW::PW_Basis_K:

Public Member Functions

 PW_Basis_K ()
 
 PW_Basis_K (std::string device_, std::string precision_)
 
 ~PW_Basis_K ()
 
void initparameters (const bool gamma_only_in, const double ecut_in, const int nk_in, const ModuleBase::Vector3< double > *kvec_d, const int distribution_type_in=1, const bool xprime_in=true)
 
void setuptransform ()
 
void collect_local_pw (const double &erf_ecut_in=0.0, const double &erf_height_in=0.0, const double &erf_sigma_in=0.1)
 
template<typename FPTYPE >
void real2recip (const FPTYPE *in, std::complex< FPTYPE > *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 transform real space to reciprocal space
 
template<typename FPTYPE >
void real2recip (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 transform real space to reciprocal space
 
template<typename FPTYPE >
void recip2real (const std::complex< FPTYPE > *in, FPTYPE *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 transform reciprocal space to real space
 
template<typename FPTYPE >
void recip2real (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 transform reciprocal space to real space
 
template<typename FPTYPE , typename Device >
void real_to_recip (const Device *ctx, const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename FPTYPE , typename Device >
void recip_to_real (const Device *ctx, const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename TK , typename Device , typename std::enable_if< std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void real_to_recip (const TK *in, TK *out, const int ik, const bool add=false, const typename GetTypeReal< TK >::type factor=1.0) const
 
template<typename TK , typename Device , typename std::enable_if< std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void recip_to_real (const TK *in, TK *out, const int ik, const bool add=false, const typename GetTypeReal< TK >::type factor=1.0) const
 
template<typename FPTYPE >
void real2recip_gpu (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename FPTYPE >
void recip2real_gpu (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const int ik, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename FPTYPE , typename Device , typename std::enable_if<!std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void real_to_recip (const FPTYPE *in, FPTYPE *out, const int ik, const bool add=false, const typename GetTypeReal< FPTYPE >::type factor=1.0) const
 
template<typename TK , typename Device , typename std::enable_if< std::is_same< Device, base_device::DEVICE_GPU >::value, int >::type = 0>
void recip_to_real (const TK *in, TK *out, const int ik, const bool add=false, const typename GetTypeReal< TK >::type factor=1.0) const
 
double & getgk2 (const int ik, const int igl) const
 
ModuleBase::Vector3< double > & getgcar (const int ik, const int igl) const
 
ModuleBase::Vector3< double > getgdirect (const int ik, const int igl) const
 
ModuleBase::Vector3< double > getgpluskcar (const int ik, const int igl) const
 
int & getigl2isz (const int ik, const int igl) const
 
int & getigl2ig (const int ik, const int igl) const
 
std::vector< int > get_ig2ix (const int ik) const
 
std::vector< int > get_ig2iy (const int ik) const
 
std::vector< int > get_ig2iz (const int ik) const
 
template<typename FPTYPE >
FPTYPE * get_gk2_data () const
 
template<typename FPTYPE >
FPTYPE * get_gcar_data () const
 
template<typename FPTYPE >
FPTYPE * get_kvec_c_data () const
 
template<>
float * get_kvec_c_data () const
 
template<>
double * get_kvec_c_data () const
 
template<>
float * get_gcar_data () const
 
template<>
double * get_gcar_data () const
 
template<>
float * get_gk2_data () const
 
template<>
double * get_gk2_data () const
 
template<>
void real_to_recip (const base_device::DEVICE_CPU *, const std::complex< float > *in, std::complex< float > *out, const int ik, const bool add, const float factor) const
 
template<>
void real_to_recip (const base_device::DEVICE_CPU *, const std::complex< double > *in, std::complex< double > *out, const int ik, const bool add, const double factor) const
 
template<>
void recip_to_real (const base_device::DEVICE_CPU *, const std::complex< float > *in, std::complex< float > *out, const int ik, const bool add, const float factor) const
 
template<>
void recip_to_real (const base_device::DEVICE_CPU *, const std::complex< double > *in, std::complex< double > *out, const int ik, const bool add, const double factor) const
 
- Public Member Functions inherited from ModulePW::PW_Basis
 PW_Basis ()
 
 PW_Basis (std::string device_, std::string precision_)
 
virtual ~PW_Basis ()
 
void initmpi (const int poolnproc_in, const int poolrank_in, MPI_Comm pool_world_in)
 
virtual void initgrids (const double lat0_in, const ModuleBase::Matrix3 latvec_in, const double gridecut)
 
virtual void initgrids (const double lat0_in, const ModuleBase::Matrix3 latvec_in, const int nx_in, int ny_in, int nz_in)
 
void initparameters (const bool gamma_only_in, const double pwecut_in, const int distribution_type_in=1, const bool xprime_in=true)
 
void setfullpw (const bool inpt_full_pw=false, const int inpt_full_pw_dim=0)
 
void setuptransform ()
 
void collect_local_pw ()
 
void collect_uniqgg ()
 
template<typename FPTYPE >
void real2recip (const FPTYPE *in, std::complex< FPTYPE > *out, const bool add=false, const FPTYPE factor=1.0) const
 transform real space to reciprocal space
 
template<typename FPTYPE >
void real2recip (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const bool add=false, const FPTYPE factor=1.0) const
 transform real space to reciprocal space
 
template<typename FPTYPE >
void recip2real (const std::complex< FPTYPE > *in, FPTYPE *out, const bool add=false, const FPTYPE factor=1.0) const
 transform reciprocal space to real space
 
template<typename FPTYPE >
void recip2real (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const bool add=false, const FPTYPE factor=1.0) const
 transform reciprocal space to real space
 
template<typename FPTYPE >
void real2recip_gpu (const FPTYPE *in, std::complex< FPTYPE > *out, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename FPTYPE >
void real2recip_gpu (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename FPTYPE >
void recip2real_gpu (const std::complex< FPTYPE > *in, FPTYPE *out, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename FPTYPE >
void recip2real_gpu (const std::complex< FPTYPE > *in, std::complex< FPTYPE > *out, const bool add=false, const FPTYPE factor=1.0) const
 
template<typename TK , typename TR , typename Device , typename std::enable_if<!std::is_same< TK, typename GetTypeReal< TK >::type >::value &&(std::is_same< TR, typename GetTypeReal< TK >::type >::value||std::is_same< TR, TK >::value) &&std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void recip_to_real (TK *in, TR *out, const bool add=false, const typename GetTypeReal< TK >::type factor=1.0) const
 Converts data from reciprocal space to real space on Cpu.
 
template<typename TK , typename TR , typename Device , typename std::enable_if<!std::is_same< TK, typename GetTypeReal< TK >::type >::value &&(std::is_same< TR, typename GetTypeReal< TK >::type >::value||std::is_same< TR, TK >::value) &&std::is_same< Device, base_device::DEVICE_GPU >::value, int >::type = 0>
void recip_to_real (TK *in, TR *out, const bool add=false, const typename GetTypeReal< TK >::type factor=1.0) const
 Converts data from reciprocal space (Fourier space) to real space.
 
template<typename TR , typename TK , typename Device , typename std::enable_if<!std::is_same< TK, typename GetTypeReal< TK >::type >::value &&(std::is_same< TR, typename GetTypeReal< TK >::type >::value||std::is_same< TR, TK >::value) &&std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void real_to_recip (TR *in, TK *out, const bool add=false, const typename GetTypeReal< TK >::type factor=1.0) const
 Converts data from real space to reciprocal space (Fourier space).
 
template<typename TR , typename TK , typename Device , typename std::enable_if<!std::is_same< TK, typename GetTypeReal< TK >::type >::value &&(std::is_same< TR, typename GetTypeReal< TK >::type >::value||std::is_same< TR, TK >::value) &&std::is_same< Device, base_device::DEVICE_GPU >::value, int >::type = 0>
void real_to_recip (TR *in, TK *out, const bool add=false, const typename GetTypeReal< TK >::type factor=1.0) const
 
void getfftixy2is (int *fftixy2is) const
 
void set_device (std::string device_)
 
void set_precision (std::string precision_)
 
std::string get_device () const
 
std::string get_precision () const
 

Public Attributes

int nks =0
 
ModuleBase::Vector3< double > * kvec_d =nullptr
 
ModuleBase::Vector3< double > * kvec_c =nullptr
 
int * npwk =nullptr
 
int npwk_max =0
 
double gk_ecut =0
 
int * igl2isz_k =nullptr
 
int * d_igl2isz_k = nullptr
 
int * igl2ig_k =nullptr
 
int * ig2ixyz_k =nullptr
 [npw] map ig to ixyz
 
std::vector< int > ig2ixyz_k_cpu
 
double * gk2 =nullptr
 [npw] map ig to ixyz,which is used in dsp fft.
 
double erf_ecut =0.0
 
double erf_height =0.0
 
double erf_sigma =0.0
 
- Public Attributes inherited from ModulePW::PW_Basis
std::string classname
 
MPI_Comm pool_world =MPI_COMM_NULL
 
int * ig2isz =nullptr
 
int * ig2ixyz_gpu = nullptr
 
int * istot2ixy =nullptr
 
int * is2fftixy =nullptr
 
int * d_is2fftixy = nullptr
 
int * fftixy2ip =nullptr
 
int nst =0
 
int * nst_per =nullptr
 
int nstnz =0
 
int nstot =0
 
int npw =0
 
int * npw_per =nullptr
 
int npwtot =0
 
int nrxx =0
 
int * startz =nullptr
 
int * numz =nullptr
 
int * numg =nullptr
 
int * numr =nullptr
 
int * startg =nullptr
 
int * startr =nullptr
 
int startz_current =0
 
int nplane =0
 
ModuleBase::Vector3< double > * gdirect =nullptr
 
ModuleBase::Vector3< double > * gcar =nullptr
 
double * gg =nullptr
 
int ig_gge0 =-1
 
int ngg =0
 
int * ig2igg =nullptr
 
double * gg_uniq =nullptr
 
bool gamma_only = false
 only half g are used.
 
bool full_pw = false
 
double ggecut = 0.0
 Energy cut off for g^2/2 = ecutwfc(Ry)*lat0^2/4pi^2, unit in 1/lat0^2.
 
double gridecut_lat = 0.0
 Energy cut off for all fft grids = ecutrho(Ry)*lat0^2/4pi^2, unit in 1/lat0^2.
 
double lat0 = 1
 unit length for lattice, unit in bohr
 
double tpiba = 1
 2pi/lat0
 
double tpiba2 = 1
 4pi^2/lat0^2
 
ModuleBase::Matrix3 latvec
 Unitcell lattice vectors, unit in lat0.
 
ModuleBase::Matrix3 G
 reciprocal lattice vector, unit in 1/lat0
 
ModuleBase::Matrix3 GT
 traspose of G
 
ModuleBase::Matrix3 GGT
 GGT = G*GT.
 
double omega = 1.0
 volume of the cell
 
int distribution_type = 1
 distribution method
 
int full_pw_dim = 0
 
int poolnproc = 1
 
int poolrank = 0
 
int fftnx =0
 
int fftny =0
 
int fftnz =0
 
int fftnxyz =0
 
int fftnxy =0
 
int nx =0
 
int ny =0
 
int nz =0
 
int nxyz =0
 
int nxy =0
 
int liy =0
 
int riy =0
 
int lix =0
 
int rix =0
 
bool xprime = true
 
int ng_xeq0 = 0
 
int nmaxgr = 0
 
FFT_Bundle fft_bundle
 

Private Member Functions

void setupIndGk ()
 
void get_ig2ixyz_k ()
 
ModuleBase::Vector3< double > cal_GplusK_cartesian (const int ik, const int ig) const
 

Private Attributes

float * s_gk2 = nullptr
 
double * d_gk2 = nullptr
 
float * s_gcar = nullptr
 
float * s_kvec_c = nullptr
 
double * d_gcar = nullptr
 
double * d_kvec_c = nullptr
 

Additional Inherited Members

- Public Types inherited from ModulePW::PW_Basis
using resmem_int_op = base_device::memory::resize_memory_op< int, base_device::DEVICE_GPU >
 
using delmem_int_op = base_device::memory::delete_memory_op< int, base_device::DEVICE_GPU >
 
using syncmem_int_h2d_op = base_device::memory::synchronize_memory_op< int, base_device::DEVICE_GPU, base_device::DEVICE_CPU >
 
- Protected Member Functions inherited from ModulePW::PW_Basis
void distribute_g ()
 distribute plane waves to different cores
 
virtual void distribute_r ()
 distribute real-space grids to different processors
 
void getstartgr ()
 
void distribution_method1 ()
 
void divide_sticks_1 (int *st_i, int *st_j, int *st_length)
 (3-1) Distribute sticks to cores according to the number of plane waves.
 
void distribution_method2 ()
 
void divide_sticks_2 ()
 (2) Devide the sticks to each core according to the number of sticks Sticks are in the order of ixy increasing.
 
void count_pw_st (int *st_length2D, int *st_bottom2D)
 (1) We count the total number of planewaves (tot_npw) and sticks (this->nstot) here.
 
void get_ig2isz_is2fftixy (int *st_bottom, int *st_length)
 (5) Construct ig2isz, and is2fftixy.
 
void collect_st (int *st_length2D, int *st_bottom2D, int *st_i, int *st_j, int *st_length)
 (2) Collect the x, y indexs, length of the sticks.
 
void get_istot2ixy (int *st_i, int *st_j)
 (3-2) Rearrange sticks in the order of the ip of core increasing, in each core, sticks are sorted in the order of ixy increasing.
 
void create_maps (int *st_length2D)
 (3) Create the maps from ixy to ip, istot, and from istot to ixy, and construt npw_per simultaneously.
 
template<typename T >
void gatherp_scatters (std::complex< T > *in, std::complex< T > *out) const
 gather planes and scatter sticks
 
template<typename T >
void gathers_scatterp (std::complex< T > *in, std::complex< T > *out) const
 gather sticks and scatter planes
 
- Protected Attributes inherited from ModulePW::PW_Basis
int * startnsz_per =nullptr
 
std::string device = "cpu"
 cpu or gpu
 
std::string precision = "double"
 single, double, mixing
 
bool double_data_ = true
 if has double data
 
bool float_data_ = false
 if has float data
 

Detailed Description

Special pw_basis class. It includes different k-points.

Author
qianrui, Sunliang on 2021-10-15

Math: plane waves: <r|g,k> = 1/sqrt(V) * exp(i(k+g)r) f(r) = 1/sqrt(V) * \sum_g{c(g)*exp(i(k+g)r)} c(g,k) = \int f(r)*exp(-i(g+k)r) dr

USAGE: ModulePW::PW_Basis_K pwtest; 0. init mpi for PW_Basis pwtest.inimpi(nproc_in_pool,rank_in_pool,POOL_WORLD);

  1. setup FFT grids for PW_Basis pwtest.initgrids(lat0,latvec,gridecut); pwtest.initgrids(lat0,latvec,N1,N2,N3); //double lat0: unit length, (unit: bohr) //ModuleBase::Matrix3 latvec: lattice vector, (unit: lat0), e.g. ModuleBase::Matrix3 latvec(1, 1, 0, 0, 2, 0, 0, 0, 2); //double gridecut: cutoff energy to generate FFT grids, (unit: Ry) //int N1,N2,N3: FFT grids
  2. init parameters pwtest.initparameters(gamma_only, ggecut, nks, kvec_d, dividemthd); //bool gamma_only: if use gamma_only //double ggecut: cutoff kinetic energy for planewaves(unit in Ry) (G+K)^2 < ggecut //int nks: number of k points in current cores //ModuleBase::Vector<double>* kvec_d: different k points //int dividemthd: method to divide planewaves to different cores
  3. Setup transforms from real space to reciprocal space or from reciprocal space to real space. pwtest.setuptransform(); pwtest.recip2real(wfg,wfr,ik); //wfg to wfr pwtest.real2recip(wfr,wfg,ik); //wfr to wfg
  4. Generate the wave vector for planewaves pwtest.collect_local_pw(); // double erf_ecut_in: the value of the constant energy cutoff // double erf_height_in: the height of the energy step for reciprocal vectors // double erf_sigma_in: the width of the energy step for reciprocal vectors //then we can use pwtest.gk2, pwtest.gcar, (unit in lat0^-1 or lat0^-2) //getgk2(ik,ig) : get pwtest.gk2: (G+K)^2 //getgcar(ik,ig): get pwtest.gcar: G //getgdirect(ik,ig): get pwtest.gcar: latvec * G //getgpluskcar(ik.ig): get G+K //getigl2isz(ik,ig): get pwtest.igl2isz_k //getigl2ig(ik,ig): get pwtest.igl2ig_k

Constructor & Destructor Documentation

◆ PW_Basis_K() [1/2]

ModulePW::PW_Basis_K::PW_Basis_K ( )
Here is the call graph for this function:

◆ PW_Basis_K() [2/2]

ModulePW::PW_Basis_K::PW_Basis_K ( std::string  device_,
std::string  precision_ 
)
inline

◆ ~PW_Basis_K()

ModulePW::PW_Basis_K::~PW_Basis_K ( )

Member Function Documentation

◆ cal_GplusK_cartesian()

ModuleBase::Vector3< double > ModulePW::PW_Basis_K::cal_GplusK_cartesian ( const int  ik,
const int  ig 
) const
private
Here is the caller graph for this function:

◆ collect_local_pw()

void ModulePW::PW_Basis_K::collect_local_pw ( const double &  erf_ecut_in = 0.0,
const double &  erf_height_in = 0.0,
const double &  erf_sigma_in = 0.1 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_gcar_data() [1/3]

template<>
float * ModulePW::PW_Basis_K::get_gcar_data ( ) const

◆ get_gcar_data() [2/3]

template<>
double * ModulePW::PW_Basis_K::get_gcar_data ( ) const

◆ get_gcar_data() [3/3]

template<typename FPTYPE >
FPTYPE * ModulePW::PW_Basis_K::get_gcar_data ( ) const
Here is the caller graph for this function:

◆ get_gk2_data() [1/3]

template<>
float * ModulePW::PW_Basis_K::get_gk2_data ( ) const

◆ get_gk2_data() [2/3]

template<>
double * ModulePW::PW_Basis_K::get_gk2_data ( ) const

◆ get_gk2_data() [3/3]

template<typename FPTYPE >
FPTYPE * ModulePW::PW_Basis_K::get_gk2_data ( ) const
Here is the caller graph for this function:

◆ get_ig2ix()

std::vector< int > ModulePW::PW_Basis_K::get_ig2ix ( const int  ik) const

◆ get_ig2ixyz_k()

void ModulePW::PW_Basis_K::get_ig2ixyz_k ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_ig2iy()

std::vector< int > ModulePW::PW_Basis_K::get_ig2iy ( const int  ik) const

◆ get_ig2iz()

std::vector< int > ModulePW::PW_Basis_K::get_ig2iz ( const int  ik) const

◆ get_kvec_c_data() [1/3]

template<>
float * ModulePW::PW_Basis_K::get_kvec_c_data ( ) const

◆ get_kvec_c_data() [2/3]

template<>
double * ModulePW::PW_Basis_K::get_kvec_c_data ( ) const

◆ get_kvec_c_data() [3/3]

template<typename FPTYPE >
FPTYPE * ModulePW::PW_Basis_K::get_kvec_c_data ( ) const
Here is the caller graph for this function:

◆ getgcar()

ModuleBase::Vector3< double > & ModulePW::PW_Basis_K::getgcar ( const int  ik,
const int  igl 
) const
Here is the caller graph for this function:

◆ getgdirect()

ModuleBase::Vector3< double > ModulePW::PW_Basis_K::getgdirect ( const int  ik,
const int  igl 
) const
Here is the caller graph for this function:

◆ getgk2()

double & ModulePW::PW_Basis_K::getgk2 ( const int  ik,
const int  igl 
) const
Here is the caller graph for this function:

◆ getgpluskcar()

ModuleBase::Vector3< double > ModulePW::PW_Basis_K::getgpluskcar ( const int  ik,
const int  igl 
) const
Here is the caller graph for this function:

◆ getigl2ig()

int & ModulePW::PW_Basis_K::getigl2ig ( const int  ik,
const int  igl 
) const
Here is the caller graph for this function:

◆ getigl2isz()

int & ModulePW::PW_Basis_K::getigl2isz ( const int  ik,
const int  igl 
) const
Here is the caller graph for this function:

◆ initparameters()

void ModulePW::PW_Basis_K::initparameters ( const bool  gamma_only_in,
const double  ecut_in,
const int  nk_in,
const ModuleBase::Vector3< double > *  kvec_d,
const int  distribution_type_in = 1,
const bool  xprime_in = true 
)
Here is the caller graph for this function:

◆ real2recip() [1/2]

template<typename FPTYPE >
void ModulePW::PW_Basis_K::real2recip ( const FPTYPE *  in,
std::complex< FPTYPE > *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const

transform real space to reciprocal space

real wave function f(k,r): f(k,r)=1/V*\sum_{g} c(k,g)*exp(i(g+k)*r) \equiv exp(ikr)f'(k.r) c(k,g)=\int dr*f(k,r)*exp(-i(g+k)*r) However, we use f'(k,r)!!! : f'(k,r)=1/V*\sum_{g} c(k,g)*exp(ig*r) c(k,g)=\int dr*f'(k,r)*exp(-ig*r)

This function tranform f'(r) to c(k,g).

Parameters
in(nplane,ny,nx), double data
out(nz, ns), std::complex<double> data
Here is the call graph for this function:
Here is the caller graph for this function:

◆ real2recip() [2/2]

template<typename FPTYPE >
void ModulePW::PW_Basis_K::real2recip ( const std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const

transform real space to reciprocal space

real wave function f(k,r): f(k,r)=1/V*\sum_{g} c(k,g)*exp(i(g+k)*r) \equiv exp(ikr)f'(k.r) c(k,g)=\int dr*f(k,r)*exp(-i(g+k)*r) However, we use f'(k,r)!!! : f'(k,r)=1/V*\sum_{g} c(k,g)*exp(ig*r) c(k,g)=\int dr*f'(k,r)*exp(-ig*r)

This function tranform f'(r) to c(k,g).

Parameters
in(nplane,ny,nx), std::complex<double> data
out(nz, ns), std::complex<double> data
Here is the call graph for this function:

◆ real2recip_gpu()

template<typename FPTYPE >
void ModulePW::PW_Basis_K::real2recip_gpu ( const std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const
Here is the caller graph for this function:

◆ real_to_recip() [1/5]

template<>
void ModulePW::PW_Basis_K::real_to_recip ( const base_device::DEVICE_CPU *  ,
const std::complex< double > *  in,
std::complex< double > *  out,
const int  ik,
const bool  add,
const double  factor 
) const
Here is the call graph for this function:

◆ real_to_recip() [2/5]

template<>
void ModulePW::PW_Basis_K::real_to_recip ( const base_device::DEVICE_CPU *  ,
const std::complex< float > *  in,
std::complex< float > *  out,
const int  ik,
const bool  add,
const float  factor 
) const
Here is the call graph for this function:

◆ real_to_recip() [3/5]

template<typename FPTYPE , typename Device >
void ModulePW::PW_Basis_K::real_to_recip ( const Device *  ctx,
const std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const
Here is the caller graph for this function:

◆ real_to_recip() [4/5]

template<typename FPTYPE , typename Device , typename std::enable_if<!std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void ModulePW::PW_Basis_K::real_to_recip ( const FPTYPE *  in,
FPTYPE *  out,
const int  ik,
const bool  add = false,
const typename GetTypeReal< FPTYPE >::type  factor = 1.0 
) const
inline
Here is the call graph for this function:

◆ real_to_recip() [5/5]

template<typename TK , typename Device , typename std::enable_if< std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void ModulePW::PW_Basis_K::real_to_recip ( const TK *  in,
TK *  out,
const int  ik,
const bool  add = false,
const typename GetTypeReal< TK >::type  factor = 1.0 
) const
inline
Here is the call graph for this function:

◆ recip2real() [1/2]

template<typename FPTYPE >
void ModulePW::PW_Basis_K::recip2real ( const std::complex< FPTYPE > *  in,
FPTYPE *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const

transform reciprocal space to real space

real wave function f(k,r): f(k,r)=1/V*\sum_{g} c(k,g)*exp(i(g+k)*r) \equiv exp(ikr)f'(k.r) c(k,g)=\int dr*f(k,r)*exp(-i(g+k)*r) However, we use f'(k,r)!!! : f'(k,r)=1/V*\sum_{g} c(k,g)*exp(ig*r) c(k,g)=\int dr*f'(k,r)*exp(-ig*r)

This function tranform c(k,g) to f'(r).

Parameters
in(nz,ns), std::complex<double>
out(nplane, ny, nx), double
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recip2real() [2/2]

template<typename FPTYPE >
void ModulePW::PW_Basis_K::recip2real ( const std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const

transform reciprocal space to real space

real wave function f(k,r): f(k,r)=1/V*\sum_{g} c(k,g)*exp(i(g+k)*r) \equiv exp(ikr)f'(k.r) c(k,g)=\int dr*f(k,r)*exp(-i(g+k)*r) However, we use f'(k,r)!!! : f'(k,r)=1/V*\sum_{g} c(k,g)*exp(ig*r) c(k,g)=\int dr*f'(k,r)*exp(-ig*r)

This function tranform c(k,g) to f'(r).

Parameters
in(nz,ns), std::complex<double>
out(nplane, ny, nx), std::complex<double>
Here is the call graph for this function:

◆ recip2real_gpu()

template<typename FPTYPE >
void ModulePW::PW_Basis_K::recip2real_gpu ( const std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const
Here is the caller graph for this function:

◆ recip_to_real() [1/5]

template<>
void ModulePW::PW_Basis_K::recip_to_real ( const base_device::DEVICE_CPU *  ,
const std::complex< double > *  in,
std::complex< double > *  out,
const int  ik,
const bool  add,
const double  factor 
) const
Here is the call graph for this function:

◆ recip_to_real() [2/5]

template<>
void ModulePW::PW_Basis_K::recip_to_real ( const base_device::DEVICE_CPU *  ,
const std::complex< float > *  in,
std::complex< float > *  out,
const int  ik,
const bool  add,
const float  factor 
) const
Here is the call graph for this function:

◆ recip_to_real() [3/5]

template<typename FPTYPE , typename Device >
void ModulePW::PW_Basis_K::recip_to_real ( const Device *  ctx,
const std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out,
const int  ik,
const bool  add = false,
const FPTYPE  factor = 1.0 
) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recip_to_real() [4/5]

template<typename TK , typename Device , typename std::enable_if< std::is_same< Device, base_device::DEVICE_CPU >::value, int >::type = 0>
void ModulePW::PW_Basis_K::recip_to_real ( const TK *  in,
TK *  out,
const int  ik,
const bool  add = false,
const typename GetTypeReal< TK >::type  factor = 1.0 
) const
inline
Here is the call graph for this function:

◆ recip_to_real() [5/5]

template<typename TK , typename Device , typename std::enable_if< std::is_same< Device, base_device::DEVICE_GPU >::value, int >::type = 0>
void ModulePW::PW_Basis_K::recip_to_real ( const TK *  in,
TK *  out,
const int  ik,
const bool  add = false,
const typename GetTypeReal< TK >::type  factor = 1.0 
) const
inline
Here is the call graph for this function:

◆ setupIndGk()

void ModulePW::PW_Basis_K::setupIndGk ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setuptransform()

void ModulePW::PW_Basis_K::setuptransform ( )

distribute plane wave basis and real-space grids to different processors set up maps for fft and create arrays for MPI_Alltoall set up ffts

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ d_gcar

double* ModulePW::PW_Basis_K::d_gcar = nullptr
private

◆ d_gk2

double* ModulePW::PW_Basis_K::d_gk2 = nullptr
private

◆ d_igl2isz_k

int * ModulePW::PW_Basis_K::d_igl2isz_k = nullptr

◆ d_kvec_c

double * ModulePW::PW_Basis_K::d_kvec_c = nullptr
private

◆ erf_ecut

double ModulePW::PW_Basis_K::erf_ecut =0.0

◆ erf_height

double ModulePW::PW_Basis_K::erf_height =0.0

◆ erf_sigma

double ModulePW::PW_Basis_K::erf_sigma =0.0

◆ gk2

double* ModulePW::PW_Basis_K::gk2 =nullptr

[npw] map ig to ixyz,which is used in dsp fft.

◆ gk_ecut

double ModulePW::PW_Basis_K::gk_ecut =0

◆ ig2ixyz_k

int* ModulePW::PW_Basis_K::ig2ixyz_k =nullptr

[npw] map ig to ixyz

◆ ig2ixyz_k_cpu

std::vector<int> ModulePW::PW_Basis_K::ig2ixyz_k_cpu

◆ igl2ig_k

int* ModulePW::PW_Basis_K::igl2ig_k =nullptr

◆ igl2isz_k

int* ModulePW::PW_Basis_K::igl2isz_k =nullptr

◆ kvec_c

ModuleBase::Vector3<double>* ModulePW::PW_Basis_K::kvec_c =nullptr

◆ kvec_d

ModuleBase::Vector3<double>* ModulePW::PW_Basis_K::kvec_d =nullptr

◆ nks

int ModulePW::PW_Basis_K::nks =0

◆ npwk

int* ModulePW::PW_Basis_K::npwk =nullptr

◆ npwk_max

int ModulePW::PW_Basis_K::npwk_max =0

◆ s_gcar

float* ModulePW::PW_Basis_K::s_gcar = nullptr
private

◆ s_gk2

float* ModulePW::PW_Basis_K::s_gk2 = nullptr
private

◆ s_kvec_c

float * ModulePW::PW_Basis_K::s_kvec_c = nullptr
private

The documentation for this class was generated from the following files: