25#ifndef __NON_LOCAL_OPERATOR_HPP__
26#define __NON_LOCAL_OPERATOR_HPP__
40class Beta_projectors_base;
68 std::array<la::dmatrix<std::complex<T>>, 4> um_;
69 std::vector<int> offset_;
70 std::vector<std::pair<int, int>> atomic_orbitals_;
78 inline auto atomic_orbitals()
const
80 return atomic_orbitals_;
83 inline auto atomic_orbitals(
const int idx__)
const
85 return atomic_orbitals_[idx__];
87 inline auto nhwf()
const
92 inline auto offset(
int ia__)
const
97 std::complex<T>
const& operator()(
int m1,
int m2,
int j)
const
99 return um_[j](m1, m2);
102 std::complex<T>
const* at(
sddk::memory_t mem__,
const int idx1,
const int idx2,
const int idx3)
const
104 return um_[idx3].at(mem__, idx1, idx2);
107 int find_orbital_index(
const int ia__,
const int n__,
const int l__)
const;
124template <
typename T,
typename F>
131 if (sddk::is_device_memory(mem__)) {
132 RTE_ASSERT(beta__.device_t() == sddk::device_t::GPU);
135 auto& ctx = beta__.ctx();
137 for (
int i = 0; i < beta__.num_chunks(); i++) {
139 beta__.generate(beta_coeffs__, i);
141 for (
auto s = spins__.begin(); s != spins__.end(); s++) {
144 auto beta_phi = inner_prod_beta<F>(ctx.spla_context(), mem__, ctx.host_memory_t(),
145 sddk::is_device_memory(mem__),
146 beta_coeffs__, phi__, sp, br__);
148 if (hphi__ && d_op__) {
150 d_op__->
apply(mem__, i, s.get(), *hphi__, br__, beta_coeffs__, beta_phi);
154 d_op__->
apply(mem__, i, s.get() ^ 3, *hphi__, br__, beta_coeffs__, beta_phi);
158 if (sphi__ && q_op__) {
160 q_op__->
apply(mem__, i, s.get(), *sphi__, br__, beta_coeffs__, beta_phi);
162 q_op__->
apply(mem__, i, s.get() ^ 3, *sphi__, br__, beta_coeffs__, beta_phi);
170template <
typename T,
typename F>
176 for (
auto s = spins__.begin(); s != spins__.end(); s++) {
177 wf::copy(mem__, phi__, s, br__, sphi__, s, br__);
181 apply_non_local_D_Q<T, F>(mem__, spins__, br__, beta__, beta_coeffs__, phi__,
nullptr,
nullptr, q_op__,
193void apply_U_operator(Simulation_context& ctx__, wf::spin_range spins__, wf::band_range br__,
194 wf::Wave_functions<T>
const& hub_wf__, wf::Wave_functions<T>
const& phi__, U_operator<T>
const& um__,
195 wf::Wave_functions<T>& hphi__);
198 beta_projectors_coeffs_t<double>& bp_coeffs__,
199 Beta_projector_generator<double>& bp_strain_deriv__,
200 beta_projectors_coeffs_t<double>& bp_strain_deriv_coeffs__,
201 wf::Wave_functions<double>& phi__, Q_operator<double>& q_op__,
202 wf::Wave_functions<double>& ds_phi__);
Describes Hubbard orbital occupancy or potential correction matrices.
Non-local part of the Hamiltonian and S-operator in the pseudopotential method.
void apply(sddk::memory_t mem__, int chunk__, int ispn_block__, wf::Wave_functions< T > &op_phi__, wf::band_range br__, beta_projectors_coeffs_t< T > const &beta_coeffs__, sddk::matrix< F > const &beta_phi__) const
Apply chunk of beta-projectors to all wave functions.
Simulation context is a set of parameters and objects describing a single simulation.
auto num_md() const
Return number of magnetic dimensions.
auto actual_spin_index(spin_index s__) const
Return the actual spin index of the wave-functions.
Wave-functions representation.
Describe a range of bands.
Describe a range of spins.
Base class for Hubbard occupancy and potential matrices.
Memory management functions and classes.
memory_t
Memory types where the code can store data.
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.
Namespace of the SIRIUS library.
void apply_S_operator(sddk::memory_t mem__, wf::spin_range spins__, wf::band_range br__, Beta_projector_generator< T > &beta__, beta_projectors_coeffs_t< T > &beta_coeffs__, wf::Wave_functions< T > const &phi__, Q_operator< T > const *q_op__, wf::Wave_functions< T > &sphi__)
Compute |sphi> = (1 + Q)|phi>
void apply_non_local_D_Q(sddk::memory_t mem__, wf::spin_range spins__, wf::band_range br__, Beta_projector_generator< T > &beta__, beta_projectors_coeffs_t< T > &beta_coeffs__, wf::Wave_functions< T > const &phi__, D_operator< T > const *d_op__, wf::Wave_functions< T > *hphi__, Q_operator< T > const *q_op__, wf::Wave_functions< T > *sphi__)
void apply_U_operator(Simulation_context &ctx__, wf::spin_range spins__, wf::band_range br__, wf::Wave_functions< T > const &hub_wf__, wf::Wave_functions< T > const &phi__, U_operator< T > const &um__, wf::Wave_functions< T > &hphi__)
void apply_S_operator_strain_deriv(sddk::memory_t mem__, int comp__, Beta_projector_generator< double > &bp__, beta_projectors_coeffs_t< double > &bp_coeffs__, Beta_projector_generator< double > &bp_strain_deriv__, beta_projectors_coeffs_t< double > &bp_strain_deriv_coeffs__, wf::Wave_functions< double > &phi__, Q_operator< double > &q_op__, wf::Wave_functions< double > &ds_phi__)
Apply strain derivative of S-operator to all scalar functions.
Contains definition of sirius::Non_local_operator class.
Add or substitute OMP functions.
Eror and warning handling during run-time execution.
Contains definition and implementation of Simulation_context class.
Stores a chunk of the beta-projector and metadata.