Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
Loading...
Searching...
No Matches
spread_report.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * SpreadReport — the spread and the centres at the final gauge, and how the
5 * localisation that produced it ended.
6 *
7 * Reported whether or not the gauge was localised: the projection gauge has a
8 * spread too, and a driver comparing two models wants it either way.
9 * Evaluated whenever the record carries the neighbour overlaps and the mesh
10 * has no two-point axis.
11 */
12
13#include <utility>
14#include <vector>
15
18
19namespace q3 {
20
21struct [[nodiscard]] SpreadReport {
22 /**
23 * The report of a spread that WAS evaluated: `terms` at the final gauge,
24 * what its phases were guided by, and the minimisable part at the
25 * projection gauge. The localisation's own numbers are its caller's to
26 * add; a gauge that was not localised leaves them at their defaults.
27 */
28 [[nodiscard]] static SpreadReport evaluated_as(const SpreadTerms& terms,
29 bool guided_by_trial_orbitals,
30 std::vector<Vector3D> trial_orbital_centers_bohr,
31 Real initial_minimizable_bohr_squared) {
32 SpreadReport report;
33 report.evaluated = true;
36 report.centers_bohr = terms.centers_bohr;
38 report.guided_by_trial_orbitals = guided_by_trial_orbitals;
39 report.trial_orbital_centers_bohr = std::move(trial_orbital_centers_bohr);
40 report.initial_minimizable_bohr_squared = initial_minimizable_bohr_squared;
41 return report;
42 }
43
44 /// Whether the numbers below were evaluated at all; false leaves them at their zeros.
45 bool evaluated = false;
46 /**
47 * Omega_I, bohr squared. From the spread when it was evaluated, and
48 * otherwise from the subspace iteration when there was one: it is the
49 * one spread term a disentangled model has even on a mesh where the
50 * centres are undefined.
51 */
52 Real gauge_invariant_bohr_squared = 0.0;
53 Real total_bohr_squared = 0.0;
54 std::vector<Vector3D> centers_bohr;
55 /// Omega_n per function, bohr squared.
56 std::vector<Real> spreads_bohr_squared;
57 /// Whether the phase branches were fixed by the trial-orbital positions in the record.
58 bool guided_by_trial_orbitals = false;
59 /// The record's trial-orbital positions, Cartesian bohr; empty when it carries none.
60 std::vector<Vector3D> trial_orbital_centers_bohr;
61 /**
62 * Omega_D + Omega_OD at the projection gauge, before any rotation: what
63 * localisation bought is this minus the final value.
64 */
65 Real initial_minimizable_bohr_squared = 0.0;
66 /// Whether the gauge was rotated by the spread minimiser at all.
67 bool localized = false;
68 int localization_iterations = 0;
69 /**
70 * Whether the minimisation actually reached a stationary gauge. False
71 * after a stall, where the gauge is the best one found but not a minimum
72 * -- and where calling the model "maximally localized" would be a claim
73 * the run did not earn.
74 */
75 bool localization_converged = false;
76 Real localization_gradient_norm = 0.0;
77};
78
79} // namespace q3
double Real
static SpreadReport evaluated_as(const SpreadTerms &terms, bool guided_by_trial_orbitals, std::vector< Vector3D > trial_orbital_centers_bohr, Real initial_minimizable_bohr_squared)
bool guided_by_trial_orbitals
Whether the phase branches were fixed by the trial-orbital positions in the record.
Real initial_minimizable_bohr_squared
Real gauge_invariant_bohr_squared
bool evaluated
Whether the numbers below were evaluated at all; false leaves them at their zeros.
std::vector< Real > spreads_bohr_squared
Omega_n per function, bohr squared.
std::vector< Vector3D > trial_orbital_centers_bohr
The record's trial-orbital positions, Cartesian bohr; empty when it carries none.
std::vector< Vector3D > centers_bohr
Real gauge_invariant_bohr_squared
std::vector< Vector3D > centers_bohr
One centre per Wannier function, in bohr, in the same Cartesian frame as b.
Real total_bohr_squared() const
std::vector< Real > spreads_bohr_squared