SIRIUS 7.5.0
Electronic structure library and applications
Public Member Functions | Protected Attributes | Friends | List of all members
sirius::wf::Wave_functions_base< T > Class Template Reference

Base class for the wave-functions. More...

#include <wave_functions.hpp>

Inherited by sirius::wf::Wave_functions_fft< T >, and sirius::wf::Wave_functions_mt< T >.

Public Member Functions

 Wave_functions_base ()
 Constructor. More...
 
 Wave_functions_base (int num_pw__, int num_mt__, num_mag_dims num_md__, num_bands num_wf__, sddk::memory_t default_mem__)
 Constructor. More...
 
auto memory_guard (sddk::memory_t mem__, wf::copy_to copy_to__=copy_to::none) const
 Return an instance of the memory guard. More...
 
auto num_sc () const
 Return number of spin components. More...
 
auto num_md () const
 Return number of magnetic dimensions. More...
 
auto num_wf () const
 Return number of wave-functions. More...
 
auto ld () const
 Return leading dimensions of the wave-functions coefficients array. More...
 
auto actual_spin_index (spin_index s__) const
 Return the actual spin index of the wave-functions. More...
 
void zero (sddk::memory_t mem__, spin_index s__, band_range br__)
 Zero a spin component of the wave-functions in a band range. More...
 
void zero (sddk::memory_t mem__)
 Zero all wave-functions. More...
 
std::complex< T > const * at (sddk::memory_t mem__, int i__, spin_index s__, band_index b__) const
 Return const pointer to the wave-function coefficient at a given index, spin and band. More...
 
auto at (sddk::memory_t mem__, int i__, spin_index s__, band_index b__)
 Return pointer to the wave-function coefficient at a given index, spin and band. More...
 
void allocate (sddk::memory_t mem__)
 Allocate wave-functions. More...
 
void deallocate (sddk::memory_t mem__)
 Deallocate wave-functions. More...
 
void copy_to (sddk::memory_t mem__)
 Copy date to host or device. More...
 

Protected Attributes

int num_pw_ {0}
 Local number of plane-wave coefficients. More...
 
int num_mt_ {0}
 Local number of muffin-tin coefficients. More...
 
num_mag_dims num_md_ {0}
 Number of magnetic dimensions (0, 1, or 3). More...
 
num_bands num_wf_ {0}
 Total number of wave-functions. More...
 
num_spins num_sc_ {0}
 Number of spin components (1 or 2). More...
 
std::array< sddk::mdarray< std::complex< T >, 2 >, 2 > data_
 Data storage for the wave-functions. More...
 

Friends

class Wave_functions_fft< T >
 Friend class declaration. More...
 

Detailed Description

template<typename T>
class sirius::wf::Wave_functions_base< T >

Base class for the wave-functions.

Wave-functions are represented by a set of plane-wave and muffin-tin coefficients stored consecutively in a 2D array. The leading dimensions of this array is a sum of the number of plane-waves and the number of muffin-tin coefficients.

     band index
   +-----------+
   |           |
   |           |
ig |  PW part  |
   |           |
   |           |
   +-----------+
   |           |
xi |  MT part  |
   |           |
   +-----------+

Definition at line 324 of file wave_functions.hpp.

Constructor & Destructor Documentation

◆ Wave_functions_base() [1/2]

template<typename T >
sirius::wf::Wave_functions_base< T >::Wave_functions_base ( )
inline

Constructor.

Definition at line 348 of file wave_functions.hpp.

◆ Wave_functions_base() [2/2]

template<typename T >
sirius::wf::Wave_functions_base< T >::Wave_functions_base ( int  num_pw__,
int  num_mt__,
num_mag_dims  num_md__,
num_bands  num_wf__,
sddk::memory_t  default_mem__ 
)
inline

Constructor.

Definition at line 352 of file wave_functions.hpp.

Member Function Documentation

◆ memory_guard()

template<typename T >
auto sirius::wf::Wave_functions_base< T >::memory_guard ( sddk::memory_t  mem__,
wf::copy_to  copy_to__ = copy_to::none 
) const
inline

Return an instance of the memory guard.

When the instance is created, it allocates the GPU memory and optionally copies data to the GPU. When the instance is destroyed, the data is optionally copied to host and GPU memory is deallocated.

Definition at line 377 of file wave_functions.hpp.

◆ num_sc()

template<typename T >
auto sirius::wf::Wave_functions_base< T >::num_sc ( ) const
inline

Return number of spin components.

Definition at line 383 of file wave_functions.hpp.

◆ num_md()

template<typename T >
auto sirius::wf::Wave_functions_base< T >::num_md ( ) const
inline

Return number of magnetic dimensions.

Definition at line 389 of file wave_functions.hpp.

◆ num_wf()

template<typename T >
auto sirius::wf::Wave_functions_base< T >::num_wf ( ) const
inline

Return number of wave-functions.

Definition at line 395 of file wave_functions.hpp.

◆ ld()

template<typename T >
auto sirius::wf::Wave_functions_base< T >::ld ( ) const
inline

Return leading dimensions of the wave-functions coefficients array.

Definition at line 401 of file wave_functions.hpp.

◆ actual_spin_index()

template<typename T >
auto sirius::wf::Wave_functions_base< T >::actual_spin_index ( spin_index  s__) const
inline

Return the actual spin index of the wave-functions.

Return 0 if the wave-functions are non-magnetic, otherwise return the input spin index.

Definition at line 408 of file wave_functions.hpp.

◆ zero() [1/2]

template<typename T >
void sirius::wf::Wave_functions_base< T >::zero ( sddk::memory_t  mem__,
spin_index  s__,
band_range  br__ 
)
inline

Zero a spin component of the wave-functions in a band range.

Definition at line 419 of file wave_functions.hpp.

◆ zero() [2/2]

template<typename T >
void sirius::wf::Wave_functions_base< T >::zero ( sddk::memory_t  mem__)
inline

Zero all wave-functions.

Definition at line 436 of file wave_functions.hpp.

◆ at() [1/2]

template<typename T >
std::complex< T > const * sirius::wf::Wave_functions_base< T >::at ( sddk::memory_t  mem__,
int  i__,
spin_index  s__,
band_index  b__ 
) const
inline

Return const pointer to the wave-function coefficient at a given index, spin and band.

Definition at line 447 of file wave_functions.hpp.

◆ at() [2/2]

template<typename T >
auto sirius::wf::Wave_functions_base< T >::at ( sddk::memory_t  mem__,
int  i__,
spin_index  s__,
band_index  b__ 
)
inline

Return pointer to the wave-function coefficient at a given index, spin and band.

Definition at line 454 of file wave_functions.hpp.

◆ allocate()

template<typename T >
void sirius::wf::Wave_functions_base< T >::allocate ( sddk::memory_t  mem__)
inline

Allocate wave-functions.

This function is primarily called by a memory_guard to allocate GPU memory.

Definition at line 462 of file wave_functions.hpp.

◆ deallocate()

template<typename T >
void sirius::wf::Wave_functions_base< T >::deallocate ( sddk::memory_t  mem__)
inline

Deallocate wave-functions.

This function is primarily called by a memory_guard to deallocate GPU memory.

Definition at line 472 of file wave_functions.hpp.

◆ copy_to()

template<typename T >
void sirius::wf::Wave_functions_base< T >::copy_to ( sddk::memory_t  mem__)
inline

Copy date to host or device.

Definition at line 481 of file wave_functions.hpp.

Friends And Related Function Documentation

◆ Wave_functions_fft< T >

template<typename T >
friend class Wave_functions_fft< T >
friend

Friend class declaration.

Wave_functions_fft needs access to data to alias the pointers and avoid copy in trivial cases.

Definition at line 337 of file wave_functions.hpp.

Member Data Documentation

◆ num_pw_

template<typename T >
int sirius::wf::Wave_functions_base< T >::num_pw_ {0}
protected

Local number of plane-wave coefficients.

Definition at line 328 of file wave_functions.hpp.

◆ num_mt_

template<typename T >
int sirius::wf::Wave_functions_base< T >::num_mt_ {0}
protected

Local number of muffin-tin coefficients.

Definition at line 330 of file wave_functions.hpp.

◆ num_md_

template<typename T >
num_mag_dims sirius::wf::Wave_functions_base< T >::num_md_ {0}
protected

Number of magnetic dimensions (0, 1, or 3).

This helps to distinguish between non-magnetic, collinear and full spinor wave-functions.

Definition at line 333 of file wave_functions.hpp.

◆ num_wf_

template<typename T >
num_bands sirius::wf::Wave_functions_base< T >::num_wf_ {0}
protected

Total number of wave-functions.

Definition at line 335 of file wave_functions.hpp.

◆ num_sc_

template<typename T >
num_spins sirius::wf::Wave_functions_base< T >::num_sc_ {0}
protected

Number of spin components (1 or 2).

Definition at line 337 of file wave_functions.hpp.

◆ data_

template<typename T >
std::array<sddk::mdarray<std::complex<T>, 2>, 2> sirius::wf::Wave_functions_base< T >::data_
protected

Data storage for the wave-functions.

Wave-functions are stored as two independent arrays for spin-up and spin-dn. The planewave and muffin-tin coefficients are stored consecutively.

Definition at line 344 of file wave_functions.hpp.


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