Quantum Phenomena Explorer 7.9.8
Interactive quantum-phenomena Explorer Tutor — source documentation
Loading...
Searching...
No Matches
quantumzitterbewegung2d.h
Go to the documentation of this file.
1/**
2 * @file quantumzitterbewegung2d.h
3 * @brief Declares the quantumzitterbewegung2d physics/numerical component used by QPE experiments.
4 * @ingroup qpe_quantum
5 *
6 * Source: @c core/quantum/quantumzitterbewegung2d.h. This file is part of Quantum Phenomena Explorer (QPE),
7 * maintained by Officina Turini. See LICENSE_IT.txt / LICENSE.txt for the
8 * QPE freeware source-available terms and THIRD_PARTY_NOTICES.txt for
9 * third-party components.
10 */
11
12#pragma once
13
15
16#include <cstddef>
17#include <string>
18#include <vector>
19
20namespace qpe {
21
22/**
23 * @brief Configuration values for Quantum Zitterbewegung2D Config.
24 *
25 * The structure groups parameters that are passed together so the associated numerical/analysis component can be configured reproducibly.
26 */
28{
29 bool enabled = false;
30 double lightSpeed = 1.0;
31 double restMass = 0.5;
32 double centerX = -6.0;
33 double centerY = 0.0;
34 double sigma = 3.5;
35 double momentumX = 0.5;
36 double momentumY = 0.0;
37 // 0 = pure upper spinor (positive/negative energy mixture, visible ZB)
38 // 1 = positive-energy projected control (ZB strongly suppressed)
40 double analysisEndTime = 12.0;
41};
42
43/**
44 * @brief Data structure used by the Quantum Zitterbewegung Sample2D component.
45 *
46 * The structure keeps related values explicit and testable across the QPE physics, analysis, or persistence layers.
47 */
49{
50 double time = 0.0;
51 double meanX = 0.0;
52 double meanY = 0.0;
53 double meanVx = 0.0;
54 double meanVy = 0.0;
55 double residualX = 0.0;
56 double residualY = 0.0;
57 double upperPopulation = 0.0;
58 double lowerPopulation = 0.0;
59 double norm = 0.0;
60};
61
62/**
63 * @brief Data structure used by the Dirac Energy Fractions2D component.
64 *
65 * The structure keeps related values explicit and testable across the QPE physics, analysis, or persistence layers.
66 */
68{
69 double positive = 0.0;
70 double negative = 0.0;
71};
72
73/**
74 * @brief Implements the Quantum Zitterbewegung2D component.
75 *
76 * The class provides one focused service within the QPE architecture and is documented here independently of the experiment-level Help.
77 */
79{
80public:
81 /**
82 * @brief Validates config.
83 * @param config Configuration to apply.
84 * @param reason The reason value used by the operation.
85 */
86 static bool validateConfig(const QuantumZitterbewegung2DConfig &config,
87 std::string *reason = nullptr) noexcept;
88
89 /**
90 * @brief Prepares state.
91 * @param spinor Dirac spinor state to read or modify.
92 * @param config Configuration to apply.
93 * @param hbar The hbar value used by the operation.
94 * @param reason The reason value used by the operation.
95 */
96 static bool prepareState(DiracSpinor2D &spinor,
98 double hbar,
99 std::string *reason = nullptr);
100
101 /**
102 * @brief Returns energy fractions.
103 * @param spinor Dirac spinor state to read or modify.
104 * @param config Configuration to apply.
105 * @param hbar The hbar value used by the operation.
106 */
108 const QuantumZitterbewegung2DConfig &config,
109 double hbar) noexcept;
110
111 /**
112 * @brief Performs measure.
113 * @param spinor Dirac spinor state to read or modify.
114 * @param config Configuration to apply.
115 * @param hbar The hbar value used by the operation.
116 * @param time Simulation time in solver units.
117 * @param initialMeanX The initial mean x value used by the operation.
118 * @param initialMeanY The initial mean y value used by the operation.
119 */
121 const QuantumZitterbewegung2DConfig &config,
122 double hbar,
123 double time,
124 double initialMeanX,
125 double initialMeanY) noexcept;
126
127 /**
128 * @brief Performs central energy.
129 * @param config Configuration to apply.
130 */
131 static double centralEnergy(const QuantumZitterbewegung2DConfig &config) noexcept;
132 /**
133 * @brief Performs predicted zitter omega.
134 * @param config Configuration to apply.
135 * @param hbar The hbar value used by the operation.
136 */
137 static double predictedZitterOmega(const QuantumZitterbewegung2DConfig &config,
138 double hbar) noexcept;
139 /**
140 * @brief Performs predicted zitter period.
141 * @param config Configuration to apply.
142 * @param hbar The hbar value used by the operation.
143 */
144 static double predictedZitterPeriod(const QuantumZitterbewegung2DConfig &config,
145 double hbar) noexcept;
146 /**
147 * @brief Performs predicted drift x.
148 * @param config Configuration to apply.
149 */
150 static double predictedDriftX(const QuantumZitterbewegung2DConfig &config) noexcept;
151 /**
152 * @brief Performs predicted drift y.
153 * @param config Configuration to apply.
154 */
155 static double predictedDriftY(const QuantumZitterbewegung2DConfig &config) noexcept;
156};
157
158/**
159 * @brief Implements the Quantum Zitterbewegung History2D component.
160 *
161 * The class provides one focused service within the QPE architecture and is documented here independently of the experiment-level Help.
162 */
164{
165public:
166 /**
167 * @brief Constructs a Quantum Zitterbewegung History 2D instance.
168 * @param maximumSamples The maximum samples value used by the operation.
169 */
170 explicit QuantumZitterbewegungHistory2D(std::size_t maximumSamples = 640u)
171 : maximumSamples_(maximumSamples) {}
172
173 /**
174 * @brief Clears stored state and returns the component to its empty/default state.
175 */
176 void clear();
177 /**
178 * @brief Returns configure.
179 * @param spinor Dirac spinor state to read or modify.
180 * @param config Configuration to apply.
181 * @param hbar The hbar value used by the operation.
182 */
183 bool configure(const DiracSpinor2D &spinor,
185 double hbar);
186 /**
187 * @brief Carries out append.
188 * @param time Simulation time in solver units.
189 * @param spinor Dirac spinor state to read or modify.
190 */
191 void append(double time, const DiracSpinor2D &spinor);
192
193 /**
194 * @brief Returns configured.
195 */
196 bool configured() const noexcept { return configured_; }
197 /**
198 * @brief Returns config.
199 */
200 const QuantumZitterbewegung2DConfig &config() const noexcept { return config_; }
201 /**
202 * @brief Samples s.
203 */
204 const std::vector<QuantumZitterbewegungSample2D> &samples() const noexcept { return samples_; }
205 /**
206 * @brief Carries out positive energy fraction.
207 */
208 double positiveEnergyFraction() const noexcept { return energyFractions_.positive; }
209 /**
210 * @brief Carries out negative energy fraction.
211 */
212 double negativeEnergyFraction() const noexcept { return energyFractions_.negative; }
213 /**
214 * @brief Initializes ial mean x.
215 */
216 double initialMeanX() const noexcept { return initialMeanX_; }
217 /**
218 * @brief Initializes ial mean y.
219 */
220 double initialMeanY() const noexcept { return initialMeanY_; }
221 /**
222 * @brief Carries out maximum abs residual x.
223 */
224 double maximumAbsResidualX() const noexcept { return maximumAbsResidualX_; }
225 /**
226 * @brief Carries out fitted drift x.
227 */
228 double fittedDriftX() const noexcept { return fittedDriftX_; }
229 /**
230 * @brief Carries out fitted drift y.
231 */
232 double fittedDriftY() const noexcept { return fittedDriftY_; }
233 /**
234 * @brief Carries out hbar.
235 */
236 double hbar() const noexcept { return hbar_; }
237
238private:
239 /**
240 * @brief Carries out trim.
241 */
242 void trim();
243
244 std::size_t maximumSamples_ = 640u;
245 bool configured_ = false;
247 double hbar_ = 1.0;
248 double initialMeanX_ = 0.0;
249 double initialMeanY_ = 0.0;
251 double fittedDriftX_ = 0.0;
252 double fittedDriftY_ = 0.0;
254 std::vector<QuantumZitterbewegungSample2D> samples_;
255};
256
257} // namespace qpe
Two-component complex spinor field used by the QPE Dirac branch.
Implements the Quantum Zitterbewegung2D component.
static double predictedZitterPeriod(const QuantumZitterbewegung2DConfig &config, double hbar) noexcept
Performs predicted zitter period.
static double predictedDriftX(const QuantumZitterbewegung2DConfig &config) noexcept
Performs predicted drift x.
static double predictedDriftY(const QuantumZitterbewegung2DConfig &config) noexcept
Performs predicted drift y.
static bool validateConfig(const QuantumZitterbewegung2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static QuantumZitterbewegungSample2D measure(const DiracSpinor2D &spinor, const QuantumZitterbewegung2DConfig &config, double hbar, double time, double initialMeanX, double initialMeanY) noexcept
Performs measure.
static double centralEnergy(const QuantumZitterbewegung2DConfig &config) noexcept
Performs central energy.
static DiracEnergyFractions2D energyFractions(const DiracSpinor2D &spinor, const QuantumZitterbewegung2DConfig &config, double hbar) noexcept
Returns energy fractions.
static bool prepareState(DiracSpinor2D &spinor, const QuantumZitterbewegung2DConfig &config, double hbar, std::string *reason=nullptr)
Prepares state.
static double predictedZitterOmega(const QuantumZitterbewegung2DConfig &config, double hbar) noexcept
Performs predicted zitter omega.
Implements the Quantum Zitterbewegung History2D component.
double fittedDriftX() const noexcept
Carries out fitted drift x.
bool configure(const DiracSpinor2D &spinor, const QuantumZitterbewegung2DConfig &config, double hbar)
Returns configure.
QuantumZitterbewegungHistory2D(std::size_t maximumSamples=640u)
Constructs a Quantum Zitterbewegung History 2D instance.
bool configured() const noexcept
Returns configured.
double positiveEnergyFraction() const noexcept
Carries out positive energy fraction.
void clear()
Clears stored state and returns the component to its empty/default state.
double fittedDriftY() const noexcept
Carries out fitted drift y.
double initialMeanY() const noexcept
Initializes ial mean y.
const QuantumZitterbewegung2DConfig & config() const noexcept
Returns config.
double maximumAbsResidualX() const noexcept
Carries out maximum abs residual x.
void append(double time, const DiracSpinor2D &spinor)
Carries out append.
double initialMeanX() const noexcept
Initializes ial mean x.
std::vector< QuantumZitterbewegungSample2D > samples_
double negativeEnergyFraction() const noexcept
Carries out negative energy fraction.
double hbar() const noexcept
Carries out hbar.
const std::vector< QuantumZitterbewegungSample2D > & samples() const noexcept
Samples s.
Declares the two-component Dirac spinor field container used by QPE.
Data structure used by the Dirac Energy Fractions2D component.
Configuration values for Quantum Zitterbewegung2D Config.
Data structure used by the Quantum Zitterbewegung Sample2D component.