16#include <QJsonDocument>
18#include <QJsonParseError>
77 json.insert(QStringLiteral(
"id"), QString::number(
static_cast<qulonglong
>(
object.
id)));
79 json.insert(QStringLiteral(
"enabled"),
object.enabled);
80 json.insert(QStringLiteral(
"value"),
object.value);
81 json.insert(QStringLiteral(
"centerX"),
object.centerX);
82 json.insert(QStringLiteral(
"centerY"),
object.centerY);
83 json.insert(QStringLiteral(
"width"),
object.width);
84 json.insert(QStringLiteral(
"height"),
object.height);
85 json.insert(QStringLiteral(
"radius"),
object.radius);
86 json.insert(QStringLiteral(
"length"),
object.length);
87 json.insert(QStringLiteral(
"thickness"),
object.thickness);
88 json.insert(QStringLiteral(
"wallWidth"),
object.wallWidth);
89 json.insert(QStringLiteral(
"slitHeight"),
object.slitHeight);
90 json.insert(QStringLiteral(
"slitSeparation"),
object.slitSeparation);
91 json.insert(QStringLiteral(
"sigmaX"),
object.sigmaX);
92 json.insert(QStringLiteral(
"sigmaY"),
object.sigmaY);
93 json.insert(QStringLiteral(
"curvatureX"),
object.curvatureX);
94 json.insert(QStringLiteral(
"curvatureY"),
object.curvatureY);
95 json.insert(QStringLiteral(
"slopeX"),
object.slopeX);
96 json.insert(QStringLiteral(
"slopeY"),
object.slopeY);
97 json.insert(QStringLiteral(
"softening"),
object.softening);
109 const QJsonValue item = json.value(QString::fromLatin1(name));
110 if (!item.isDouble()) {
113 const double number = item.toDouble();
114 if (!std::isfinite(number)) {
117 value =
static_cast<float>(number);
118 return std::isfinite(
static_cast<double>(value));
130 QString &errorMessage,
135 const QString idText = json.
value(QStringLiteral(
"id")).toString();
137 const qulonglong
id = idText.toULongLong(&idOk);
138 if (!idOk ||
id == 0) {
139 errorMessage = QStringLiteral(
"Potential scene object %1 has an invalid id.").arg(index);
142 parsed.
id =
static_cast<std::uint64_t
>(id);
145 errorMessage = QStringLiteral(
"Potential scene object %1 has an unknown type.").arg(index);
149 const QJsonValue enabledValue = json.value(QStringLiteral(
"enabled"));
150 if (!enabledValue.isBool()) {
151 errorMessage = QStringLiteral(
"Potential scene object %1 has an invalid enabled flag.").arg(index);
154 parsed.
enabled = enabledValue.toBool();
156 const char *fields[] = {
157 "value",
"centerX",
"centerY",
"width",
"height",
"radius",
158 "length",
"thickness",
"wallWidth",
"slitHeight",
"slitSeparation"
165 const int fieldCount =
static_cast<int>(
sizeof(fields) /
sizeof(fields[0]));
166 for (
int i = 0; i < fieldCount; ++i) {
168 errorMessage = QStringLiteral(
"Potential scene object %1 has invalid numeric field '%2'.")
170 .arg(QString::fromLatin1(fields[i]));
175 const char *smoothFields[] = {
176 "sigmaX",
"sigmaY",
"curvatureX",
"curvatureY",
177 "slopeX",
"slopeY",
"softening"
179 float *smoothValues[] = {
183 const int smoothCount =
static_cast<int>(
sizeof(smoothFields) /
sizeof(smoothFields[0]));
184 for (
int i = 0; i < smoothCount; ++i) {
185 const QJsonValue item = json.value(QString::fromLatin1(smoothFields[i]));
186 if (item.isUndefined()) {
190 errorMessage = QStringLiteral(
"Potential scene object %1 has invalid numeric field '%2'.")
192 .arg(QString::fromLatin1(smoothFields[i]));
197 if (!parsed.
valid()) {
198 errorMessage = QStringLiteral(
"Potential scene object %1 contains invalid geometry dimensions.").arg(index);
220 scene.insert(QStringLiteral(
"composition"), QStringLiteral(
"additive"));
221 scene.insert(QStringLiteral(
"objects"), objects);
233 QString &errorMessage)
235 const QJsonValue sceneValue = json.value(QStringLiteral(
"potentialScene"));
236 if (!sceneValue.isObject()) {
237 errorMessage = QStringLiteral(
"Experiment schema 2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23 is missing a valid potentialScene object.");
241 const QJsonObject sceneJson = sceneValue.toObject();
242 const QJsonValue activeValue = sceneJson.value(QStringLiteral(
"active"));
243 const QJsonValue objectsValue = sceneJson.value(QStringLiteral(
"objects"));
244 if (!activeValue.isBool() || !objectsValue.isArray()) {
245 errorMessage = QStringLiteral(
"Experiment potentialScene must contain active and objects fields.");
249 const QString composition = sceneJson.value(QStringLiteral(
"composition")).toString();
250 if (!composition.isEmpty() && composition != QStringLiteral(
"additive")) {
251 errorMessage = QStringLiteral(
"Unsupported potential scene composition '%1'.").arg(composition);
256 const QJsonArray objects = objectsValue.toArray();
257 if (objects.size() > 512) {
258 errorMessage = QStringLiteral(
"Potential scene contains too many objects (%1).").arg(objects.size());
262 for (
int i = 0; i < objects.size(); ++i) {
263 if (!objects.at(i).isObject()) {
264 errorMessage = QStringLiteral(
"Potential scene object %1 is not a JSON object.").arg(i);
271 const std::uint64_t requestedId =
object.
id;
272 const std::uint64_t insertedId = scene.
add(
object);
273 if (insertedId != requestedId) {
274 errorMessage = QStringLiteral(
"Potential scene contains duplicate object id %1.")
275 .arg(QString::number(
static_cast<qulonglong
>(requestedId)));
295 QString type = QStringLiteral(
"gaussian");
312 prep.insert(QStringLiteral(
"type"), type);
313 prep.insert(QStringLiteral(
"stateA"), document.
boundStateA);
314 prep.insert(QStringLiteral(
"stateB"), document.
boundStateB);
326 QJsonObject measurement;
339 QString &errorMessage)
341 const QJsonValue value = json.value(QStringLiteral(
"measurementCollapse"));
342 if (!value.isObject()) {
343 errorMessage = QStringLiteral(
"Experiment schema 5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24 is missing a valid measurementCollapse object.");
346 const QJsonValue resolution = value.toObject().value(QStringLiteral(
"resolution"));
347 if (!resolution.isDouble()) {
348 errorMessage = QStringLiteral(
"Experiment measurementCollapse contains an invalid resolution.");
355 errorMessage = QStringLiteral(
"Experiment measurement-collapse resolution is out of range.");
369 q.insert(QStringLiteral(
"enabled"), document.
quench.
enabled);
370 q.insert(QStringLiteral(
"targetObjectId"), QString::number(
static_cast<qulonglong
>(document.
quench.
targetObjectId)));
371 q.insert(QStringLiteral(
"parameter"),
static_cast<int>(document.
quench.
parameter));
386 QString &errorMessage)
388 const QJsonValue value = json.value(QStringLiteral(
"quantumQuench"));
389 if (!value.isObject()) {
390 errorMessage = QStringLiteral(
"Experiment schema 6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23 is missing a valid quantumQuench object.");
393 const QJsonObject q = value.toObject();
394 if (!q.value(QStringLiteral(
"enabled")).isBool() ||
395 !q.value(QStringLiteral(
"parameter")).isDouble() ||
396 !q.value(QStringLiteral(
"time")).isDouble() ||
397 !q.value(QStringLiteral(
"before")).isDouble() ||
398 !q.value(QStringLiteral(
"after")).isDouble()) {
399 errorMessage = QStringLiteral(
"Experiment quantumQuench contains invalid fields.");
402 document.
quench.
enabled = q.value(QStringLiteral(
"enabled")).toBool();
404 const qulonglong
id = q.value(QStringLiteral(
"targetObjectId")).toString().toULongLong(&idOk);
406 const int param = q.value(QStringLiteral(
"parameter")).toInt(-1);
407 if (param < 0 || param > 7) {
408 errorMessage = QStringLiteral(
"Experiment quantumQuench has an unsupported parameter.");
416 errorMessage = QStringLiteral(
"Experiment quantumQuench does not match its potential scene.");
448 QString &errorMessage)
450 const QJsonValue value = json.value(QStringLiteral(
"periodicDrive"));
451 if (!value.isObject()) {
452 errorMessage = QStringLiteral(
"Experiment schema 7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23 is missing a valid periodicDrive object.");
455 const QJsonObject d = value.toObject();
456 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
457 !d.value(QStringLiteral(
"parameter")).isDouble() ||
458 !d.value(QStringLiteral(
"mean")).isDouble() ||
459 !d.value(QStringLiteral(
"amplitude")).isDouble() ||
460 !d.value(QStringLiteral(
"angularFrequency")).isDouble() ||
461 !d.value(QStringLiteral(
"phaseDegrees")).isDouble()) {
462 errorMessage = QStringLiteral(
"Experiment periodicDrive contains invalid fields.");
467 const qulonglong
id = d.value(QStringLiteral(
"targetObjectId")).toString().toULongLong(&idOk);
469 const int param = d.value(QStringLiteral(
"parameter")).toInt(-1);
470 if (param < 0 || param > 7) {
471 errorMessage = QStringLiteral(
"Experiment periodicDrive has an unsupported parameter.");
481 errorMessage = QStringLiteral(
"Experiment periodicDrive does not match its potential scene.");
495 d.insert(QStringLiteral(
"targetObjectId"), QString::number(
static_cast<qulonglong
>(document.
linearSweep.
targetObjectId)));
515 QString &errorMessage)
517 const QJsonValue value = json.value(QStringLiteral(
"linearSweep"));
518 if (!value.isObject()) {
519 errorMessage = QStringLiteral(
"Experiment schema 8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23 is missing a valid linearSweep object.");
522 const QJsonObject d = value.toObject();
523 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
524 !d.value(QStringLiteral(
"parameter")).isDouble() ||
525 !d.value(QStringLiteral(
"startValue")).isDouble() ||
526 !d.value(QStringLiteral(
"endValue")).isDouble() ||
527 !d.value(QStringLiteral(
"startTime")).isDouble() ||
528 !d.value(QStringLiteral(
"duration")).isDouble()) {
529 errorMessage = QStringLiteral(
"Experiment linearSweep contains invalid fields.");
534 const qulonglong
id = d.value(QStringLiteral(
"targetObjectId")).toString().toULongLong(&idOk);
536 const int param = d.value(QStringLiteral(
"parameter")).toInt(-1);
537 if (param < 0 || param > 7) {
538 errorMessage = QStringLiteral(
"Experiment linearSweep has an unsupported parameter.");
548 const QJsonValue returnEnabledValue = d.value(QStringLiteral(
"returnEnabled"));
549 const QJsonValue holdDurationValue = d.value(QStringLiteral(
"holdDuration"));
550 const QJsonValue returnDurationValue = d.value(QStringLiteral(
"returnDuration"));
551 if (!returnEnabledValue.isUndefined()) {
552 if (!returnEnabledValue.isBool()) {
553 errorMessage = QStringLiteral(
"Experiment linearSweep returnEnabled is invalid.");
558 if (!holdDurationValue.isUndefined()) {
559 if (!holdDurationValue.isDouble()) {
560 errorMessage = QStringLiteral(
"Experiment linearSweep holdDuration is invalid.");
565 if (!returnDurationValue.isUndefined()) {
566 if (!returnDurationValue.isDouble()) {
567 errorMessage = QStringLiteral(
"Experiment linearSweep returnDuration is invalid.");
574 errorMessage = QStringLiteral(
"Experiment linearSweep does not match its potential scene.");
612 QString &errorMessage)
614 const QJsonValue value = json.value(QStringLiteral(
"ramseySequence"));
615 if (!value.isObject()) {
616 errorMessage = QStringLiteral(
"Experiment schema 10/11/12/13/14/15/16/17/18/19/20/21/22/23 is missing a valid ramseySequence object.");
619 const QJsonObject d = value.toObject();
620 const char *numericFields[] = {
621 "parameter",
"mean",
"amplitude",
"angularFrequency",
622 "firstPhaseDegrees",
"secondPhaseDegrees",
"startTime",
623 "pulseDuration",
"freeEvolutionDuration"
625 if (!d.value(QStringLiteral(
"enabled")).isBool()) {
626 errorMessage = QStringLiteral(
"Experiment ramseySequence contains an invalid enabled field.");
629 for (
const char *field : numericFields) {
630 if (!d.value(QString::fromLatin1(field)).isDouble()) {
631 errorMessage = QStringLiteral(
"Experiment ramseySequence contains invalid numeric fields.");
637 const qulonglong
id = d.value(QStringLiteral(
"targetObjectId")).toString().toULongLong(&idOk);
639 const int param = d.value(QStringLiteral(
"parameter")).toInt(-1);
640 if (param < 0 || param > 7) {
641 errorMessage = QStringLiteral(
"Experiment ramseySequence has an unsupported parameter.");
655 if (d.value(QStringLiteral(
"echoPulseDuration")).isDouble())
657 if (d.value(QStringLiteral(
"echoPulsePhaseDegrees")).isDouble())
661 errorMessage = QStringLiteral(
"Experiment ramseySequence does not match its potential scene.");
688 QString &errorMessage)
690 const QJsonValue value = json.value(QStringLiteral(
"ramseyEnsemble"));
691 if (!value.isObject()) {
692 errorMessage = QStringLiteral(
"Experiment schema 12/13/14/15/16/17/18/19/20/21/22/23 is missing a valid ramseyEnsemble object.");
695 const QJsonObject d = value.toObject();
696 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
697 !d.value(QStringLiteral(
"detuningStdDev")).isDouble() ||
698 !d.value(QStringLiteral(
"memberCount")).isDouble()) {
699 errorMessage = QStringLiteral(
"Experiment ramseyEnsemble contains invalid fields.");
706 errorMessage = QStringLiteral(
"Experiment ramseyEnsemble values are out of range.");
736 QString &errorMessage)
738 const QJsonValue value = json.value(QStringLiteral(
"talbotInitialState"));
739 if (!value.isObject()) {
740 errorMessage = QStringLiteral(
"Experiment schema 13/14 is missing a valid talbotInitialState object.");
743 const QJsonObject d = value.toObject();
744 const char *
const names[] = {
"period",
"toothSigma",
"offsetX",
"centerY",
"sigmaY",
"momentumY"};
745 for (
const char *name : names) {
746 if (!d.value(QString::fromLatin1(name)).isDouble()) {
747 errorMessage = QStringLiteral(
"Experiment talbotInitialState contains invalid fields.");
758 errorMessage = QStringLiteral(
"Experiment talbotInitialState values are out of range.");
788 QString &errorMessage)
790 const QJsonValue value = json.value(QStringLiteral(
"vortexInitialState"));
791 if (!value.isObject()) {
792 errorMessage = QStringLiteral(
"Experiment schema 14/15/16/17/18/19/20/21/22/23 is missing a valid vortexInitialState object.");
795 const QJsonObject d = value.toObject();
796 const char *
const names[] = {
"envelopeCenterX",
"envelopeCenterY",
"envelopeSigma",
"coreX",
"coreY",
"charge"};
797 for (
const char *name : names) {
798 if (!d.value(QString::fromLatin1(name)).isDouble()) {
799 errorMessage = QStringLiteral(
"Experiment vortexInitialState contains invalid fields.");
810 errorMessage = QStringLiteral(
"Experiment vortexInitialState values are out of range.");
840 QString &errorMessage)
842 const QJsonValue value = json.value(QStringLiteral(
"andersonInitialState"));
843 if (!value.isObject()) {
844 errorMessage = QStringLiteral(
"Experiment schema 15 is missing a valid andersonInitialState object.");
847 const QJsonObject d = value.toObject();
848 const char *
const names[] = {
"centerX",
"cleanLaneY",
"disorderLaneY",
"sigma",
"relativePhaseDegrees"};
849 for (
const char *name : names) {
850 if (!d.value(QString::fromLatin1(name)).isDouble()) {
851 errorMessage = QStringLiteral(
"Experiment andersonInitialState contains invalid fields.");
861 errorMessage = QStringLiteral(
"Experiment andersonInitialState values are out of range.");
890 QString &errorMessage)
892 const QJsonValue value = json.value(QStringLiteral(
"kickedRotor"));
893 if (!value.isObject()) {
894 errorMessage = QStringLiteral(
"Experiment schema 16/17/18/19/20/21/22/23 is missing a valid kickedRotor object.");
897 const QJsonObject d = value.toObject();
898 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
899 !d.value(QStringLiteral(
"firstKickTime")).isDouble() ||
900 !d.value(QStringLiteral(
"kickPeriod")).isDouble() ||
901 !d.value(QStringLiteral(
"phaseStrength")).isDouble()) {
902 errorMessage = QStringLiteral(
"Experiment kickedRotor contains invalid fields.");
910 errorMessage = QStringLiteral(
"Experiment kickedRotor values are out of range.");
937 QString &errorMessage)
939 const QJsonValue value = json.value(QStringLiteral(
"kickedRotorInitialState"));
940 if (!value.isObject()) {
941 errorMessage = QStringLiteral(
"Experiment schema 16/17/18/19/20/21/22/23 is missing a valid kickedRotorInitialState object.");
944 const QJsonObject d = value.toObject();
945 if (!d.value(QStringLiteral(
"yCenter")).isDouble() ||
946 !d.value(QStringLiteral(
"ySigma")).isDouble() ||
947 !d.value(QStringLiteral(
"initialMomentumMode")).isDouble()) {
948 errorMessage = QStringLiteral(
"Experiment kickedRotorInitialState contains invalid fields.");
954 d.value(QStringLiteral(
"initialMomentumMode")).toInt(0);
956 errorMessage = QStringLiteral(
"Experiment kickedRotorInitialState values are out of range.");
987 QString &errorMessage)
989 const QJsonValue value = json.value(QStringLiteral(
"quantumZeno"));
990 if (!value.isObject()) {
991 errorMessage = QStringLiteral(
"Experiment schema 17/18 is missing a valid quantumZeno object.");
994 const QJsonObject d = value.toObject();
995 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
996 !d.value(QStringLiteral(
"firstMeasurementTime")).isDouble() ||
997 !d.value(QStringLiteral(
"measurementPeriod")).isDouble() ||
998 !d.value(QStringLiteral(
"laneSplitY")).isDouble() ||
999 !d.value(QStringLiteral(
"survivalBoundaryX")).isDouble() ||
1000 !d.value(QStringLiteral(
"edgeWidth")).isDouble()) {
1001 errorMessage = QStringLiteral(
"Experiment quantumZeno contains invalid fields.");
1011 errorMessage = QStringLiteral(
"Experiment quantumZeno values are out of range.");
1041 QString &errorMessage)
1043 const QJsonValue value = json.value(QStringLiteral(
"quantumZenoInitialState"));
1044 if (!value.isObject()) {
1045 errorMessage = QStringLiteral(
"Experiment schema 17/18 is missing a valid quantumZenoInitialState object.");
1048 const QJsonObject d = value.toObject();
1049 if (!d.value(QStringLiteral(
"centerX")).isDouble() ||
1050 !d.value(QStringLiteral(
"controlLaneY")).isDouble() ||
1051 !d.value(QStringLiteral(
"watchedLaneY")).isDouble() ||
1052 !d.value(QStringLiteral(
"sigma")).isDouble() ||
1053 !d.value(QStringLiteral(
"momentumX")).isDouble() ||
1054 !d.value(QStringLiteral(
"relativePhaseDegrees")).isDouble()) {
1055 errorMessage = QStringLiteral(
"Experiment quantumZenoInitialState contains invalid fields.");
1065 errorMessage = QStringLiteral(
"Experiment quantumZenoInitialState values are out of range.");
1092 QString &errorMessage)
1094 const QJsonValue value = json.value(QStringLiteral(
"quantumScar"));
1095 if (!value.isObject()) {
1096 errorMessage = QStringLiteral(
"Experiment schema 18 is missing a valid quantumScar object.");
1099 const QJsonObject d = value.toObject();
1100 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
1101 !d.value(QStringLiteral(
"orbitBandHalfWidth")).isDouble() ||
1102 !d.value(QStringLiteral(
"referenceEnergy")).isDouble()) {
1103 errorMessage = QStringLiteral(
"Experiment quantumScar contains invalid fields.");
1110 errorMessage = QStringLiteral(
"Experiment quantumScar values are out of range.");
1139 QString &errorMessage)
1141 const QJsonValue value = json.value(QStringLiteral(
"quantumBerry"));
1142 if (!value.isObject()) {
1143 errorMessage = QStringLiteral(
"Experiment schema 19 is missing a valid quantumBerry object.");
1146 const QJsonObject d = value.toObject();
1147 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
1148 !d.value(QStringLiteral(
"anisotropy")).isDouble() ||
1149 !d.value(QStringLiteral(
"startTime")).isDouble() ||
1150 !d.value(QStringLiteral(
"duration")).isDouble() ||
1151 !d.value(QStringLiteral(
"winding")).isDouble()) {
1152 errorMessage = QStringLiteral(
"Experiment quantumBerry contains invalid fields.");
1165 errorMessage = QStringLiteral(
"Experiment quantumBerry values or base harmonic trap are invalid.");
1195 QString &errorMessage)
1197 const QJsonValue value = json.value(QStringLiteral(
"quantumLoschmidt"));
1198 if (!value.isObject()) {
1199 errorMessage = QStringLiteral(
"Experiment schema 20 is missing a valid quantumLoschmidt object.");
1202 const QJsonObject d = value.toObject();
1203 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
1204 !d.value(QStringLiteral(
"reversalTime")).isDouble() ||
1205 !d.value(QStringLiteral(
"momentumErrorX")).isDouble() ||
1206 !d.value(QStringLiteral(
"momentumErrorY")).isDouble()) {
1207 errorMessage = QStringLiteral(
"Experiment quantumLoschmidt contains invalid fields.");
1215 errorMessage = QStringLiteral(
"Experiment quantumLoschmidt values are out of range.");
1248 QString &errorMessage)
1250 const QJsonValue value = json.value(QStringLiteral(
"moshinskyInitialState"));
1251 if (!value.isObject()) {
1252 errorMessage = QStringLiteral(
"Experiment schema 21 is missing a valid moshinskyInitialState object.");
1255 const QJsonObject d = value.toObject();
1256 const char *names[] = {
1257 "shutterX",
"envelopeCenterX",
"envelopeSigmaX",
"centerY",
1258 "transverseSigmaY",
"momentumX",
"edgeWidth"
1260 if (!d.value(QStringLiteral(
"enabled")).isBool()) {
1261 errorMessage = QStringLiteral(
"Experiment moshinskyInitialState has invalid enabled field.");
1264 for (
const char *name : names) {
1265 if (!d.value(QString::fromLatin1(name)).isDouble()) {
1266 errorMessage = QStringLiteral(
"Experiment moshinskyInitialState contains invalid numeric fields.");
1279 errorMessage = QStringLiteral(
"Experiment moshinskyInitialState values are out of range.");
1293 d.insert(QStringLiteral(
"shutterObjectId"),
1309 QString &errorMessage)
1311 const QJsonValue value = json.value(QStringLiteral(
"quantumMoshinsky"));
1312 if (!value.isObject()) {
1313 errorMessage = QStringLiteral(
"Experiment schema 21 is missing a valid quantumMoshinsky object.");
1316 const QJsonObject d = value.toObject();
1317 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
1318 !d.value(QStringLiteral(
"openTime")).isDouble() ||
1319 !d.value(QStringLiteral(
"detectorX")).isDouble() ||
1320 !d.value(QStringLiteral(
"analysisEndTime")).isDouble()) {
1321 errorMessage = QStringLiteral(
"Experiment quantumMoshinsky contains invalid fields.");
1326 const qulonglong
id = d.value(QStringLiteral(
"shutterObjectId")).toString().toULongLong(&idOk);
1333 errorMessage = QStringLiteral(
"Experiment quantumMoshinsky does not match its potential scene.");
1364 QString &errorMessage)
1366 const QJsonValue value = json.value(QStringLiteral(
"kapitzaDiracInitialState"));
1367 if (!value.isObject()) {
1368 errorMessage = QStringLiteral(
"Experiment schema 22 is missing a valid kapitzaDiracInitialState object.");
1371 const QJsonObject d = value.toObject();
1372 const char *names[] = {
"centerX",
"centerY",
"sigmaX",
"sigmaY",
"momentumX",
"momentumY"};
1373 for (
const char *name : names) {
1374 if (!d.value(QString::fromLatin1(name)).isDouble()) {
1375 errorMessage = QStringLiteral(
"Experiment kapitzaDiracInitialState contains invalid numeric fields.");
1386 errorMessage = QStringLiteral(
"Experiment kapitzaDiracInitialState values are out of range.");
1418 QString &errorMessage)
1420 const QJsonValue value = json.value(QStringLiteral(
"quantumKapitzaDirac"));
1421 if (!value.isObject()) {
1422 errorMessage = QStringLiteral(
"Experiment schema 22 is missing a valid quantumKapitzaDirac object.");
1425 const QJsonObject d = value.toObject();
1426 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
1427 !d.value(QStringLiteral(
"latticePeriod")).isDouble() ||
1428 !d.value(QStringLiteral(
"latticeDepth")).isDouble() ||
1429 !d.value(QStringLiteral(
"latticePhaseDegrees")).isDouble() ||
1430 !d.value(QStringLiteral(
"pulseStartTime")).isDouble() ||
1431 !d.value(QStringLiteral(
"pulseDuration")).isDouble() ||
1432 !d.value(QStringLiteral(
"analysisEndTime")).isDouble() ||
1433 !d.value(QStringLiteral(
"maximumOrder")).isDouble()) {
1434 errorMessage = QStringLiteral(
"Experiment quantumKapitzaDirac contains invalid fields.");
1446 errorMessage = QStringLiteral(
"Experiment quantumKapitzaDirac values are out of range.");
1479 QString &errorMessage)
1481 const QJsonValue value = json.value(QStringLiteral(
"quantumAharonovBohm"));
1482 if (!value.isObject()) {
1483 errorMessage = QStringLiteral(
"Experiment schema 23 is missing a valid quantumAharonovBohm object.");
1486 const QJsonObject d = value.toObject();
1487 const char *numeric[] = {
"solenoidX",
"solenoidY",
"solenoidRadius",
"fluxQuanta",
"barrierHeight",
"detectorX",
"analysisEndTime"};
1488 if (!d.value(QStringLiteral(
"enabled")).isBool()) {
1489 errorMessage = QStringLiteral(
"Experiment quantumAharonovBohm contains an invalid enabled field.");
1492 for (
const char *name : numeric) {
1493 if (!d.value(QString::fromLatin1(name)).isDouble()) {
1494 errorMessage = QStringLiteral(
"Experiment quantumAharonovBohm contains invalid numeric fields.");
1507 errorMessage = QStringLiteral(
"Experiment quantumAharonovBohm values are out of range.");
1537 const QJsonValue value = json.value(QStringLiteral(
"quantumLandau"));
1538 if (!value.isObject()) {
1539 errorMessage = QStringLiteral(
"Experiment schema 24 is missing a valid quantumLandau object.");
1542 const QJsonObject d = value.toObject();
1543 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
1544 !d.value(QStringLiteral(
"fieldStrength")).isDouble() ||
1545 !d.value(QStringLiteral(
"preparationMode")).isDouble() ||
1546 !d.value(QStringLiteral(
"landauIndex")).isDouble() ||
1547 !d.value(QStringLiteral(
"orbitRadius")).isDouble() ||
1548 !d.value(QStringLiteral(
"analysisEndTime")).isDouble()) {
1549 errorMessage = QStringLiteral(
"Experiment quantumLandau contains invalid fields.");
1559 errorMessage = QStringLiteral(
"Experiment quantumLandau values are out of range.");
1592 const QJsonValue value = json.value(QStringLiteral(
"quantumHallEdge"));
1593 if (!value.isObject()) {
1594 errorMessage = QStringLiteral(
"Experiment schema 25 is missing a valid quantumHallEdge object.");
1597 const QJsonObject d = value.toObject();
1598 const char *fields[] = {
"fieldStrength",
"edgeY",
"wallHeight",
"launchY",
"orbitRadius",
"packetSigma",
"edgeBand",
"analysisEndTime"};
1599 if (!d.value(QStringLiteral(
"enabled")).isBool()) {
1600 errorMessage = QStringLiteral(
"Experiment quantumHallEdge contains invalid fields.");
return false;
1602 for (
const char *f : fields) {
1603 if (!d.value(QString::fromLatin1(f)).isDouble()) {
1604 errorMessage = QStringLiteral(
"Experiment quantumHallEdge contains invalid fields.");
return false;
1617 errorMessage = QStringLiteral(
"Experiment quantumHallEdge values are out of range.");
return false;
1651 const QJsonValue value = json.value(QStringLiteral(
"quantumBackflow"));
1652 if (!value.isObject()) {
1653 errorMessage = QStringLiteral(
"Experiment schema 26 is missing a valid quantumBackflow object.");
1656 const QJsonObject d = value.toObject();
1657 const char *fields[] = {
"detectorX",
"slowWaveNumber",
"fastWaveNumber",
"momentumSigma",
1658 "fastAmplitudeRatio",
"relativePhaseDegrees",
"initialCenterX",
1659 "transverseSigma",
"analysisEndTime"};
1660 if (!d.value(QStringLiteral(
"enabled")).isBool()) {
1661 errorMessage = QStringLiteral(
"Experiment quantumBackflow contains invalid fields.");
1664 for (
const char *f : fields) {
1665 if (!d.value(QString::fromLatin1(f)).isDouble()) {
1666 errorMessage = QStringLiteral(
"Experiment quantumBackflow contains invalid fields.");
1681 errorMessage = QStringLiteral(
"Experiment quantumBackflow values are out of range.");
1716 QString &errorMessage)
1718 const QJsonValue value = json.value(QStringLiteral(
"quantumZitterbewegung"));
1719 if (!value.isObject()) {
1720 errorMessage = QStringLiteral(
"Experiment schema 27 is missing a valid quantumZitterbewegung object.");
1723 const QJsonObject d = value.toObject();
1724 if (!d.value(QStringLiteral(
"enabled")).isBool() ||
1725 !d.value(QStringLiteral(
"preparationMode")).isDouble()) {
1726 errorMessage = QStringLiteral(
"Experiment quantumZitterbewegung contains invalid fields.");
1729 const char *fields[] = {
"lightSpeed",
"restMass",
"centerX",
"centerY",
"sigma",
1730 "momentumX",
"momentumY",
"analysisEndTime"};
1731 for (
const char *f : fields) {
1732 if (!d.value(QString::fromLatin1(f)).isDouble()) {
1733 errorMessage = QStringLiteral(
"Experiment quantumZitterbewegung contains invalid fields.");
1748 errorMessage = QStringLiteral(
"Experiment quantumZitterbewegung values are out of range.");
1763 d.insert(QStringLiteral(
"enabled"), c.enabled);
1764 d.insert(QStringLiteral(
"lightSpeed"), c.lightSpeed);
1765 d.insert(QStringLiteral(
"restMass"), c.restMass);
1766 d.insert(QStringLiteral(
"centerX"), c.centerX);
1767 d.insert(QStringLiteral(
"centerY"), c.centerY);
1768 d.insert(QStringLiteral(
"sigma"), c.sigma);
1769 d.insert(QStringLiteral(
"momentumX"), c.momentumX);
1770 d.insert(QStringLiteral(
"momentumY"), c.momentumY);
1771 d.insert(QStringLiteral(
"barrierCenterX"), c.barrierCenterX);
1772 d.insert(QStringLiteral(
"barrierWidth"), c.barrierWidth);
1773 d.insert(QStringLiteral(
"barrierHeight"), c.barrierHeight);
1774 d.insert(QStringLiteral(
"detectorX"), c.detectorX);
1775 d.insert(QStringLiteral(
"analysisEndTime"), c.analysisEndTime);
1787 QString &errorMessage)
1789 const QJsonValue value = json.value(QStringLiteral(
"quantumKleinTunneling"));
1790 if (!value.isObject()) {
1791 errorMessage = QStringLiteral(
"Experiment schema 28 is missing a valid quantumKleinTunneling object.");
1794 const QJsonObject d = value.toObject();
1795 if (!d.value(QStringLiteral(
"enabled")).isBool()) {
1796 errorMessage = QStringLiteral(
"Experiment quantumKleinTunneling contains invalid fields.");
1799 const char *fields[] = {
"lightSpeed",
"restMass",
"centerX",
"centerY",
"sigma",
"momentumX",
"momentumY",
1800 "barrierCenterX",
"barrierWidth",
"barrierHeight",
"detectorX",
"analysisEndTime"};
1801 for (
const char *f : fields) {
1802 if (!d.value(QString::fromLatin1(f)).isDouble()) {
1803 errorMessage = QStringLiteral(
"Experiment quantumKleinTunneling contains invalid fields.");
1808 c.
enabled = d.value(QStringLiteral(
"enabled")).toBool();
1809 c.lightSpeed = d.value(QStringLiteral(
"lightSpeed")).toDouble();
1810 c.restMass = d.value(QStringLiteral(
"restMass")).toDouble();
1811 c.centerX = d.value(QStringLiteral(
"centerX")).toDouble();
1812 c.centerY = d.value(QStringLiteral(
"centerY")).toDouble();
1813 c.sigma = d.value(QStringLiteral(
"sigma")).toDouble();
1814 c.momentumX = d.value(QStringLiteral(
"momentumX")).toDouble();
1815 c.momentumY = d.value(QStringLiteral(
"momentumY")).toDouble();
1816 c.barrierCenterX = d.value(QStringLiteral(
"barrierCenterX")).toDouble();
1817 c.barrierWidth = d.value(QStringLiteral(
"barrierWidth")).toDouble();
1818 c.barrierHeight = d.value(QStringLiteral(
"barrierHeight")).toDouble();
1819 c.detectorX = d.value(QStringLiteral(
"detectorX")).toDouble();
1820 c.analysisEndTime = d.value(QStringLiteral(
"analysisEndTime")).toDouble();
1822 errorMessage = QStringLiteral(
"Experiment quantumKleinTunneling values are out of range.");
1836 QString &errorMessage)
1838 const QJsonValue value = json.value(QStringLiteral(
"initialPreparation"));
1839 if (!value.isObject()) {
1840 errorMessage = QStringLiteral(
"Experiment schema 4+ is missing a valid initialPreparation object.");
1843 const QJsonObject prep = value.toObject();
1844 const QString type = prep.value(QStringLiteral(
"type")).toString();
1863 errorMessage = QStringLiteral(
"Experiment initialPreparation has unknown type '%1'.").arg(type);
1867 const QJsonValue a = prep.value(QStringLiteral(
"stateA"));
1868 const QJsonValue b = prep.value(QStringLiteral(
"stateB"));
1869 const QJsonValue phase = prep.value(QStringLiteral(
"relativePhaseDegrees"));
1870 if (!a.isDouble() || !b.isDouble() || !phase.isDouble()) {
1871 errorMessage = QStringLiteral(
"Experiment initialPreparation contains invalid state/phase fields.");
1880 errorMessage = QStringLiteral(
"Experiment initialPreparation values are out of range.");
1884 errorMessage = QStringLiteral(
"Bound-state superposition requires two different states.");
1894 return QStringLiteral(
"QuantumPhenomenaExplorer.Experiment2D");
1899 QJsonObject controlsObject;
1900 QMap<QString, QVariant>::const_iterator it = document.
controls.constBegin();
1901 for (; it != document.
controls.constEnd(); ++it) {
1902 controlsObject.insert(it.key(), QJsonValue::fromVariant(it.value()));
1906 root.insert(QStringLiteral(
"format"),
formatId());
1907 root.insert(QStringLiteral(
"schemaVersion"), document.
schemaVersion);
1908 root.insert(QStringLiteral(
"name"), document.
name);
1909 root.insert(QStringLiteral(
"sourcePreset"), document.
sourcePreset);
1910 root.insert(QStringLiteral(
"controls"), controlsObject);
1912 root.insert(QStringLiteral(
"potentialScene"), potentialSceneToJson(document));
1915 root.insert(QStringLiteral(
"initialPreparation"), initialPreparationToJson(document));
1918 root.insert(QStringLiteral(
"measurementCollapse"), measurementCollapseToJson(document));
1921 root.insert(QStringLiteral(
"quantumQuench"), quantumQuenchToJson(document));
1924 root.insert(QStringLiteral(
"periodicDrive"), periodicDriveToJson(document));
1927 root.insert(QStringLiteral(
"linearSweep"), linearSweepToJson(document));
1930 root.insert(QStringLiteral(
"ramseySequence"), ramseySequenceToJson(document));
1933 root.insert(QStringLiteral(
"ramseyEnsemble"), ramseyEnsembleToJson(document));
1936 root.insert(QStringLiteral(
"talbotInitialState"), talbotInitialStateToJson(document));
1939 root.insert(QStringLiteral(
"vortexInitialState"), vortexInitialStateToJson(document));
1942 root.insert(QStringLiteral(
"andersonInitialState"), andersonInitialStateToJson(document));
1945 root.insert(QStringLiteral(
"kickedRotor"), kickedRotorToJson(document));
1946 root.insert(QStringLiteral(
"kickedRotorInitialState"), kickedRotorInitialStateToJson(document));
1949 root.insert(QStringLiteral(
"quantumZeno"), quantumZenoToJson(document));
1950 root.insert(QStringLiteral(
"quantumZenoInitialState"), quantumZenoInitialStateToJson(document));
1953 root.insert(QStringLiteral(
"quantumScar"), quantumScarToJson(document));
1956 root.insert(QStringLiteral(
"quantumBerry"), quantumBerryToJson(document));
1959 root.insert(QStringLiteral(
"quantumLoschmidt"), quantumLoschmidtToJson(document));
1962 root.insert(QStringLiteral(
"moshinskyInitialState"), moshinskyInitialStateToJson(document));
1963 root.insert(QStringLiteral(
"quantumMoshinsky"), quantumMoshinskyToJson(document));
1966 root.insert(QStringLiteral(
"kapitzaDiracInitialState"), kapitzaDiracInitialStateToJson(document));
1967 root.insert(QStringLiteral(
"quantumKapitzaDirac"), quantumKapitzaDiracToJson(document));
1970 root.insert(QStringLiteral(
"quantumAharonovBohm"), quantumAharonovBohmToJson(document));
1973 root.insert(QStringLiteral(
"quantumLandau"), quantumLandauToJson(document));
1976 root.insert(QStringLiteral(
"quantumHallEdge"), quantumHallEdgeToJson(document));
1979 root.insert(QStringLiteral(
"quantumBackflow"), quantumBackflowToJson(document));
1982 root.insert(QStringLiteral(
"quantumZitterbewegung"), quantumZitterbewegungToJson(document));
1985 root.insert(QStringLiteral(
"quantumKleinTunneling"), quantumKleinTunnelingToJson(document));
1992 QString &errorMessage)
1994 errorMessage.clear();
1996 const QString format = json.value(QStringLiteral(
"format")).toString();
1998 errorMessage = QStringLiteral(
"This JSON file is not a Quantum Phenomena Explorer experiment document.");
2002 const QJsonValue versionValue = json.value(QStringLiteral(
"schemaVersion"));
2003 if (!versionValue.isDouble()) {
2004 errorMessage = QStringLiteral(
"Experiment document is missing a valid schemaVersion.");
2008 const int version = versionValue.toInt(-1);
2010 errorMessage = QStringLiteral(
"Unsupported experiment schema version %1 (this build supports versions 1 through %2).")
2016 const QJsonValue controlsValue = json.value(QStringLiteral(
"controls"));
2017 if (!controlsValue.isObject()) {
2018 errorMessage = QStringLiteral(
"Experiment document does not contain a valid controls object.");
2026 parsed.
name = json.value(QStringLiteral(
"name")).toString();
2027 parsed.
sourcePreset = json.value(QStringLiteral(
"sourcePreset")).toString();
2029 const QJsonObject controlsObject = controlsValue.toObject();
2030 QJsonObject::const_iterator it = controlsObject.constBegin();
2031 for (; it != controlsObject.constEnd(); ++it) {
2032 if (it.value().isUndefined() || it.value().isNull() ||
2033 it.value().isArray() || it.value().isObject()) {
2036 parsed.
controls.insert(it.key(), it.value().toVariant());
2040 errorMessage = QStringLiteral(
"Experiment document contains no usable control values.");
2044 if (version >= 2 && !potentialSceneFromJson(json, parsed, errorMessage)) {
2047 if (version >= 4 && !initialPreparationFromJson(json, parsed, errorMessage)) {
2050 if (version >= 5 && !measurementCollapseFromJson(json, parsed, errorMessage)) {
2053 if (version >= 6 && !quantumQuenchFromJson(json, parsed, errorMessage)) {
2056 if (version >= 7 && !periodicDriveFromJson(json, parsed, errorMessage)) {
2059 if (version >= 8 && !linearSweepFromJson(json, parsed, errorMessage)) {
2062 if (version >= 10 && !ramseySequenceFromJson(json, parsed, errorMessage)) {
2065 if (version >= 12 && !ramseyEnsembleFromJson(json, parsed, errorMessage)) {
2068 if (version >= 13 && !talbotInitialStateFromJson(json, parsed, errorMessage)) {
2071 if (version >= 14 && !vortexInitialStateFromJson(json, parsed, errorMessage)) {
2074 if (version >= 15 && !andersonInitialStateFromJson(json, parsed, errorMessage)) {
2077 if (version >= 16 && !kickedRotorFromJson(json, parsed, errorMessage)) {
2080 if (version >= 16 && !kickedRotorInitialStateFromJson(json, parsed, errorMessage)) {
2083 if (version >= 17 && !quantumZenoFromJson(json, parsed, errorMessage)) {
2086 if (version >= 17 && !quantumZenoInitialStateFromJson(json, parsed, errorMessage)) {
2089 if (version >= 18 && !quantumScarFromJson(json, parsed, errorMessage)) {
2092 if (version >= 19 && !quantumBerryFromJson(json, parsed, errorMessage)) {
2095 if (version >= 20 && !quantumLoschmidtFromJson(json, parsed, errorMessage)) {
2098 if (version >= 21 && !moshinskyInitialStateFromJson(json, parsed, errorMessage)) {
2101 if (version >= 21 && !quantumMoshinskyFromJson(json, parsed, errorMessage)) {
2104 if (version >= 22 && !kapitzaDiracInitialStateFromJson(json, parsed, errorMessage)) {
2107 if (version >= 22 && !quantumKapitzaDiracFromJson(json, parsed, errorMessage)) {
2110 if (version >= 23 && !quantumAharonovBohmFromJson(json, parsed, errorMessage)) {
2113 if (version >= 24 && !quantumLandauFromJson(json, parsed, errorMessage)) {
2116 if (version >= 25 && !quantumHallEdgeFromJson(json, parsed, errorMessage)) {
2119 if (version >= 26 && !quantumBackflowFromJson(json, parsed, errorMessage)) {
2122 if (version >= 27 && !quantumZitterbewegungFromJson(json, parsed, errorMessage)) {
2125 if (version >= 28 && !quantumKleinTunnelingFromJson(json, parsed, errorMessage)) {
2135 QString &errorMessage)
2137 errorMessage.clear();
2139 QSaveFile file(fileName);
2140 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
2141 errorMessage = QStringLiteral(
"Cannot open '%1' for writing: %2")
2142 .arg(fileName, file.errorString());
2146 const QJsonDocument jsonDocument(
toJson(document));
2147 const QByteArray bytes = jsonDocument.toJson(QJsonDocument::Indented);
2148 if (file.write(bytes) != bytes.size()) {
2149 errorMessage = QStringLiteral(
"Cannot write '%1': %2")
2150 .arg(fileName, file.errorString());
2151 file.cancelWriting();
2155 if (!file.commit()) {
2156 errorMessage = QStringLiteral(
"Cannot commit '%1': %2")
2157 .arg(fileName, file.errorString());
2166 QString &errorMessage)
2168 errorMessage.clear();
2170 QFile file(fileName);
2171 if (!file.open(QIODevice::ReadOnly)) {
2172 errorMessage = QStringLiteral(
"Cannot open '%1': %2")
2173 .arg(fileName, file.errorString());
2177 QJsonParseError parseError;
2178 const QJsonDocument jsonDocument = QJsonDocument::fromJson(file.readAll(), &parseError);
2179 if (parseError.error != QJsonParseError::NoError) {
2180 errorMessage = QStringLiteral(
"JSON parse error at offset %1: %2")
2181 .arg(parseError.offset)
2182 .arg(parseError.errorString());
2186 if (!jsonDocument.isObject()) {
2187 errorMessage = QStringLiteral(
"Experiment JSON root must be an object.");
2191 return fromJson(jsonDocument.object(), document, errorMessage);
static bool fromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs from json.
static QJsonObject toJson(const ExperimentDocument2D &document)
Performs to json.
static bool saveFile(const QString &fileName, const ExperimentDocument2D &document, QString &errorMessage)
Saves file.
static bool loadFile(const QString &fileName, ExperimentDocument2D &document, QString &errorMessage)
Loads file.
static QString formatId()
Performs format id.
Implements the Potential Scene2D component.
std::uint64_t add(PotentialObject2D object)
Performs add.
bool empty() const noexcept
Performs empty.
const std::vector< PotentialObject2D > & objects() const noexcept
Performs objects.
static bool validateConfig(const QuantumAharonovBohm2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateConfig(const QuantumAndersonInitialState2DConfig &config, std::string *reason=nullptr)
Validates config.
static bool validateConfig(const QuantumBackflow2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateConfig(const QuantumBerryLoop2DConfig &config, const QuantumBerryTrap2D &trap, const char **reason=nullptr) noexcept
Validates config.
static bool identifyTrap(const PotentialScene2D &scene, QuantumBerryTrap2D &trap, const char **reason=nullptr) noexcept
Returns identify trap.
static bool validateConfig(const QuantumHallEdge2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateInitialState(const QuantumKapitzaDiracInitialState2DConfig &config, std::string *reason=nullptr)
Validates initial state.
static bool validateConfig(const QuantumKapitzaDirac2DConfig &config, double hbar, std::string *reason=nullptr)
Validates config.
static bool validateConfig(const QuantumKickedRotor2DConfig &config, std::string *reason=nullptr)
Validates config.
static bool validateInitialState(const QuantumKickedRotorInitialState2DConfig &config, std::string *reason=nullptr)
Validates initial state.
static bool validateConfig(const QuantumKleinTunneling2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateConfig(const QuantumLandau2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateConfig(const QuantumLoschmidt2DConfig &config, const char **reason=nullptr) noexcept
Validates config.
static bool validateInitialState(const QuantumMoshinskyInitialState2DConfig &config, const char **reason=nullptr) noexcept
Validates initial state.
static bool validateConfig(const PotentialScene2D &scene, const QuantumMoshinsky2DConfig &config, QuantumMoshinskyGeometry2D *geometry=nullptr, const char **reason=nullptr) noexcept
Validates config.
static bool validateConfig(const QuantumScarConfig2D &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateConfig(const QuantumTalbotInitialState2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateConfig(const QuantumVortexInitialState2DConfig &config, std::string *reason=nullptr)
Validates config.
static bool validateConfig(const QuantumZeno2DConfig &config, std::string *reason=nullptr)
Validates config.
static bool validateInitialState(const QuantumZenoInitialState2DConfig &config, std::string *reason=nullptr)
Validates initial state.
static bool validateConfig(const QuantumZitterbewegung2DConfig &config, std::string *reason=nullptr) noexcept
Validates config.
static bool validateEnsembleConfig(const RamseyEnsemble2DConfig &config) noexcept
Validates ensemble config.
static bool validatePeriodic(const PotentialScene2D &scene, const PeriodicPotentialDrive2DConfig &config) noexcept
Validates periodic.
static bool validateSweep(const PotentialScene2D &scene, const LinearPotentialSweep2DConfig &config) noexcept
Validates sweep.
static bool validateRamsey(const PotentialScene2D &scene, const RamseyPulseSequence2DConfig &config) noexcept
Validates ramsey.
static bool validate(const PotentialScene2D &scene, const QuantumQuench2DConfig &config) noexcept
Performs validate.
Declares the schema-28 experiment persistence document and JSON conversion API.
QJsonObject quantumBerryToJson(const ExperimentDocument2D &document)
Performs quantum berry to json.
QJsonObject andersonInitialStateToJson(const ExperimentDocument2D &document)
Performs anderson initial state to json.
bool kickedRotorInitialStateFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs kicked rotor initial state from json.
QJsonObject quantumHallEdgeToJson(const ExperimentDocument2D &document)
Performs quantum hall edge to json.
bool quantumBerryFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum berry from json.
QJsonObject quantumZitterbewegungToJson(const ExperimentDocument2D &document)
Performs quantum zitterbewegung to json.
bool quantumKapitzaDiracFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum kapitza dirac from json.
QJsonObject kapitzaDiracInitialStateToJson(const ExperimentDocument2D &document)
Performs kapitza dirac initial state to json.
QJsonObject periodicDriveToJson(const ExperimentDocument2D &document)
Performs periodic drive to json.
QJsonObject quantumMoshinskyToJson(const ExperimentDocument2D &document)
Performs quantum moshinsky to json.
QJsonObject quantumZenoToJson(const ExperimentDocument2D &document)
Performs quantum zeno to json.
bool linearSweepFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs linear sweep from json.
QJsonObject quantumBackflowToJson(const ExperimentDocument2D &document)
Performs quantum backflow to json.
QJsonObject quantumKleinTunnelingToJson(const ExperimentDocument2D &document)
Performs quantum klein tunneling to json.
QJsonObject potentialSceneToJson(const ExperimentDocument2D &document)
Performs potential scene to json.
QString potentialTypeName(PotentialObjectType2D type)
Performs potential type name.
bool finiteJsonNumber(const QJsonObject &json, const char *name, float &value)
Performs finite json number.
QJsonObject talbotInitialStateToJson(const ExperimentDocument2D &document)
Performs talbot initial state to json.
bool quantumZenoFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum zeno from json.
bool measurementCollapseFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Measures ment collapse from json.
bool quantumLoschmidtFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum loschmidt from json.
bool quantumAharonovBohmFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum aharonov bohm from json.
QJsonObject kickedRotorInitialStateToJson(const ExperimentDocument2D &document)
Performs kicked rotor initial state to json.
bool quantumHallEdgeFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum hall edge from json.
QJsonObject quantumQuenchToJson(const ExperimentDocument2D &document)
Performs quantum quench to json.
bool potentialSceneFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs potential scene from json.
bool ramseySequenceFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs ramsey sequence from json.
bool quantumMoshinskyFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum moshinsky from json.
QJsonObject quantumScarToJson(const ExperimentDocument2D &document)
Performs quantum scar to json.
QJsonObject quantumZenoInitialStateToJson(const ExperimentDocument2D &document)
Performs quantum zeno initial state to json.
QJsonObject measurementCollapseToJson(const ExperimentDocument2D &document)
Measures ment collapse to json.
QJsonObject initialPreparationToJson(const ExperimentDocument2D &document)
Initializes ial preparation to json.
bool vortexInitialStateFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs vortex initial state from json.
bool moshinskyInitialStateFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs moshinsky initial state from json.
bool kapitzaDiracInitialStateFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs kapitza dirac initial state from json.
bool quantumQuenchFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum quench from json.
bool quantumKleinTunnelingFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum klein tunneling from json.
bool periodicDriveFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs periodic drive from json.
QJsonObject potentialObjectToJson(const PotentialObject2D &object)
Performs potential object to json.
QJsonObject quantumLoschmidtToJson(const ExperimentDocument2D &document)
Performs quantum loschmidt to json.
bool kickedRotorFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs kicked rotor from json.
QJsonObject linearSweepToJson(const ExperimentDocument2D &document)
Performs linear sweep to json.
bool talbotInitialStateFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs talbot initial state from json.
bool potentialTypeFromName(const QString &name, PotentialObjectType2D &type)
Performs potential type from name.
bool quantumZitterbewegungFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum zitterbewegung from json.
QJsonObject vortexInitialStateToJson(const ExperimentDocument2D &document)
Performs vortex initial state to json.
QJsonObject moshinskyInitialStateToJson(const ExperimentDocument2D &document)
Performs moshinsky initial state to json.
QJsonObject quantumLandauToJson(const ExperimentDocument2D &document)
Performs quantum landau to json.
bool potentialObjectFromJson(const QJsonObject &json, PotentialObject2D &object, QString &errorMessage, int index)
Performs potential object from json.
bool quantumBackflowFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum backflow from json.
bool andersonInitialStateFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs anderson initial state from json.
bool quantumZenoInitialStateFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum zeno initial state from json.
QJsonObject quantumAharonovBohmToJson(const ExperimentDocument2D &document)
Performs quantum aharonov bohm to json.
bool initialPreparationFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Initializes ial preparation from json.
bool quantumLandauFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum landau from json.
bool ramseyEnsembleFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs ramsey ensemble from json.
QJsonObject kickedRotorToJson(const ExperimentDocument2D &document)
Performs kicked rotor to json.
QJsonObject ramseyEnsembleToJson(const ExperimentDocument2D &document)
Performs ramsey ensemble to json.
QJsonObject ramseySequenceToJson(const ExperimentDocument2D &document)
Performs ramsey sequence to json.
bool quantumScarFromJson(const QJsonObject &json, ExperimentDocument2D &document, QString &errorMessage)
Performs quantum scar from json.
QJsonObject quantumKapitzaDiracToJson(const ExperimentDocument2D &document)
Performs quantum kapitza dirac to json.
TimePotentialParameter2D
Enumerates the supported Time Potential Parameter2D values.
PotentialObjectType2D
Enumerates the supported Potential Object Type2D values.
Serializable experiment document used by QPE schema 28.
QuantumVortexInitialState2DConfig vortexInitialState
QMap< QString, QVariant > controls
QuantumTalbotInitialState2DConfig talbotInitialState
PotentialScene2D potentialScene
QuantumZeno2DConfig quantumZeno
QuantumBackflow2DConfig quantumBackflow
QuantumLoschmidt2DConfig quantumLoschmidt
int initialPreparationMode
LinearPotentialSweep2DConfig linearSweep
double collapseResolution
QuantumLandau2DConfig quantumLandau
QuantumScarConfig2D quantumScar
QuantumKickedRotor2DConfig kickedRotor
PeriodicPotentialDrive2DConfig periodicDrive
QuantumAharonovBohm2DConfig quantumAharonovBohm
static const int CurrentSchemaVersion
QuantumBerryLoop2DConfig quantumBerry
QuantumMoshinsky2DConfig quantumMoshinsky
RamseyEnsemble2DConfig ramseyEnsemble
QuantumKapitzaDiracInitialState2DConfig kapitzaDiracInitialState
QuantumZitterbewegung2DConfig quantumZitterbewegung
QuantumHallEdge2DConfig quantumHallEdge
QuantumMoshinskyInitialState2DConfig moshinskyInitialState
QuantumAndersonInitialState2DConfig andersonInitialState
QuantumKapitzaDirac2DConfig quantumKapitzaDirac
bool potentialSceneActive
RamseyPulseSequence2DConfig ramseySequence
QuantumKleinTunneling2DConfig quantumKleinTunneling
QuantumZenoInitialState2DConfig quantumZenoInitialState
QuantumKickedRotorInitialState2DConfig kickedRotorInitialState
QuantumQuench2DConfig quench
double boundRelativePhaseDegrees
std::uint64_t targetObjectId
TimePotentialParameter2D parameter
TimePotentialParameter2D parameter
std::uint64_t targetObjectId
Data structure used by the Potential Object2D component.
PotentialObjectType2D type
bool valid() const noexcept
Performs valid.
double relativePhaseDegrees
double relativePhaseDegrees
double fastAmplitudeRatio
Data structure used by the Quantum Berry Trap2D component.
double latticePhaseDegrees
std::uint64_t shutterObjectId
std::uint64_t targetObjectId
TimePotentialParameter2D parameter
double orbitBandHalfWidth
double firstMeasurementTime
double relativePhaseDegrees
std::uint64_t targetObjectId
double echoPulsePhaseDegrees
double firstPulsePhaseDegrees
double secondPulsePhaseDegrees
TimePotentialParameter2D parameter
double freeEvolutionDuration