79 p.setRenderHint(QPainter::Antialiasing,
true);
80 p.setRenderHint(QPainter::TextAntialiasing,
true);
81 p.fillRect(rect(), QColor(13, 17, 23));
82 p.setPen(QColor(210, 220, 230));
84 const int marginL = 58;
85 const int marginR = 18;
88 const int bottom = 30;
89 const int carpetH = std::max(120, (height() - top - bottom - gap) * 3 / 5);
90 const int spreadH = std::max(90, height() - top - bottom - gap - carpetH);
91 const QRect carpetRect(marginL, top, std::max(40, width() - marginL - marginR), carpetH);
92 const QRect spreadRect(marginL, top + carpetH + gap,
93 std::max(40, width() - marginL - marginR), spreadH);
95 p.drawText(QRect(8, 3, width() - 16, 20), Qt::AlignCenter,
96 QStringLiteral(
"Quantum kicked rotor: diffusion in momentum, then dynamical localization"));
99 p.drawText(rect(), Qt::AlignCenter,
100 QStringLiteral(
"Run the Quantum Kicked Rotor preset"));
104 const std::vector<qpe::QuantumKickedRotorSample2D> &samples =
history_->
samples();
105 p.setPen(QColor(72, 84, 96));
106 p.drawRect(carpetRect);
107 p.drawRect(spreadRect);
108 p.setPen(QColor(210, 220, 230));
109 p.drawText(QRect(carpetRect.left(), carpetRect.top() - 20, carpetRect.width(), 18),
111 QStringLiteral(
"Stroboscopic momentum carpet P(n) after each kick"));
112 p.drawText(QRect(spreadRect.left(), spreadRect.top() - 20, spreadRect.width(), 18),
114 QStringLiteral(
"Momentum diffusion: <n^2> quantum vs classical standard map"));
116 std::size_t modeCount = 0u;
117 double maxProbability = 0.0;
119 modeCount = std::max(modeCount, s.modeProbability.size());
120 for (
float v : s.modeProbability) maxProbability = std::max(maxProbability,
static_cast<double>(v));
122 maxProbability = std::max(maxProbability, 1.0e-12);
124 if (modeCount > 0u) {
125 const double rowH =
static_cast<double>(carpetRect.height()) /
static_cast<double>(samples.size());
126 const double cellW =
static_cast<double>(carpetRect.width()) /
static_cast<double>(modeCount);
127 for (std::size_t row = 0u; row < samples.size(); ++row) {
130 const double normalized = std::sqrt(
static_cast<double>(s.
modeProbability[col]) / maxProbability);
131 const QRectF cell(carpetRect.left() +
static_cast<double>(col) * cellW,
132 carpetRect.top() +
static_cast<double>(row) * rowH,
133 std::max(1.0, cellW + 0.5),
134 std::max(1.0, rowH + 0.5));
135 p.fillRect(cell, heatColor(normalized));
140 const double nMin = latest.
modeMin;
141 const double nMax = latest.
modeMin + latest.
modeStep *
static_cast<double>(modeCount - 1u);
142 p.setPen(QColor(210, 220, 230));
143 p.drawText(QRect(carpetRect.left(), carpetRect.bottom() + 3, carpetRect.width(), 20),
145 QStringLiteral(
"n=%1").arg(nMin, 0,
'f', 0));
146 p.drawText(QRect(carpetRect.left(), carpetRect.bottom() + 3, carpetRect.width(), 20),
147 Qt::AlignCenter, QStringLiteral(
"momentum mode n"));
148 p.drawText(QRect(carpetRect.left(), carpetRect.bottom() + 3, carpetRect.width(), 20),
150 QStringLiteral(
"n=%1").arg(nMax, 0,
'f', 0));
151 p.drawText(QRect(4, carpetRect.top(), 50, carpetRect.height()),
152 Qt::AlignRight | Qt::AlignTop,
153 QStringLiteral(
"kick 0"));
154 p.drawText(QRect(4, carpetRect.top(), 50, carpetRect.height()),
155 Qt::AlignRight | Qt::AlignBottom,
156 QStringLiteral(
"kick %1").arg(
static_cast<qulonglong
>(latest.
kickCount)));
159 const std::size_t maxKick = std::max<std::size_t>(1u, samples.back().kickCount);
162 yMax = std::max(yMax, std::max(s.meanModeSquared, s.classicalMeanModeSquared));
164 auto mapKick = [&](std::size_t kick) {
165 return spreadRect.left() +
static_cast<double>(kick) /
166 static_cast<double>(maxKick) * spreadRect.width();
168 auto mapY = [&](
double value) {
169 return spreadRect.bottom() - value / yMax * spreadRect.height();
172 auto drawSeries = [&](
bool classical) {
174 bool started =
false;
176 const double value = classical ? s.classicalMeanModeSquared : s.meanModeSquared;
177 const QPointF point(mapKick(s.kickCount), mapY(value));
178 if (!started) { path.moveTo(point); started =
true; }
179 else path.lineTo(point);
181 p.setPen(QPen(classical ? QColor(245, 166, 70) : QColor(80, 220, 235),
182 classical ? 1.6 : 2.2,
183 classical ? Qt::DashLine : Qt::SolidLine));
189 p.setPen(QColor(80, 220, 235));
190 p.drawText(spreadRect.adjusted(8, 6, -8, -6), Qt::AlignTop | Qt::AlignLeft,
191 QStringLiteral(
"quantum <n^2>"));
192 p.setPen(QColor(245, 166, 70));
193 p.drawText(spreadRect.adjusted(8, 6, -8, -6), Qt::AlignTop | Qt::AlignRight,
194 QStringLiteral(
"classical diffusion"));
195 p.setPen(QColor(210, 220, 230));
196 p.drawText(QRect(4, spreadRect.top(), 50, spreadRect.height()),
197 Qt::AlignRight | Qt::AlignTop,
198 QString::number(yMax,
'f', 0));
199 p.drawText(QRect(spreadRect.left(), spreadRect.bottom() + 4, spreadRect.width(), 20),
201 QStringLiteral(
"number of kicks"));