RotationIndexer: Works on test lyso with consistent result to XDS!!!

This commit is contained in:
2025-11-29 18:10:09 +01:00
parent 549bb9fb5d
commit c67b4d0bb7
2 changed files with 20 additions and 16 deletions

View File

@@ -81,8 +81,6 @@ void RotationIndexer::TryIndex() {
if (!indexer_result.lattice.empty()) {
// Find lattice type
auto sym_result = LatticeSearch(indexer_result.lattice[0]);
indexed_lattice = indexer_result.lattice[0];
/*
// Run refinement
DiffractionExperiment experiment_copy(experiment);
@@ -92,16 +90,15 @@ void RotationIndexer::TryIndex() {
.crystal_system = sym_result.system,
.min_spots = experiment.GetIndexingSettings().GetViableCellMinSpots(),
.refine_beam_center = true,
.refine_distance_mm = false,
.refine_distance_mm = true,
.axis = axis_
};
if (data.crystal_system == gemmi::CrystalSystem::Trigonal)
data.crystal_system = gemmi::CrystalSystem::Hexagonal;
if (XtalOptimizer(data, v_sel)) {
if (XtalOptimizer(data, v_sel))
indexed_lattice = data.latt;
}*/
}
}

View File

@@ -416,7 +416,23 @@ bool XtalOptimizerInternal(XtalOptimizerData &data,
// Add residuals for each point
for (const auto &pt: spots) {
Eigen::Matrix3d gonio_back_rot = Eigen::Matrix3d::Identity();
Coord recip = data.geom.DetectorToRecip(pt.x, pt.y);
if (data.axis) {
auto rot = data.axis->GetTransformation(pt.image);
recip = rot * recip;
Eigen::Matrix3d Rg;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
Rg(i, j) = static_cast<double>(rot.arr()[i + j * 3]);
}
}
gonio_back_rot = Rg.transpose();
}
double h_fp = recip * vec0;
double k_fp = recip * vec1;
double l_fp = recip * vec2;
@@ -430,18 +446,9 @@ bool XtalOptimizerInternal(XtalOptimizerData &data,
if (norm_sq > tolerance * tolerance)
continue;
Eigen::Matrix3d gonio_back_rot = Eigen::Matrix3d::Identity();
if (data.axis) {
auto rot = data.axis->GetTransformation(pt.image);
Eigen::Matrix3d Rg;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
Rg(i, j) = static_cast<double>(rot.arr()[3 * i + j]);
}
}
gonio_back_rot = Rg;
}
problem.AddResidualBlock(
new ceres::AutoDiffCostFunction<XtalResidual, 3, 1, 1, 1, 3, 3, 3>(