Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
Loading...
Searching...
No Matches
inputs.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * WannierInputs — everything the Wannier construction needs from a
5 * plane-wave calculation, as plain data: the k-mesh and its neighbour
6 * shells, the overlaps M_mn(k,b), the trial-orbital projections A_mn(k),
7 * the eigenvalues, and the projectabilities.
8 *
9 * Mirrors the design of io/mean_field_record/init.hpp: the record is
10 * purely descriptive (no plane-wave basis, no pseudopotential set), so it
11 * can come from a live NSCF run or be read back from the record a run saved
12 * (`<prefix>.save/interpolation.q3ip`), and the same construction runs
13 * either way. Unlike MeanFieldRecord it
14 * additionally carries the trial-orbital projections and per-band
15 * projectabilities that the augmentation-aware kernels
16 * (PlanewaveBlochOverlapCalculator, PlanewaveTrialOrbitalProjectionCalculator)
17 * compute from the live SCF/NSCF state -- MeanFieldRecord has no
18 * pseudopotential set to derive them from.
19 */
20
21#include <array>
22#include <vector>
23
26
27namespace q3 {
28
29struct [[nodiscard]] WannierInputs {
30 // ── k-grid ───────────────────────────────────────────────────────
31 /**
32 * Monkhorst-Pack grid dimensions this record's k-points were
33 * generated on -- a full, unreduced grid: the construction sums over
34 * every k-point's neighbours, and has no path through a symmetry-reduced
35 * wedge.
36 */
37 std::array<int, 3> kpoint_grid_dimensions = {0, 0, 0};
38 /**
39 * Crystal (fractional) coordinates, one per physical k-point, in the
40 * same enumeration order KPointsGrid::generate() produces.
41 */
42 std::vector<Vector3D> kpoint_coordinates;
43
44 // ── Neighbor shells ──────────────────────────────────────────────
45 /**
46 * b-vector shells and finite-difference weights for this grid
47 * (KPointNeighborShells::compute() output).
48 */
49 std::vector<KPointNeighborDirection> neighbor_directions;
50
51 // ── Overlaps and projections ─────────────────────────────────────
52 /**
53 * M_mn(k,b) = <u_mk|u_n,k+b>, one entry per (k, b, m, n): indexed
54 * [kpoint_index][direction_index][neighbor_band_index * number_of_bands
55 * + band_index] -- the k-side band m varies fastest, i.e. each (k,b)
56 * block is column-major with m as the row index, the dense-linear-
57 * algebra convention the localizer expects and the order a `.mmn`
58 * block is written in.
59 */
60 std::vector<std::vector<std::vector<Complex>>> overlap_matrices;
61 /**
62 * A_mn(k) = <psi_mk|S|g_n>, one entry per k-point: indexed
63 * [kpoint_index][orbital_index * number_of_bands + band_index] -- the
64 * band m varies fastest (column-major with m as the row index), the
65 * layout PlanewaveWannierCapture packs, ProjectionGauge reads
66 * and the `.amn` writer streams.
67 */
68 std::vector<std::vector<Complex>> projection_matrices;
69
70 // ── Bands ────────────────────────────────────────────────────────
71 int number_of_bands = 0;
72 int number_of_trial_orbitals = 0;
73 /// Eigenvalues in Rydberg, indexed [kpoint_index][band_index].
74 std::vector<std::vector<Real>> eigenvalues_rydberg;
75 /// p_nk = sum_m |A_mn(k)|^2, indexed [kpoint_index][band_index].
76 std::vector<std::vector<Real>> projectabilities;
77 Real fermi_energy_rydberg = 0.0;
78 int number_of_spin_components = 1;
79 /**
80 * Where each trial orbital was placed, Cartesian, in BOHR, one per orbital
81 * in orbital order -- the same frame and unit as the b-vectors, so
82 * b . r is dimensionless without a conversion. These are the localiser's
83 * guiding centres. Empty means the record predates them or was imported
84 * from a format that does not carry them; the localiser then falls back to
85 * the projection gauge's own centres and says so.
86 */
87 std::vector<Vector3D> trial_orbital_centers_bohr;
88
89 [[nodiscard]] int number_of_kpoints() const {
90 return static_cast<int>(kpoint_coordinates.size());
91 }
92
93 /// Whether the record carries M_mn(k,b): the spread and the subspace iteration need it.
94 [[nodiscard]] bool has_overlaps() const {
95 return !overlap_matrices.empty();
96 }
97 /// Whether the record carries p_nk: classification by projectability needs it.
98 [[nodiscard]] bool has_projectabilities() const {
99 return !projectabilities.empty();
100 }
101 /// Whether every trial orbital's position is known: the localiser's guiding centres.
102 [[nodiscard]] bool has_trial_orbital_centers() const {
103 return !trial_orbital_centers_bohr.empty() &&
104 static_cast<int>(trial_orbital_centers_bohr.size()) == number_of_trial_orbitals;
105 }
106};
107
108} // namespace q3
double Real
std::vector< KPointNeighborDirection > neighbor_directions
Definition inputs.hpp:49
std::vector< Vector3D > kpoint_coordinates
Definition inputs.hpp:42
std::vector< std::vector< Real > > eigenvalues_rydberg
Eigenvalues in Rydberg, indexed [kpoint_index][band_index].
Definition inputs.hpp:74
std::vector< Vector3D > trial_orbital_centers_bohr
Definition inputs.hpp:87
std::vector< std::vector< Real > > projectabilities
p_nk = sum_m |A_mn(k)|^2, indexed [kpoint_index][band_index].
Definition inputs.hpp:76
int number_of_kpoints() const
Definition inputs.hpp:89
bool has_trial_orbital_centers() const
Whether every trial orbital's position is known: the localiser's guiding centres.
Definition inputs.hpp:102
bool has_projectabilities() const
Whether the record carries p_nk: classification by projectability needs it.
Definition inputs.hpp:98
std::vector< std::vector< Complex > > projection_matrices
Definition inputs.hpp:68
bool has_overlaps() const
Whether the record carries M_mn(k,b): the spread and the subspace iteration need it.
Definition inputs.hpp:94
std::vector< std::vector< std::vector< Complex > > > overlap_matrices
Definition inputs.hpp:60