Loading...
Searching...
No Matches
plane_wave_table.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * PlaneWaveTable — cached per-k-point plane-wave indices and kinetic energies.
5 */
6
7#include <vector>
8
14
15namespace q3 {
16
18 public:
19 void initialize(const GVectorsGrid& g_vectors_grid,
20 const Crystal& crystal_structure,
21 const KPointsGrid& kpoint_grid,
22 Real energy_cutoff_wavefunction,
23 const FFTGrid* fft_wave = nullptr,
24 int band_size = 1) {
25 int number_of_kpoints = kpoint_grid.number_of_kpoints();
26 kpoint_g_vector_indices_.resize(number_of_kpoints);
27 kpoint_kinetic_energy_squared_.resize(number_of_kpoints);
28 kpoint_number_of_plane_waves_.resize(number_of_kpoints);
29
30 for (int kpoint_index = 0; kpoint_index < number_of_kpoints; ++kpoint_index) {
31 PlaneWaveSelector::select(g_vectors_grid,
32 kpoint_grid[kpoint_index].coordinates,
33 crystal_structure,
34 energy_cutoff_wavefunction,
35 kpoint_g_vector_indices_[kpoint_index],
36 kpoint_kinetic_energy_squared_[kpoint_index],
37 fft_wave,
38 band_size);
39 kpoint_number_of_plane_waves_[kpoint_index] =
40 static_cast<int>(kpoint_g_vector_indices_[kpoint_index].size());
41 }
42 }
43
44 [[nodiscard]] const std::vector<int>& g_vector_indices_by_kpoint_index(int kpoint_index) const {
45 return kpoint_g_vector_indices_[kpoint_index];
46 }
47
48 [[nodiscard]] int number_of_plane_waves_by_kpoint_index(int kpoint_index) const {
49 return kpoint_number_of_plane_waves_[kpoint_index];
50 }
51
52 [[nodiscard]] const std::vector<Real>&
54 return kpoint_kinetic_energy_squared_[kpoint_index];
55 }
56
57 [[nodiscard]] const std::vector<std::vector<int>>& kpoint_g_vector_indices() const {
58 return kpoint_g_vector_indices_;
59 }
60
61 [[nodiscard]] const std::vector<int>& kpoint_number_of_plane_waves() const {
62 return kpoint_number_of_plane_waves_;
63 }
64
65 [[nodiscard]] const std::vector<std::vector<Real>>& kpoint_kinetic_energy_squared() const {
66 return kpoint_kinetic_energy_squared_;
67 }
68
69 private:
70 std::vector<std::vector<int>> kpoint_g_vector_indices_;
71 std::vector<int> kpoint_number_of_plane_waves_;
72 std::vector<std::vector<Real>> kpoint_kinetic_energy_squared_;
73};
74
75} // namespace q3
int number_of_kpoints() const
static void select(const GVectorsGrid &g_vectors_grid, const Vector3D &k_coordinates, const Crystal &crystal_structure, Real energy_cutoff_wavefunction, std::vector< int > &g_vector_indices, std::vector< Real > &kinetic_energy_squared, const FFTGrid *fft_wave=nullptr, int band_size=1)
const std::vector< std::vector< Real > > & kpoint_kinetic_energy_squared() const
const std::vector< int > & g_vector_indices_by_kpoint_index(int kpoint_index) const
void initialize(const GVectorsGrid &g_vectors_grid, const Crystal &crystal_structure, const KPointsGrid &kpoint_grid, Real energy_cutoff_wavefunction, const FFTGrid *fft_wave=nullptr, int band_size=1)
const std::vector< std::vector< int > > & kpoint_g_vector_indices() const
const std::vector< Real > & kinetic_energy_squared_by_kpoint_index(int kpoint_index) const
const std::vector< int > & kpoint_number_of_plane_waves() const
int number_of_plane_waves_by_kpoint_index(int kpoint_index) const
double Real