25#ifndef __HUBBARD_MATRIX_HPP__
26#define __HUBBARD_MATRIX_HPP__
38 std::vector<sddk::mdarray<std::complex<double>, 3>>
local_;
40 std::vector<sddk::mdarray<std::complex<double>, 3>>
nonlocal_;
41 std::vector<std::pair<int, int>> atomic_orbitals_;
42 std::vector<int> offset_;
63 void access(std::string
const& what__, std::complex<double>* ptr__,
int ld__);
65 void print_local(
int ia__, std::ostream& out__)
const;
67 void print_nonlocal(
int idx__, std::ostream& out__)
const;
82 auto const&
local(
int ia__)
const
87 auto& nonlocal()
const
92 auto& nonlocal(
int idx__)
97 auto const& nonlocal(
int idx__)
const
102 const auto& atomic_orbitals()
const
104 return atomic_orbitals_;
107 const auto& atomic_orbitals(
const int idx__)
const
109 return atomic_orbitals_[idx__];
112 int offset(
const int idx__)
const
114 return offset_[idx__];
117 const auto& offset()
const
122 auto const& ctx()
const
127 int find_orbital_index(
const int ia__,
const int n__,
const int l__)
const
130 for (at_lvl = 0; at_lvl < static_cast<int>(atomic_orbitals_.size()); at_lvl++) {
131 int lo_ind = atomic_orbitals_[at_lvl].second;
132 int atom_id = atomic_orbitals_[at_lvl].first;
134 if ((atomic_orbitals_[at_lvl].first == ia__) &&
135 (ctx_.unit_cell().atom(atom_id).type().lo_descriptor_hub(lo_ind).n() == n__) &&
136 (ctx_.unit_cell().atom(atom_id).type().lo_descriptor_hub(lo_ind).l() == l__))
140 if (at_lvl ==
static_cast<int>(atomic_orbitals_.size())) {
141 std::cout <<
"atom: " << ia__ <<
"n: " << n__ <<
", l: " << l__ << std::endl;
142 RTE_THROW(
"Found an arbital that is not listed\n");
149copy(Hubbard_matrix
const& src__, Hubbard_matrix& dest__)
151 for (
int at_lvl = 0; at_lvl < static_cast<int>(src__.atomic_orbitals().size()); at_lvl++) {
152 sddk::copy(src__.local(at_lvl), dest__.local(at_lvl));
154 for (
int i = 0; i < static_cast<int>(src__.ctx().cfg().hubbard().nonlocal().size()); i++) {
155 sddk::copy(src__.nonlocal(i), dest__.nonlocal(i));
Describes Hubbard orbital occupancy or potential correction matrices.
std::vector< sddk::mdarray< std::complex< double >, 3 > > local_
Local part of Hubbard matrix.
void access(std::string const &what__, std::complex< double > *ptr__, int ld__)
Retrieve or set elements of the Hubbard matrix.
std::vector< sddk::mdarray< std::complex< double >, 3 > > nonlocal_
Non-local part of Hubbard matrix.
auto & local() const
Return a vector containing the occupation numbers for each atomic orbital.
Simulation context is a set of parameters and objects describing a single simulation.
void copy(T *target__, T const *source__, size_t n__)
Copy memory inside a device.
Namespace of the SIRIUS library.
Contains definition and implementation of Simulation_context class.