Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * create_gauge_choice — the policy and the record decide the strategy, here
5 * and nowhere else.
6 *
7 * None the projection gauge.
8 * Preferred localise when the record carries the neighbour overlaps, and
9 * keep the projection gauge, saying so, when it does not.
10 * Required localise, and refuse the record if it cannot support that.
11 *
12 * A mesh with a two-point axis is refused under both localising policies:
13 * such a record carries overlaps, so it asked for something its mesh cannot
14 * give, and a silent downgrade there would hide a mesh that needs fixing.
15 * The refusal is raised here, before the subspace is chosen, so an
16 * impossible request costs no iteration.
17 */
18
19#include <memory>
20
27
28namespace q3 {
29
30[[nodiscard]] inline std::unique_ptr<GaugeChoice>
32 const WannierConstructionInputs& inputs) {
33 if (!settings.localizes()) {
34 return std::make_unique<ProjectionGaugeChoice>();
35 }
36 if (!settings.demands_localization() && !inputs.has_overlaps()) {
37 log::info("interpolate: the record carries no neighbour overlaps, so the projection gauge "
38 "is used as it stands; ask for control.interpolation.localization: maximal to "
39 "make that an error instead");
40 return std::make_unique<ProjectionGaugeChoice>();
41 }
43 return std::make_unique<MaximallyLocalizedGaugeChoice>(settings.spread_minimization);
44}
45
46} // namespace q3
static void require_supported(const WannierConstructionInputs &inputs)
Throws WannierDiagnosticError, with the way out named, when the record cannot be localised.
bool has_overlaps() const
Whether the record carries M_mn(k,b); implies has_stencil().
void info(spdlog::format_string_t< Args... > fmt, Args &&... args)
Definition logger.hpp:183
std::unique_ptr< GaugeChoice > create_gauge_choice(const WannierConstructionSettings &settings, const WannierConstructionInputs &inputs)
Definition factory.hpp:31
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
bool demands_localization() const
True when localisation is demanded, so a record that cannot support it is an error.
Definition init.hpp:84