SIRIUS 7.5.0
Electronic structure library and applications
Classes | Typedefs | Enumerations | Functions
sirius::wf Namespace Reference

Namespace for the wave-functions. More...

Classes

class  band_range
 Describe a range of bands. More...
 
class  device_memory_guard
 Helper class to allocate and copy wave-functions to/from device. More...
 
struct  shuffle_to
 
class  spin_range
 Describe a range of spins. More...
 
class  Wave_functions
 Wave-functions representation. More...
 
class  Wave_functions_base
 Base class for the wave-functions. More...
 
class  Wave_functions_fft
 Wave-fucntions in the FFT-friendly distribution. More...
 
class  Wave_functions_mt
 Wave-functions for the muffin-tin part of LAPW. More...
 

Typedefs

using spin_index = strong_type< int, struct __spin_index_tag >
 
using band_index = strong_type< int, struct __band_index_tag >
 
using num_bands = strong_type< int, struct __num_bands_tag >
 
using num_spins = strong_type< int, struct __num_spins_tag >
 
using num_mag_dims = strong_type< int, struct __num_mag_dims_tag >
 

Enumerations

enum class  copy_to : unsigned int { none = 0b0000 , device = 0b0001 , host = 0b0010 }
 

Functions

copy_to operator| (copy_to a__, copy_to b__)
 
template<typename T , typename F >
static std::enable_if_t< std::is_scalar< F >::value, F > inner_diag_local_aux (std::complex< T > z1__, std::complex< T > z2__)
 For real-type F (double or float). More...
 
template<typename T , typename F >
static std::enable_if_t<!std::is_scalar< F >::value, F > inner_diag_local_aux (std::complex< T > z1__, std::complex< T > z2__)
 For complex-type F (complex<double> or complex<float>). More...
 
template<typename T , typename F >
static auto inner_diag_local (sddk::memory_t mem__, wf::Wave_functions< T > const &lhs__, wf::Wave_functions_base< T > const &rhs__, wf::spin_range spins__, wf::num_bands num_wf__)
 
template<typename T , typename F >
auto inner_diag (sddk::memory_t mem__, wf::Wave_functions< T > const &lhs__, wf::Wave_functions_base< T > const &rhs__, wf::spin_range spins__, wf::num_bands num_wf__)
 
template<typename T , typename F >
static std::enable_if_t< std::is_scalar< F >::value, std::complex< T > > axpby_aux (F a__, std::complex< T > x__, F b__, std::complex< T > y__)
 For real-type F (double or float). More...
 
template<typename T , typename F >
static std::enable_if_t<!std::is_scalar< F >::value, std::complex< T > > axpby_aux (F a__, std::complex< T > x__, F b__, std::complex< T > y__)
 For complex-type F (double or float). More...
 
template<typename T , typename F >
void axpby (sddk::memory_t mem__, wf::spin_range spins__, wf::band_range br__, F const *alpha__, wf::Wave_functions< T > const *x__, F const *beta__, wf::Wave_functions< T > *y__)
 Perform y <- a * x + b * y type of operation. More...
 
template<typename T , typename F , typename G >
void axpy_scatter (sddk::memory_t mem__, wf::spin_range spins__, F const *alphas__, Wave_functions< T > const *x__, G const *idx__, Wave_functions< T > *y__, int n__)
 
template<typename T , typename F = T>
void copy (sddk::memory_t mem__, Wave_functions< T > const &in__, wf::spin_index s_in__, wf::band_range br_in__, Wave_functions< F > &out__, wf::spin_index s_out__, wf::band_range br_out__)
 Copy wave-functions. More...
 
template<typename T , typename F >
std::enable_if_t< std::is_same< T, real_type< F > >::value, void > transform (::spla::Context &spla_ctx__, sddk::memory_t mem__, la::dmatrix< F > const &M__, int irow0__, int jcol0__, real_type< F > alpha__, Wave_functions< T > const &wf_in__, spin_index s_in__, band_range br_in__, real_type< F > beta__, Wave_functions< T > &wf_out__, spin_index s_out__, band_range br_out__)
 Apply linear transformation to the wave-functions. More...
 
template<typename T , typename F >
std::enable_if_t<!std::is_same< T, real_type< F > >::value, void > transform (::spla::Context &spla_ctx__, sddk::memory_t mem__, la::dmatrix< F > const &M__, int irow0__, int jcol0__, real_type< F > alpha__, Wave_functions< T > const &wf_in__, spin_index s_in__, band_range br_in__, real_type< F > beta__, Wave_functions< T > &wf_out__, spin_index s_out__, band_range br_out__)
 
template<typename T >
void scale_gamma_wf (sddk::memory_t mem__, wf::Wave_functions< T > const &wf__, wf::spin_range spins__, wf::band_range br__, T *scale__)
 Scale G=0 component of the wave-functions. More...
 
template<typename F , typename W , typename T >
std::enable_if_t< std::is_same< T, real_type< F > >::value, void > inner (::spla::Context &spla_ctx__, sddk::memory_t mem__, spin_range spins__, W const &wf_i__, band_range br_i__, Wave_functions< T > const &wf_j__, band_range br_j__, la::dmatrix< F > &result__, int irow0__, int jcol0__)
 Compute inner product between the two sets of wave-functions. More...
 
template<typename T , typename F >
std::enable_if_t<!std::is_same< T, real_type< F > >::value, void > inner (::spla::Context &spla_ctx__, sddk::memory_t mem__, spin_range spins__, Wave_functions< T > const &wf_i__, band_range br_i__, Wave_functions< T > const &wf_j__, band_range br_j__, la::dmatrix< F > &result__, int irow0__, int jcol0__)
 
template<typename T , typename F >
int orthogonalize (::spla::Context &spla_ctx__, sddk::memory_t mem__, spin_range spins__, band_range br_old__, band_range br_new__, Wave_functions< T > const &wf_i__, Wave_functions< T > const &wf_j__, std::vector< Wave_functions< T > * > wfs__, la::dmatrix< F > &o__, Wave_functions< T > &tmp__, bool project_out__)
 Orthogonalize n new wave-functions to the N old wave-functions. More...
 

Detailed Description

Namespace for the wave-functions.

Typedef Documentation

◆ spin_index

using sirius::wf::spin_index = typedef strong_type<int, struct __spin_index_tag>

Definition at line 120 of file wave_functions.hpp.

◆ band_index

using sirius::wf::band_index = typedef strong_type<int, struct __band_index_tag>

Definition at line 122 of file wave_functions.hpp.

◆ num_bands

using sirius::wf::num_bands = typedef strong_type<int, struct __num_bands_tag>

Definition at line 124 of file wave_functions.hpp.

◆ num_spins

using sirius::wf::num_spins = typedef strong_type<int, struct __num_spins_tag>

Definition at line 125 of file wave_functions.hpp.

◆ num_mag_dims

using sirius::wf::num_mag_dims = typedef strong_type<int, struct __num_mag_dims_tag>

Definition at line 126 of file wave_functions.hpp.

Enumeration Type Documentation

◆ copy_to

enum class sirius::wf::copy_to : unsigned int
strong

Definition at line 219 of file wave_functions.hpp.

Function Documentation

◆ operator|()

copy_to sirius::wf::operator| ( copy_to  a__,
copy_to  b__ 
)
inline

Definition at line 225 of file wave_functions.hpp.

◆ inner_diag_local_aux() [1/2]

template<typename T , typename F >
static std::enable_if_t< std::is_scalar< F >::value, F > sirius::wf::inner_diag_local_aux ( std::complex< T >  z1__,
std::complex< T >  z2__ 
)
inlinestatic

For real-type F (double or float).

Definition at line 1205 of file wave_functions.hpp.

◆ inner_diag_local_aux() [2/2]

template<typename T , typename F >
static std::enable_if_t<!std::is_scalar< F >::value, F > sirius::wf::inner_diag_local_aux ( std::complex< T >  z1__,
std::complex< T >  z2__ 
)
inlinestatic

For complex-type F (complex<double> or complex<float>).

Definition at line 1213 of file wave_functions.hpp.

◆ inner_diag_local()

template<typename T , typename F >
static auto sirius::wf::inner_diag_local ( sddk::memory_t  mem__,
wf::Wave_functions< T > const &  lhs__,
wf::Wave_functions_base< T > const &  rhs__,
wf::spin_range  spins__,
wf::num_bands  num_wf__ 
)
static

Definition at line 1220 of file wave_functions.hpp.

◆ inner_diag()

template<typename T , typename F >
auto sirius::wf::inner_diag ( sddk::memory_t  mem__,
wf::Wave_functions< T > const &  lhs__,
wf::Wave_functions_base< T > const &  rhs__,
wf::spin_range  spins__,
wf::num_bands  num_wf__ 
)

Definition at line 1293 of file wave_functions.hpp.

◆ axpby_aux() [1/2]

template<typename T , typename F >
static std::enable_if_t< std::is_scalar< F >::value, std::complex< T > > sirius::wf::axpby_aux ( a__,
std::complex< T >  x__,
b__,
std::complex< T >  y__ 
)
inlinestatic

For real-type F (double or float).

Definition at line 1305 of file wave_functions.hpp.

◆ axpby_aux() [2/2]

template<typename T , typename F >
static std::enable_if_t<!std::is_scalar< F >::value, std::complex< T > > sirius::wf::axpby_aux ( a__,
std::complex< T >  x__,
b__,
std::complex< T >  y__ 
)
inlinestatic

For complex-type F (double or float).

Definition at line 1313 of file wave_functions.hpp.

◆ axpby()

template<typename T , typename F >
void sirius::wf::axpby ( sddk::memory_t  mem__,
wf::spin_range  spins__,
wf::band_range  br__,
F const *  alpha__,
wf::Wave_functions< T > const *  x__,
F const *  beta__,
wf::Wave_functions< T > *  y__ 
)

Perform y <- a * x + b * y type of operation.

Definition at line 1323 of file wave_functions.hpp.

◆ axpy_scatter()

template<typename T , typename F , typename G >
void sirius::wf::axpy_scatter ( sddk::memory_t  mem__,
wf::spin_range  spins__,
F const *  alphas__,
Wave_functions< T > const *  x__,
G const *  idx__,
Wave_functions< T > *  y__,
int  n__ 
)

Definition at line 1398 of file wave_functions.hpp.

◆ copy()

template<typename T , typename F = T>
void sirius::wf::copy ( sddk::memory_t  mem__,
Wave_functions< T > const &  in__,
wf::spin_index  s_in__,
wf::band_range  br_in__,
Wave_functions< F > &  out__,
wf::spin_index  s_out__,
wf::band_range  br_out__ 
)

Copy wave-functions.

Definition at line 1451 of file wave_functions.hpp.

◆ transform() [1/2]

template<typename T , typename F >
std::enable_if_t< std::is_same< T, real_type< F > >::value, void > sirius::wf::transform ( ::spla::Context &  spla_ctx__,
sddk::memory_t  mem__,
la::dmatrix< F > const &  M__,
int  irow0__,
int  jcol0__,
real_type< F >  alpha__,
Wave_functions< T > const &  wf_in__,
spin_index  s_in__,
band_range  br_in__,
real_type< F >  beta__,
Wave_functions< T > &  wf_out__,
spin_index  s_out__,
band_range  br_out__ 
)
inline

Apply linear transformation to the wave-functions.

Template Parameters
TPrecision type of the wave-functions (float or double).
FType of the subspace and transformation matrix (float or double for Gamma-point calculation, complex<float> or complex<double> otherwise).
Parameters
[in]spla_ctxContext of the SPLA library.
[in]memLocation of the input wave-functions (host or device).
[in]MThe whole transformation matrix.
[in]irow0Location of the 1st row of the transfoormation sub-matrix.
[in]jcol0Location of the 1st column of the transfoormation sub-matrix.

Definition at line 1490 of file wave_functions.hpp.

◆ transform() [2/2]

template<typename T , typename F >
std::enable_if_t<!std::is_same< T, real_type< F > >::value, void > sirius::wf::transform ( ::spla::Context &  spla_ctx__,
sddk::memory_t  mem__,
la::dmatrix< F > const &  M__,
int  irow0__,
int  jcol0__,
real_type< F >  alpha__,
Wave_functions< T > const &  wf_in__,
spin_index  s_in__,
band_range  br_in__,
real_type< F >  beta__,
Wave_functions< T > &  wf_out__,
spin_index  s_out__,
band_range  br_out__ 
)
inline

Definition at line 1521 of file wave_functions.hpp.

◆ scale_gamma_wf()

template<typename T >
void sirius::wf::scale_gamma_wf ( sddk::memory_t  mem__,
wf::Wave_functions< T > const &  wf__,
wf::spin_range  spins__,
wf::band_range  br__,
T *  scale__ 
)
inline

Scale G=0 component of the wave-functions.

This is needed for the Gamma-point calculation to exclude the double-counting of G=0 term.

Definition at line 1552 of file wave_functions.hpp.

◆ inner() [1/2]

template<typename F , typename W , typename T >
std::enable_if_t< std::is_same< T, real_type< F > >::value, void > sirius::wf::inner ( ::spla::Context &  spla_ctx__,
sddk::memory_t  mem__,
spin_range  spins__,
W const &  wf_i__,
band_range  br_i__,
Wave_functions< T > const &  wf_j__,
band_range  br_j__,
la::dmatrix< F > &  result__,
int  irow0__,
int  jcol0__ 
)
inline

Compute inner product between the two sets of wave-functions.

Template Parameters
TPrecision type of the wave-functions (float or double).
FType of the subspace (float or double for Gamma-point calculation, complex<float> or complex<double> otherwise).
Parameters
[in]spla_ctxContext of the SPLA library.
[in]memLocation of the input wave-functions (host or device).
[in]spinsSpin range of the wave-functions.
[in]wf_iLeft hand side of <wf_i | wf_j> product.
[in]br_iBand range of the <wf_i| wave-functions.
[in]wf_jRight hand side of <wf_i | wf_j> product.
[in]br_jBand range of the |wf_j> wave-functions.
[out]resultResulting inner product matrix.
[in]irow0Starting row of the output sub-block.
[in]jcol0Starting column of the output sub-block.
Returns
None

Depending on the spin range this functions computes the inner product between individaul spin components or between full spinor wave functions:

\[ M_{irow0+i,jcol0+j} = \sum_{\sigma=s0}^{s1} \langle \phi_{i0 + i}^{\sigma} | \phi_{j0 + j}^{\sigma} \rangle \]

where i0 and j0 and the dimensions of the resulting inner product matrix are determined by the band ranges for bra- and ket- states.

The location of the wave-functions data is determined by the mem parameter. The result is always returned in the CPU memory. If resulting matrix is allocated on the GPU memory, the result is copied to GPU as well.

Definition at line 1622 of file wave_functions.hpp.

◆ inner() [2/2]

template<typename T , typename F >
std::enable_if_t<!std::is_same< T, real_type< F > >::value, void > sirius::wf::inner ( ::spla::Context &  spla_ctx__,
sddk::memory_t  mem__,
spin_range  spins__,
Wave_functions< T > const &  wf_i__,
band_range  br_i__,
Wave_functions< T > const &  wf_j__,
band_range  br_j__,
la::dmatrix< F > &  result__,
int  irow0__,
int  jcol0__ 
)
inline

Definition at line 1693 of file wave_functions.hpp.

◆ orthogonalize()

template<typename T , typename F >
int sirius::wf::orthogonalize ( ::spla::Context &  spla_ctx__,
sddk::memory_t  mem__,
spin_range  spins__,
band_range  br_old__,
band_range  br_new__,
Wave_functions< T > const &  wf_i__,
Wave_functions< T > const &  wf_j__,
std::vector< Wave_functions< T > * >  wfs__,
la::dmatrix< F > &  o__,
Wave_functions< T > &  tmp__,
bool  project_out__ 
)

Orthogonalize n new wave-functions to the N old wave-functions.

Orthogonalize sets of wave-fuctionsfuctions.

Template Parameters
TPrecision of the wave-functions (float or double).
FType of the inner-product matrix (float, double or complex).
Parameters
[in]spla_ctxSPLA library context.
[in]memLocation of the wave-functions data.
[in]spinsSpin index range.
[in]br_oldBand range of the functions that are alredy orthogonal and that will be peojected out.
[in]br_newBand range of the functions that needed to be orthogonalized.
[in]wf_iThe <wf_i| states used to compute overlap matrix O_{ij}.
[in]wf_jThe |wf_j> states used to compute overlap matrix O_{ij}.
[outwfs List of wave-functions sets (typically phi, hphi and sphi).
[out]oWork matrix to compute overlap <wf_i|wf_j>
[out]tmpTemporary wave-functions to store intermediate results.
[in]project_outProject out old subspace (if this was not done before).
Returns
Number of linearly independent wave-functions found.

Definition at line 1747 of file wave_functions.hpp.