IndexAndRefine: Simple optimization was not good enough - using a non-linear solver leads to considerably better predictions.
Build Packages / build:rpm (rocky8_nocuda) (push) Failing after 5m9s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Failing after 5m12s
Build Packages / Generate python client (push) Successful in 20s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Failing after 5m37s
Build Packages / build:rpm (rocky9_nocuda) (push) Failing after 5m56s
Build Packages / Create release (push) Has been skipped
Build Packages / Build documentation (push) Successful in 45s
Build Packages / build:rpm (rocky8_sls9) (push) Failing after 8m21s
Build Packages / build:rpm (rocky8) (push) Failing after 10m24s
Build Packages / build:rpm (rocky9) (push) Failing after 10m44s
Build Packages / Unit tests (push) Failing after 5m15s
Build Packages / build:rpm (ubuntu2204) (push) Failing after 11m9s
Build Packages / build:rpm (ubuntu2404) (push) Failing after 7m13s

This commit is contained in:
2026-02-06 11:02:27 +01:00
parent aac982a239
commit 4edebe888e
4 changed files with 32 additions and 186 deletions
+32 -38
View File
@@ -93,49 +93,43 @@ void IndexAndRefine::RefineGeometryIfNeeded(DataMessage &msg, IndexAndRefine::In
if (!outcome.lattice_candidate)
return;
XtalOptimizerData data{
.geom = outcome.experiment.GetDiffractionGeometry(),
.latt = *outcome.lattice_candidate,
.crystal_system = outcome.symmetry.crystal_system,
.min_spots = experiment.GetIndexingSettings().GetViableCellMinSpots(),
.refine_beam_center = true,
.refine_distance_mm = false,
.refine_detector_angles = false,
.max_time = 0.04 // 40 ms is max allowed time for the operation
};
if (experiment.IsRotationIndexing()) {
SimpleRotXtalOptimizerData data{
.geom = outcome.experiment.GetDiffractionGeometry(),
.latt = *outcome.lattice_candidate,
.min_spots = experiment.GetIndexingSettings().GetViableCellMinSpots(),
};
if (SimpleRotXtalOptimizer(data, msg.spots)) {
outcome.lattice_candidate = data.latt;
}
} else {
XtalOptimizerData data{
.geom = outcome.experiment.GetDiffractionGeometry(),
.latt = *outcome.lattice_candidate,
.crystal_system = outcome.symmetry.crystal_system,
.min_spots = experiment.GetIndexingSettings().GetViableCellMinSpots(),
.refine_beam_center = true,
.refine_distance_mm = false,
.refine_detector_angles = false,
.max_time = 0.04 // 40 ms is max allowed time for the operation
};
data.refine_beam_center = false;
data.refine_rotation_axis = false;
data.refine_unit_cell = false;
}
if (outcome.symmetry.crystal_system == gemmi::CrystalSystem::Trigonal)
data.crystal_system = gemmi::CrystalSystem::Hexagonal;
if (outcome.symmetry.crystal_system == gemmi::CrystalSystem::Trigonal)
data.crystal_system = gemmi::CrystalSystem::Hexagonal;
switch (experiment.GetIndexingSettings().GetGeomRefinementAlgorithm()) {
case GeomRefinementAlgorithmEnum::None:
break;
case GeomRefinementAlgorithmEnum::BeamCenter:
if (XtalOptimizer(data, msg.spots)) {
outcome.experiment.BeamX_pxl(data.geom.GetBeamX_pxl())
.BeamY_pxl(data.geom.GetBeamY_pxl());
outcome.beam_center_updated = true;
}
break;
}
switch (experiment.GetIndexingSettings().GetGeomRefinementAlgorithm()) {
case GeomRefinementAlgorithmEnum::None:
break;
case GeomRefinementAlgorithmEnum::BeamCenter:
if (XtalOptimizer(data, msg.spots)) {
outcome.experiment.BeamX_pxl(data.geom.GetBeamX_pxl())
.BeamY_pxl(data.geom.GetBeamY_pxl());
outcome.beam_center_updated = true;
}
break;
}
outcome.lattice_candidate = data.latt;
outcome.lattice_candidate = data.latt;
if (outcome.beam_center_updated) {
msg.beam_corr_x = data.beam_corr_x;
msg.beam_corr_y = data.beam_corr_y;
}
if (outcome.beam_center_updated) {
msg.beam_corr_x = data.beam_corr_x;
msg.beam_corr_y = data.beam_corr_y;
}
}