Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * WannierConstructionSettings — every knob of the Wannier construction, in
5 * one place and typed.
6 *
7 * The evaluation manifest (`control.interpolation`) is mapped onto this once,
8 * by from(); the builder reads nothing else. Two decisions are made here and
9 * nowhere else:
10 * how the subspace is chosen (an isolated manifold as it stands, or
11 * projectability disentanglement with its thresholds and iteration) and how
12 * the gauge inside it is fixed (the policy below). Each maps to a strategy --
13 * subspace/factory.hpp and gauge/factory.hpp -- so the builder never branches
14 * on them.
15 *
16 * The defaults are the record-alone case: an isolated manifold in the
17 * projection gauge, which is what a test or an importer wants from a record
18 * with no manifest.
19 */
20
21#include <optional>
22
28
29namespace q3 {
30
31struct [[nodiscard]] WannierConstructionSettings {
32 /**
33 * Absent, the band window must already be exactly the N states the gauge
34 * is built from, which is what an isolated manifold gives. Present,
35 * classification and the subspace iteration choose them out of a wider
36 * window, which is what an entangled manifold needs.
37 */
38 std::optional<ProjectabilityDisentanglementSettings> disentanglement;
39 LocalizationPolicy localization = LocalizationPolicy::None;
40 /// The spread minimiser's settings, read only when a gauge is localised.
42
43 /**
44 * The evaluation manifest's settings: the one place the
45 * `control.interpolation` knobs are mapped onto the builder's.
46 *
47 * Disentanglement and localisation are chosen when the model is
48 * EVALUATED, not when the record is captured: the record stores the raw
49 * window, its projectabilities and its overlaps, so the same capture
50 * serves a run with them and a run without, and the Wannier90 export
51 * keeps handing another code the untouched matrices. Whether the record
52 * can support what the manifest asks for is the builder's question,
53 * answered against the record itself (gauge/factory.hpp).
54 */
55 [[nodiscard]] static WannierConstructionSettings
56 from(const InterpolationSpecification& specification) {
58 if (specification.disentangles()) {
63 specification.frozen_window_above_fermi_ev / constants::RY_TO_EV;
68 settings.disentanglement = chosen;
69 }
70 settings.localization = localization_policy_from(specification.localization);
73 return settings;
74 }
75
76 [[nodiscard]] bool disentangles() const {
77 return disentanglement.has_value();
78 }
79 /// True unless localisation was refused outright.
80 [[nodiscard]] bool localizes() const {
81 return localization != LocalizationPolicy::None;
82 }
83 /// True when localisation is demanded, so a record that cannot support it is an error.
84 [[nodiscard]] bool demands_localization() const {
85 return localization == LocalizationPolicy::Required;
86 }
87};
88
89} // namespace q3
LocalizationPolicy localization_policy_from(const std::string &word)
The policy a manifest's localization word names; any other word is refused.
bool automatic_frozen_window
Apply the published window, AUTOMATIC_WINDOW_RYDBERG, instead of the value above.
Real projectability_maximum
p >= this freezes a band regardless of its energy.
Real projectability_minimum
p < this discards a band, whatever its energy: the singular-gauge rule.
Real convergence_tolerance
Relative, because an absolute spread threshold does not transfer between systems.
Real projectability_minimum
The classifier's thresholds; the defaults are BandClassificationThresholds' own.
std::optional< ProjectabilityDisentanglementSettings > disentanglement
Definition init.hpp:38
static WannierConstructionSettings from(const InterpolationSpecification &specification)
Definition init.hpp:56
bool localizes() const
True unless localisation was refused outright.
Definition init.hpp:80
SpreadMinimizationSettings spread_minimization
The spread minimiser's settings, read only when a gauge is localised.
Definition init.hpp:41
LocalizationPolicy localization
Definition init.hpp:39
bool demands_localization() const
True when localisation is demanded, so a record that cannot support it is an error.
Definition init.hpp:84