25#ifndef __K_POINT_HPP__
26#define __K_POINT_HPP__
65 std::shared_ptr<fft::Gvec> gkvec_row_;
67 std::shared_ptr<fft::Gvec> gkvec_col_;
72 mutable std::unique_ptr<fft::spfft_transform_type<T>> spfft_transform_;
96 std::unique_ptr<wf::Wave_functions<T>>
fv_states_{
nullptr};
151 std::vector<std::complex<double>>
zil_;
185 std::array<int, 2> ispn_map_{0, -1};
193 inline int get_ispn(
int ispn__)
const
195 RTE_ASSERT(ispn__ == 0 || ispn__ == 1);
196 return ispn_map_[ispn__];
199 friend class K_point_set;
204 sddk::memory_t::host,
"band_occupancies");
207 sddk::memory_t::host,
"band_energies");
330 void generate_hubbard_orbitals();
333 void save(std::string
const& name__,
int id__)
const;
352 if (!
ctx_.need_sv()) {
361 for (
int ispn = 0; ispn < nsp; ispn++) {
372 comm().allreduce(sv_evec__.at(sddk::memory_t::host), (
int)sv_evec__.size());
375 inline auto const& gkvec()
const
389 return gkvec_->num_gvec();
395 return gkvec().count();
424 inline auto band_energies(
int ispn__)
const
445 inline double fv_eigen_value(
int i)
const
450 void set_fv_eigen_values(
double* eval__)
461 inline auto& fv_states()
467 inline wf::Wave_functions<T>
const& spinor_wave_functions()
const
473 inline wf::Wave_functions<T>& spinor_wave_functions()
480 inline auto& spinor_wave_functions2()
522 inline auto& singular_components()
527 inline auto vk()
const
582 inline lo_basis_descriptor
const& lo_basis_descriptor_row(
int idx)
const
588 inline int num_ranks_row()
const
593 inline int rank_row()
const
598 inline int num_ranks_col()
const
603 inline int rank_col()
const
614 inline int rank()
const
643 inline auto& fv_eigen_vectors()
648 inline auto& fv_eigen_vectors_slab()
653 inline auto& sv_eigen_vectors(
int ispn)
658 inline auto& fd_eigen_vectors()
668 inline auto const& alm_coeffs_row()
const
673 inline auto const& alm_coeffs_col()
const
678 inline auto const& alm_coeffs_loc()
const
683 inline auto const& comm()
const
688 inline auto const& comm_row()
const
693 inline auto const& comm_col()
const
698 auto beta_projectors() -> Beta_projectors<T>&
704 auto beta_projectors() const -> const Beta_projectors<T>&
710 auto& beta_projectors_row()
716 auto& beta_projectors_col()
722 auto const& ctx()
const
729 std::ostream&
out(
int level__)
const
731 if (
ctx_.verbosity() >= level__ && this->comm().rank() == 0) {
734 return null_stream();
738 auto& spfft_transform()
const
740 return *spfft_transform_;
743 inline auto const& gkvec_fft()
const
748 inline auto gkvec_fft_sptr()
const
753 inline auto const& gkvec_col()
const
758 inline auto const& gkvec_row()
const
766wave_function_factory(Simulation_context
const& ctx__, K_point<T>
const& kp__, wf::num_bands num_wf__,
767 wf::num_mag_dims num_md__,
bool mt_part__)
769 using wf_t = wf::Wave_functions<T>;
770 std::unique_ptr<wf_t> wf{
nullptr};
772 std::vector<int> num_mt_coeffs(ctx__.unit_cell().num_atoms());
773 for (
int ia = 0; ia < ctx__.unit_cell().num_atoms(); ia++) {
774 num_mt_coeffs[ia] = ctx__.unit_cell().atom(ia).mt_lo_basis_size();
776 wf = std::make_unique<wf_t>(kp__.gkvec_sptr(), num_mt_coeffs, num_md__, num_wf__, ctx__.host_memory_t());
778 wf = std::make_unique<wf_t>(kp__.gkvec_sptr(), num_md__, num_wf__, ctx__.host_memory_t());
Contains declaration and implementation of sirius::Beta_projectors class.
Interface to the HDF5 library.
K-point related variables and methods.
sddk::mdarray< double, 1 > fv_eigen_values_
First-variational eigen values.
std::unique_ptr< Matching_coefficients > alm_coeffs_col_
LAPW matching coefficients for the column G+k vectors.
auto const & atomic_wave_functions() const
Return the initial atomic orbitals used to compute the hubbard wave functions.
std::vector< lo_basis_descriptor > lo_basis_descriptors_row_
Basis descriptors distributed between rows of the 2D MPI grid.
std::vector< std::complex< double > > zil_
Imaginary unit to the power of l.
void generate_atomic_wave_functions(std::vector< int > atoms__, std::function< basis_functions_index const *(int)> indexb__, Radial_integrals_atomic_wf< false > const &ri__, wf::Wave_functions< T > &wf__)
Generate plane-wave coefficients of the atomic wave-functions.
std::unique_ptr< wf::Wave_functions< T > > atomic_wave_functions_S_
Pseudopotential atmoic wave-functions (not orthogonalized) with S-operator applied.
auto gkvec_sptr() const
Return shared pointer to gkvec object.
la::dmatrix< std::complex< T > > fv_eigen_vectors_
First-variational eigen vectors, distributed over 2D BLACS grid.
double band_occupancy(int j__, int ispn__) const
Get band occupancy.
std::vector< std::vector< int > > atom_lo_cols_
List of columns of the Hamiltonian and overlap matrix lo block (local index) for a given atom.
int num_atom_lo_cols(int ia) const
Return number of lo columns for a given atom.
int num_atom_lo_rows(int ia) const
Return number of lo rows for a given atom.
std::unique_ptr< wf::Wave_functions< T > > fv_eigen_vectors_slab_
First-variational eigen vectors, distributed in slabs.
std::unique_ptr< Beta_projectors< T > > beta_projectors_
Beta projectors for a local set of G+k vectors.
int num_lo_row() const
Local number of local orbitals for each MPI rank in the row of the 2D MPI grid.
void band_occupancy(int j__, int ispn__, double occ__)
Set band occupancy.
void generate_spinor_wave_functions()
Generate two-component spinor wave functions.
void update()
Update the reciprocal lattice vectors of the G+k array.
void generate_gkvec(double gk_cutoff__)
Find G+k vectors within the cutoff.
std::unique_ptr< Matching_coefficients > alm_coeffs_loc_
LAPW matching coefficients for the local set G+k vectors.
Simulation_context & ctx_
Simulation context.
std::unique_ptr< wf::Wave_functions< T > > hubbard_wave_functions_
Hubbard wave functions.
mpi::Communicator const & comm_col_
Communicator between(!!) columns.
sddk::mdarray< std::complex< T >, 2 > fd_eigen_vectors_
Full-diagonalization eigen vectors.
mpi::Communicator const & comm_
Communicator for parallelization inside k-point.
std::unique_ptr< wf::Wave_functions< T > > singular_components_
Lowest eigen-vectors of the LAPW overlap matrix with small aigen-values.
auto const & atomic_wave_functions_S() const
int rank_row_
Row rank of the processors of ScaLAPACK/ELPA diagonalization grid.
std::unique_ptr< Beta_projectors< T > > beta_projectors_col_
Beta projectors for column G+k vectors.
std::ostream & out(int level__) const
Return stdout stream for high verbosity output.
void get_fv_eigen_vectors(sddk::mdarray< std::complex< T >, 2 > &fv_evec__) const
Collect distributed first-variational vectors into a global array.
int lo_col(int ia, int i) const
Return local index (for the current MPI rank) of a column for a given atom and column index within an...
Unit_cell const & unit_cell_
Unit cell object.
std::unique_ptr< Matching_coefficients > alm_coeffs_row_
LAPW matching coefficients for the row G+k vectors.
auto & atomic_wave_functions()
Return the initial atomic orbitals used to compute the hubbard wave functions.
std::vector< lo_basis_descriptor > lo_basis_descriptors_col_
Basis descriptors distributed between columns of the 2D MPI grid.
double band_energy(int j__, int ispn__) const
Get band energy.
double weight() const
Return weight of k-point.
int gklo_basis_size_row() const
Local number of basis functions for each MPI rank in the row of the 2D MPI grid.
mpi::Communicator const & comm_row_
Communicator between(!!) rows.
void initialize()
Initialize the k-point related arrays and data.
std::array< la::dmatrix< std::complex< T > >, 2 > sv_eigen_vectors_
Second-variational eigen vectors.
int num_lo_col() const
Local number of local orbitals for each MPI rank in the column of the 2D MPI grid.
r3::vector< double > vk_
Fractional k-point coordinates.
int num_gkvec() const
Total number of G+k vectors within the cutoff distance.
int num_gkvec_row() const
Local number of G+k vectors for each MPI rank in the row of the 2D MPI grid.
void generate_gklo_basis()
Generate G+k and local orbital basis sets.
int num_gkvec_col() const
Local number of G+k vectors for each MPI rank in the column of the 2D MPI grid.
void generate_fv_states()
Generate first-variational states from eigen-vectors.
int num_gkvec_row_
Number of G+k vectors distributed along rows of MPI grid.
void get_sv_eigen_vectors(sddk::mdarray< std::complex< T >, 2 > &sv_evec__) const
Collect distributed second-variational vectors into a global array.
int num_ranks_col_
Number of processors along the columns of the diagonalization grid.
std::vector< std::vector< int > > atom_lo_rows_
list of rows of the Hamiltonian and overlap matrix lo block (local index) for a given atom
int gklo_basis_size() const
Basis size of LAPW+lo method.
int gklo_basis_size_col() const
Local number of basis functions for each MPI rank in the column of the 2D MPI grid.
std::unique_ptr< wf::Wave_functions< T > > fv_states_
First-variational states.
auto const & hubbard_wave_functions_S() const
Return the actual hubbard wave functions used in the calculations.
int num_occupied_bands(int ispn__=-1) const
Get the number of occupied bands for each spin channel.
std::shared_ptr< fft::Gvec > gkvec_
List of G-vectors with |G+k| < cutoff.
std::unique_ptr< Beta_projectors< T > > beta_projectors_row_
Beta projectors for row G+k vectors.
std::unique_ptr< wf::Wave_functions< T > > atomic_wave_functions_
Pseudopotential atmoic wave-functions (not orthogonalized).
std::unique_ptr< wf::Wave_functions< T > > spinor_wave_functions_
Two-component (spinor) wave functions describing the bands.
int num_gkvec_col_
Number of G+k vectors distributed along columns of MPI grid.
sddk::mdarray< double, 2 > band_energies_
Band energies.
std::unique_ptr< wf::Wave_functions< T > > hubbard_wave_functions_S_
Hubbard wave functions with S-operator applied.
sddk::mdarray< double, 2 > band_occupancies_
Band occupation numbers.
void save(std::string const &name__, int id__) const
Save data to HDF5 file.
int rank_col_
Column rank of the processors of ScaLAPACK/ELPA diagonalization grid.
int lo_row(int ia, int i) const
Return local index (for the current MPI rank) of a row for a given atom and row index within an atom.
K_point(Simulation_context &ctx__, std::shared_ptr< fft::Gvec > gkvec__, double weight__)
Constructor.
void band_energy(int j__, int ispn__, double e__)
Set band energy.
int num_gkvec_loc() const
Local number of G+k vectors in case of flat distribution.
K_point(Simulation_context &ctx__, r3::vector< double > vk__, double weight__)
Constructor.
int num_ranks_row_
Number of processors along the rows of the diagonalization grid.
std::vector< int > l_by_lm_
Mapping between lm and l.
int num_ranks() const
Number of MPI ranks for a given k-point.
std::shared_ptr< fft::Gvec_fft > gkvec_partition_
G-vector distribution for the FFT transformation.
double weight_
Weight of k-point.
Radial integrals of the atomic centered orbitals.
Simulation context is a set of parameters and objects describing a single simulation.
int num_spins() const
Number of spin components.
bool gamma_point(bool gamma_point__)
Set flag for Gamma-point calculation.
int num_fv_states(int num_fv_states__)
Set the number of first-variational states.
int num_spinors() const
Number of spinor wave-functions labeled by a sinlge band index.
int max_occupancy() const
Maximum band occupancy.
int num_bands(int num_bands__)
Set the number of bands.
int num_mag_dims() const
Number of dimensions in the magnetization vector.
double gk_cutoff() const
Cutoff for G+k vectors (in 1/[a.u.]).
double min_occupancy() const
Minimum occupancy to consider band to be occupied.
Representation of a unit cell.
int mt_lo_basis_size() const
Total number of local orbital basis functions over all atoms.
A helper class to establish various index mappings for the atomic basis functions.
MPI communicator wrapper.
int size() const
Size of the communicator (number of ranks).
int rank() const
Rank of MPI process inside communicator.
void zero(memory_t mem__, size_t idx0__, size_t n__)
Zero n elements starting from idx0.
Wave-functions representation.
Contains helper functions for the interface with SpFFT library.
Contains definition and partial implementation of sirius::Matching_coefficients class.
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 sirius::radial_functions_index class.
Descriptor of the local-orbital part of the LAPW+lo basis.
Contains declaration and implementation of Wave_functions class.