25#ifndef __OCCUPATION_MATRIX_HPP__
26#define __OCCUPATION_MATRIX_HPP__
44 void add_k_point_contribution(
K_point<T>& kp__);
53 if (!ctx_.hubbard_correction()) {
58 for (
int at_lvl = 0; at_lvl < (int)this->
local_.size(); at_lvl++) {
59 const int ia = atomic_orbitals_[at_lvl].first;
60 auto const& atom = ctx_.unit_cell().atom(ia);
61 if (atom.type().lo_descriptor_hub(atomic_orbitals_[at_lvl].second).use_for_calculation()) {
62 ctx_.
comm_k().allreduce(this->
local(at_lvl).at(sddk::memory_t::host),
63 static_cast<int>(this->
local(at_lvl).size()));
68 for (
auto& e : this->occ_mtrx_T_) {
69 ctx_.
comm_k().allreduce(e.second.at(sddk::memory_t::host),
static_cast<int>(e.second.size()));
73 void update_nonlocal()
76 RTE_THROW(
"only collinear case is supported");
78 for (
int i = 0; i < static_cast<int>(ctx_.cfg().hubbard().nonlocal().size()); i++) {
79 auto nl = ctx_.cfg().hubbard().nonlocal(i);
80 int ia = nl.atom_pair()[0];
81 int ja = nl.atom_pair()[1];
89 this->nonlocal(i).zero();
92 int at1_lvl = this->find_orbital_index(ia, n1, il);
93 int at2_lvl = this->find_orbital_index(ja, n2, jl);
96 for (
int ispn = 0; ispn < ctx_.
num_spins(); ispn++) {
97 for (
int m1 = 0; m1 < ib; m1++) {
98 for (
int m2 = 0; m2 < jb; m2++) {
99 this->nonlocal(i)(m1, m2, ispn) = occ_mtrx(this->offset(at1_lvl) + m1, this->offset(at2_lvl) + m2, ispn);
108 Hubbard_matrix::zero();
114 void print_occupancies(
int verbosity__)
const;
116 inline auto const& occ_mtrx_T(r3::vector<int> T__)
const
121 inline auto const& occ_mtrx_T()
const
127 copy(Occupation_matrix
const& src__, Occupation_matrix& dest__);
131copy(Occupation_matrix
const& src__, Occupation_matrix& dest__)
133 for (
int at_lvl = 0; at_lvl < static_cast<int>(src__.atomic_orbitals().size()); at_lvl++) {
134 sddk::copy(src__.local(at_lvl), dest__.local(at_lvl));
136 for (
int i = 0; i < static_cast<int>(src__.ctx().cfg().hubbard().nonlocal().size()); i++) {
137 sddk::copy(src__.nonlocal(i), dest__.nonlocal(i));
139 for (
auto& e : src__.occ_mtrx_T()) {
140 sddk::copy(e.second, dest__.occ_mtrx_T_.at(e.first));
Describes Hubbard orbital occupancy or potential correction matrices.
std::vector< sddk::mdarray< std::complex< double >, 3 > > local_
Local part of Hubbard matrix.
auto & local() const
Return a vector containing the occupation numbers for each atomic orbital.
K-point related variables and methods.
std::map< r3::vector< int >, sddk::mdarray< std::complex< double >, 3 > > occ_mtrx_T_
K-point contribution to density matrices weighted with e^{ikT} phase factors.
Simulation context is a set of parameters and objects describing a single simulation.
auto const & comm_k() const
Communicator between k-points.
int num_spins() const
Number of spin components.
int num_mag_dims() const
Number of dimensions in the magnetization vector.
Multidimensional array with the column-major (Fortran) order.
Base class for Hubbard occupancy and potential matrices.
Contains definition of sirius::K_point class.
Memory management functions and classes.
void copy(T *target__, T const *source__, size_t n__)
Copy memory inside a device.
Namespace of the SIRIUS library.