rugnux: a cell given with -C is matched in any equivalent description
Every candidate the indexer forms is Niggli-reduced and primitive; the reference cell was compared against them exactly as typed. For a centred lattice those are different numbers entirely - a conventional F-cubic cell reduces to a rhombohedron with 60-degree angles, a centred monoclinic cell to axes it shares none of - so the true candidate failed the 5% test and the run reported that it had found no lattice. A user who supplied the cell as it is published was worse off than one who supplied nothing. The reference is now expanded into the primitive lattices its six numbers could stand for, one per centring, each reduced the way a candidate is; a candidate matching any of them is kept. The cell as typed stays in the set, so the indexer that returns the basis it was handed is unaffected. The cost is real and stated: a wrong cell now gets several chances to match rather than one. The controls that hold are on data - deliberately wrong cells are still refused, and every cell that worked before gives the same answer to the digit - but a synthetic lattice can be made to match through a centring hypothesis it has no right to, and no volume test tightens that without excluding a true candidate this corpus already contains. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFEJG6WBQv8th4UJFNe53N
This commit is contained in:
1 parent
78a941156b
commit
485bbeaf71
3 files changed
+86
-35
No files matched your search
@@ -246,6 +246,50 @@ TEST_CASE("FFTIndexer","[Indexing]") {
|
||||
logger.Info("Time: {} ms", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
|
||||
}
|
||||
|
||||
TEST_CASE("FFTIndexer_CentredReferenceCell","[Indexing]") {
|
||||
// A reference cell is quoted the way a deposit states it, which for a centred lattice is the
|
||||
// conventional cell - and the indexer's candidates are Niggli-reduced primitive cells, whose
|
||||
// edges that description does not have. The two descriptions of one lattice must therefore
|
||||
// select the same candidate, or the user who quotes the deposit gets no lattice at all.
|
||||
const UnitCell conventional{70.0f, 70.0f, 70.0f, 90.0f, 90.0f, 90.0f};
|
||||
const CrystalLattice primitive = CrystalLattice(conventional).ToPrimitive('F');
|
||||
const UnitCell primitive_uc = primitive.GetUnitCell();
|
||||
|
||||
std::vector<Coord> vec;
|
||||
for (int h = -3; h < 8; h++)
|
||||
for (int k = -3; k < 8; k++)
|
||||
for (int l = -3; l < 8; l++)
|
||||
vec.push_back(h * primitive.Astar() + k * primitive.Bstar() + l * primitive.Cstar());
|
||||
|
||||
auto index_with = [&](const UnitCell &reference) {
|
||||
DiffractionExperiment experiment;
|
||||
IndexingSettings settings;
|
||||
settings.Algorithm(IndexingAlgorithmEnum::FFT)
|
||||
.FFT_MaxUnitCell_A(250.0).FFT_HighResolution_A(2 * M_PI / 3.0);
|
||||
experiment.ImportIndexingSettings(settings).SetUnitCell(reference);
|
||||
std::unique_ptr<Indexer> indexer = CreateIndexer(experiment);
|
||||
REQUIRE(indexer);
|
||||
return indexer->Run(vec).lattice;
|
||||
};
|
||||
|
||||
const auto from_primitive = index_with(primitive_uc);
|
||||
const auto from_conventional = index_with(conventional);
|
||||
|
||||
REQUIRE(from_primitive.size() == 1);
|
||||
REQUIRE(from_conventional.size() == 1);
|
||||
|
||||
for (const auto &found : {from_primitive[0], from_conventional[0]}) {
|
||||
const auto uc_out = found.GetUnitCell();
|
||||
CHECK(uc_out.a == Catch::Approx(primitive_uc.a).epsilon(0.01));
|
||||
CHECK(uc_out.b == Catch::Approx(primitive_uc.b).epsilon(0.01));
|
||||
CHECK(uc_out.c == Catch::Approx(primitive_uc.c).epsilon(0.01));
|
||||
CHECK(uc_out.alpha == Catch::Approx(primitive_uc.alpha).epsilon(0.01));
|
||||
CHECK(uc_out.beta == Catch::Approx(primitive_uc.beta).epsilon(0.01));
|
||||
CHECK(uc_out.gamma == Catch::Approx(primitive_uc.gamma).epsilon(0.01));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("FFTIndexer_SpindleSeverity", "[Indexing][Spindle]") {
|
||||
// End to end through the real indexer: a crystal whose shortest row lies on the spindle must
|
||||
// come back with a severity of 1 from a normal run, from a severity-only run - which must not
|
||||
|
||||
Reference in new issue
Block a user