25#ifndef __LOCAL_OPERATOR_HPP__
26#define __LOCAL_OPERATOR_HPP__
36class Simulation_context;
38class Smooth_periodic_function;
58 void const* vphi__,
void* hphi__);
61add_to_hphi_pw_gpu_double(
int num_gvec__,
int add_ekin__,
void const* pw_ekin__,
void const* phi__,
62 void const* vphi__,
void* hphi__);
65add_to_hphi_lapw_gpu_float(
int num_gvec__,
void const* p__,
void const* gkvec_cart__,
void* hphi__);
68add_to_hphi_lapw_gpu_double(
int num_gvec__,
void const* p__,
void const* gkvec_cart__,
void* hphi__);
71grad_phi_lapw_gpu_float(
int num_gvec__,
void const* p__,
void const* gkvec_cart__,
void* hphi__);
74grad_phi_lapw_gpu_double(
int num_gvec__,
void const* p__,
void const* gkvec_cart__,
void* hphi__);
77mul_by_veff_real_real_gpu_float(
int nr__,
void const* in__,
void const* veff__,
void* out__);
80mul_by_veff_real_real_gpu_double(
int nr__,
void const* in__,
void const* veff__,
void* out__);
83mul_by_veff_complex_real_gpu_float(
int nr__,
void const* in__,
void const* veff__,
void* out__);
86mul_by_veff_complex_real_gpu_double(
int nr__,
void const* in__,
void const* veff__,
void* out__);
89mul_by_veff_complex_complex_gpu_float(
int nr__,
void const* in__,
float pref__,
90 void const* vx__,
void const* vy__,
void* out__);
93mul_by_veff_complex_complex_gpu_double(
int nr__,
void const* in__,
double pref__,
94 void const* vx__,
void const* vy__,
void* out__);
101mul_by_veff_real_real_gpu(
int nr__, T
const* in__, T
const* veff__, T* out__)
104 if (std::is_same<T, float>::value) {
105 mul_by_veff_real_real_gpu_float(nr__, in__, veff__, out__);
107 if (std::is_same<T, double>::value) {
108 mul_by_veff_real_real_gpu_double(nr__, in__, veff__, out__);
111 RTE_THROW(
"not compiled with GPU support");
117mul_by_veff_complex_real_gpu(
int nr__, std::complex<T>
const* in__, T
const* veff__, std::complex<T>* out__)
120 if (std::is_same<T, float>::value) {
121 mul_by_veff_complex_real_gpu_float(nr__, in__, veff__, out__);
123 if (std::is_same<T, double>::value) {
124 mul_by_veff_complex_real_gpu_double(nr__, in__, veff__, out__);
127 RTE_THROW(
"not compiled with GPU support");
133mul_by_veff_complex_complex_gpu(
int nr__, std::complex<T>
const* in__, T pref__, T
const* vx__, T
const* vy__,
134 std::complex<T>* out__)
137 if (std::is_same<T, float>::value) {
138 mul_by_veff_complex_complex_gpu_float(nr__, in__, pref__, vx__, vy__, out__);
140 if (std::is_same<T, double>::value) {
141 mul_by_veff_complex_complex_gpu_double(nr__, in__, pref__, vx__, vy__, out__);
144 RTE_THROW(
"not compiled with GPU support");
150add_to_hphi_pw_gpu(
int num_gvec__,
int add_ekin__, T
const* pw_ekin__, std::complex<T>
const* phi__,
151 std::complex<T>
const* vphi__, std::complex<T>* hphi__)
154 if (std::is_same<T, float>::value) {
157 if (std::is_same<T, double>::value) {
158 add_to_hphi_pw_gpu_double(num_gvec__, add_ekin__, pw_ekin__, phi__, vphi__, hphi__);
161 RTE_THROW(
"not compiled with GPU support");
167add_to_hphi_lapw_gpu(
int num_gvec__, std::complex<T>
const* p__, T
const* gkvec_cart__, std::complex<T>* hphi__)
170 if (std::is_same<T, float>::value) {
171 add_to_hphi_lapw_gpu_float(num_gvec__, p__, gkvec_cart__, hphi__);
173 if (std::is_same<T, double>::value) {
174 add_to_hphi_lapw_gpu_double(num_gvec__, p__, gkvec_cart__, hphi__);
177 RTE_THROW(
"not compiled with GPU support");
183grad_phi_lapw_gpu(
int num_gvec__, std::complex<T>
const* p__, T
const* gkvec_cart__, std::complex<T>* hphi__)
186 if (std::is_same<T, float>::value) {
187 grad_phi_lapw_gpu_float(num_gvec__, p__, gkvec_cart__, hphi__);
189 if (std::is_same<T, double>::value) {
190 grad_phi_lapw_gpu_double(num_gvec__, p__, gkvec_cart__, hphi__);
193 RTE_THROW(
"not compiled with GPU support");
227 static const int v0 = 0;
228 static const int v1 = 1;
229 static const int vx = 2;
230 static const int vy = 3;
231 static const int theta = 4;
232 static const int rm_inv = 5;
244 std::array<std::unique_ptr<Smooth_periodic_function<T>>, 6>
veff_vec_;
270 std::shared_ptr<fft::Gvec_fft> gvec_coarse_fft__,
Potential* potential__ =
nullptr);
292 void apply_h(fft::spfft_transform_type<T>& spfftk__, std::shared_ptr<fft::Gvec_fft> gkvec_fft__,
307 void apply_fplapw(fft::spfft_transform_type<T>& spfftik__, std::shared_ptr<fft::Gvec_fft> gkvec_fft__,
324 inline T
v0(
int ispn__)
const
Representation of the local operator.
sddk::mdarray< T, 1 > pw_ekin_
Kinetic energy of G+k plane-waves.
void prepare_k(fft::Gvec_fft const &gkvec_p__)
Prepare the k-point dependent arrays.
void apply_h(fft::spfft_transform_type< T > &spfftk__, std::shared_ptr< fft::Gvec_fft > gkvec_fft__, wf::spin_range spins__, wf::Wave_functions< T > const &phi__, wf::Wave_functions< T > &hphi__, wf::band_range br__)
Apply local part of Hamiltonian to pseudopotential wave-functions.
Simulation_context const & ctx_
Common parameters.
sddk::mdarray< std::complex< T >, 1 > vphi_
Temporary array to store [V*phi](G)
fft::spfft_transform_type< T > & fft_coarse_
Coarse-grid FFT driver for this operator.
T v0_[2]
V(G=0) matrix elements.
std::array< std::unique_ptr< Smooth_periodic_function< T > >, 6 > veff_vec_
Effective potential components and unit step function on a coarse FFT grid.
sddk::mdarray< std::complex< T >, 1 > buf_rg_
Temporary array to store psi_{up}(r).
Local_operator(Simulation_context const &ctx__, fft::spfft_transform_type< T > &fft_coarse__, std::shared_ptr< fft::Gvec_fft > gvec_coarse_fft__, Potential *potential__=nullptr)
Constructor.
T v0(int ispn__) const
Apply magnetic field to the full-potential wave-functions.
void apply_fplapw(fft::spfft_transform_type< T > &spfftik__, std::shared_ptr< fft::Gvec_fft > gkvec_fft__, wf::band_range b__, wf::Wave_functions< T > &phi__, wf::Wave_functions< T > *hphi__, wf::Wave_functions< T > *ophi__, wf::Wave_functions< T > *bzphi__, wf::Wave_functions< T > *bxyphi__)
Apply local part of LAPW Hamiltonian and overlap operators.
std::shared_ptr< fft::Gvec_fft > gvec_coarse_p_
Distribution of the G-vectors for the FFT transformation.
Generate effective potential from charge density and magnetization.
Simulation context is a set of parameters and objects describing a single simulation.
Stores information about G-vector partitioning between MPI ranks for the FFT transformation.
Wave-functions representation.
Describe a range of bands.
Describe a range of spins.
Contains helper functions for the interface with SpFFT library.
void add_to_hphi_pw_gpu_float(int num_gvec__, int add_ekin__, float const *pw_ekin__, gpu_complex_type< float > const *phi__, gpu_complex_type< float > const *vphi__, gpu_complex_type< float > *hphi__)
Update the hphi wave functions.
Memory management functions and classes.
Namespace of the SIRIUS library.
Eror and warning handling during run-time execution.
Contains typedefs, enums and simple descriptors.