20#ifndef __OVERLAP_HPP__
21#define __OVERLAP_HPP__
27#include <nlcglib/interface.hpp>
38using inverseS = InverseS_k<std::complex<double>>;
39using S = S_k<std::complex<double>>;
42class Overlap_operators :
public nlcglib::OverlapBase
45 using key_t = std::pair<int, int>;
48 Overlap_operators(
const K_point_set& kset, Simulation_context& ctx,
const Q_operator<double>& q_op);
51 virtual void apply(
const key_t& key, nlcglib::MatrixBaseZ::buffer_t& out,
52 nlcglib::MatrixBaseZ::buffer_t& in)
const override;
53 virtual std::vector<std::pair<int, int>> get_keys()
const override;
56 std::map<key_t, std::shared_ptr<op_t>> data_;
60Overlap_operators<op_t>::Overlap_operators(
const K_point_set& kset, Simulation_context& ctx,
61 const Q_operator<double>& q_op)
63 for (
auto it : kset.spl_num_kpoints()) {
64 auto& kp = *kset.get<
double>(it.i);
65 for (
int ispn = 0; ispn < ctx.num_spins(); ++ispn) {
66 key_t
key{it.i.get(), ispn};
67 data_[
key] = std::make_shared<op_t>(ctx, q_op, kp.beta_projectors(), ispn);
74Overlap_operators<op_t>::apply(
const key_t& key, nlcglib::MatrixBaseZ::buffer_t& out,
75 nlcglib::MatrixBaseZ::buffer_t& in)
const
77 auto& op = data_.at(key);
78 auto array_out = make_matrix_view(out);
79 auto array_in = make_matrix_view(in);
81 sddk::memory_t pm = out.memtype == nlcglib::memory_type::host ? sddk::memory_t::host : sddk::memory_t::device;
82 op->apply(array_out, array_in, pm);
86std::vector<std::pair<int, int>>
87Overlap_operators<op_t>::get_keys()
const
89 std::vector<key_t> keys;
90 for (
auto& elem : data_) {
91 keys.push_back(elem.first);
Contains defintion of nlcglib interface.
Contains declaration and partial implementation of sirius::K_point_set class.
Memory management functions and classes.
@ key
the parser read a key of a value in an object
Namespace of the SIRIUS library.
Contains declaration of sirius::Non_local_operator class.
Contains definition and implementation of Simulation_context class.