25#ifndef __K_POINT_SET_HPP__
26#define __K_POINT_SET_HPP__
47 std::vector<std::unique_ptr<K_point<double>>>
kpoints_;
49#if defined(SIRIUS_USE_FP32)
51 std::vector<std::unique_ptr<K_point<float>>> kpoints_float_;
69 bool initialized_{
false};
96 for (
auto& v : vec__) {
104 :
K_point_set(ctx__, std::vector<std::array<double, 3>>(vec__.begin(), vec__.end()))
109 void initialize(std::vector<int>
const& counts = {});
112 template <
typename T, sync_band_t what>
116 template <
typename T>
123 void save(std::string
const& name__)
const;
133 inline auto const& spl_num_kpoints()
const
138 inline auto const& comm()
const
149#if defined(SIRIUS_USE_FP32)
150 kpoints_float_[it.i]->update();
156 template <
typename T>
161 bnd_e[j] = (*this).get<T>(ik__)->band_energy(j, ispn__);
181#ifdef SIRIUS_USE_FP32
189 for (
int ik = 0; ik < (int)kpoints__.
size(1); ik++) {
194 template <
typename T>
197 template <
typename T>
206 return static_cast<int>(
kpoints_.size());
214 inline double energy_fermi()
const
219 inline void set_energy_fermi(
double energy_fermi__)
224 inline double band_gap()
const
233 if ((
kpoints_[ik]->vk() - vk__).length() < 1e-12) {
245 const auto& unit_cell()
247 return ctx_.unit_cell();
255 int my_rank = comm().rank();
258 int jrank = spl_num_kpoints().location(jk__).ib;
265 if (my_rank == jrank) {
266 gvptr = &
kpoints_[jk__].get()->gkvec();
270 return send_recv(comm(), *gvptr, jrank, rank__);
275inline K_point<double>* K_point_set::get<double>(
int ik__)
const
277 RTE_ASSERT(ik__ >= 0 && ik__ < (
int)
kpoints_.size());
282inline K_point<float>* K_point_set::get<float>(
int ik__)
const
284#if defined(SIRIUS_USE_FP32)
285 RTE_ASSERT(ik__ >= 0 && ik__ < (
int)kpoints_float_.size());
286 return kpoints_float_[ik__].get();
288 RTE_THROW(
"not compiled with FP32 support");
int num_kpoints() const
Return total number of k-points.
double entropy_sum() const
Return entropy contribution from smearing store in Kpoint<T>.
double energy_fermi_
Fermi energy which is searched in find_band_occupancies().
int find_kpoint(r3::vector< double > vk__)
Find index of k-point.
K_point_set(Simulation_context &ctx__, std::initializer_list< std::array< double, 3 > > vec__)
Create k-point set from a list of vectors.
fft::Gvec get_gkvec(kp_index_t::global jk__, int rank__)
Send G+k vectors of k-point jk to a given rank.
void add_kpoint(r3::vector< double > vk__, double weight__)
Add k-point to the set.
std::vector< std::unique_ptr< K_point< double > > > kpoints_
List of k-points.
K_point_set(Simulation_context &ctx__, r3::vector< int > k_grid__, r3::vector< int > k_shift__, int use_symmetry__)
Create a regular mesh of k-points.
void initialize(std::vector< int > const &counts={})
Initialize the k-point set.
K_point_set(Simulation_context &ctx__)
Create empty k-point set.
K_point_set(K_point_set &src)=delete
Copy constuctor is not allowed.
Simulation_context & ctx_
Context of a simulation.
double valence_eval_sum() const
Return sum of valence eigen-values store in Kpoint<T>.
void add_kpoints(sddk::mdarray< double, 2 > const &kpoints__, double const *weights__)
Add multiple k-points to the set.
void sync_band()
Sync band energies or occupancies between all MPI ranks.
K_point_set(Simulation_context &ctx__, std::vector< std::array< double, 3 > > vec__)
Create k-point set from a list of vectors.
void print_info()
Print basic info to the standard output.
int max_num_gkvec() const
Return maximum number of G+k vectors among all k-points.
void find_band_occupancies()
Find Fermi energy and band occupation numbers.
void create_k_mesh(r3::vector< int > k_grid__, r3::vector< int > k_shift__, int use_symmetry__)
Create regular grid of k-points.
void update()
Update k-points after moving atoms or changing the lattice vectors.
double band_gap_
Band gap found by find_band_occupancies().
void save(std::string const &name__) const
Save k-point set to HDF5 file.
splindex_chunk< kp_index_t > spl_num_kpoints_
Split index of k-points.
auto get_band_energies(int ik__, int ispn__) const
Get a list of band energies for a given k-point index.
Simulation context is a set of parameters and objects describing a single simulation.
auto const & comm_band() const
Band parallelization communicator.
auto const & comm_k() const
Communicator between k-points.
int num_bands(int num_bands__)
Set the number of bands.
A set of G-vectors for FFTs and G+k basis functions.
Simple implementation of 3d vector.
size_t size() const
Return total size (number of elements) of the array.
Externally defined block distribution.
Contains definition of sirius::K_point class.
Namespace of the SIRIUS library.
Smearing functions used in finding the band occupancies.