Twinning report: decide whether a twin law is possible from the lattice
Whether a twin law can exist was read off a hard-coded list of Laue classes (4/mmm, 6/mmm, m-3m and rhombohedral -3m "holohedral", everything else eligible). That is a property of the lattice, not of the class: a C-centred orthorhombic or a monoclinic lattice with no special metric admits no twin law for mmm or 2/m either, and a pseudo-merohedral one admits a law the class says nothing about. On five pseudo-merohedral sets the report said "Twinning INDICATED - refinement needs a twin law" where the lattice admits none. TwinLawPossible asks gemmi's find_twin_laws (Le Page two-folds within 3 deg, as RfreeFlags and ReindexAmbiguity already do), and AnalyzeTwinning takes the cell to decide it; in P1 or without a cell a law stays possible, so the pre-promotion analysis and the space-group search are unchanged. Twin-like statistics (<|L|> below 0.44) above the false-operator bar where no law is possible are now reported as NO_TWIN_LAW: not a twin in this group, so the symmetry may be too high or something else narrowed the distribution. Report-only: no reflection file changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVmAWnzCmRKAXVUCdc4iNi
This commit is contained in:
1 parent
097668e674
commit
8f05793b67
6 files changed
+135
-45
No files matched your search
@@ -195,7 +195,8 @@ TEST_CASE("L-test on a P1 merge of a centred lattice", "[twinning]") {
|
||||
// A genuine holohedral crystal: no twin law exists, and its operators read as real.
|
||||
TEST_CASE("No twin is called in a genuine holohedral Laue class", "[twinning]") {
|
||||
const auto merged = MergedIn(Tetragonal("P 4 2 2", 0.0), "P 4 2 2");
|
||||
const auto r = AnalyzeTwinning(merged, gemmi::find_spacegroup_by_name("P 4 2 2"));
|
||||
const gemmi::UnitCell tetragonal(47, 47, 63, 90, 90, 90);
|
||||
const auto r = AnalyzeTwinning(merged, gemmi::find_spacegroup_by_name("P 4 2 2"), 20, nullptr, 'P', &tetragonal);
|
||||
CHECK_FALSE(r.merohedral_twinning_possible);
|
||||
CHECK(r.mean_abs_l == Catch::Approx(0.5).margin(0.03));
|
||||
CHECK_FALSE(r.twinning_suspected);
|
||||
@@ -208,8 +209,9 @@ TEST_CASE("No twin is called in a genuine holohedral Laue class", "[twinning]")
|
||||
// law exists".
|
||||
TEST_CASE("A holohedral merge under a false operator is called suspect", "[twinning]") {
|
||||
const gemmi::SpaceGroup *sg = gemmi::find_spacegroup_by_name("P 4 2 2");
|
||||
const gemmi::UnitCell tetragonal(47, 47, 63, 90, 90, 90);
|
||||
for (double alpha : {0.0, 0.2, 0.5}) {
|
||||
const auto r = AnalyzeTwinning(MergedIn(Tetragonal("P 4", alpha), "P 4 2 2"), sg);
|
||||
const auto r = AnalyzeTwinning(MergedIn(Tetragonal("P 4", alpha), "P 4 2 2"), sg, 20, nullptr, 'P', &tetragonal);
|
||||
CAPTURE(alpha);
|
||||
CHECK(r.mean_abs_l == Catch::Approx(0.375).margin(0.02));
|
||||
CHECK(r.adopted_operators_suspect);
|
||||
@@ -218,6 +220,53 @@ TEST_CASE("A holohedral merge under a false operator is called suspect", "[twinn
|
||||
}
|
||||
}
|
||||
|
||||
// Whether a twin law can exist is read off the lattice, not off a list of Laue classes: a group whose
|
||||
// lattice has a rotation the group lacks admits one, whatever the class is called.
|
||||
TEST_CASE("A twin law is possible exactly where the lattice has a rotation the group lacks", "[twinning]") {
|
||||
const auto possible = [](const char *group, const gemmi::UnitCell &cell) {
|
||||
return TwinLawPossible(cell, gemmi::get_spacegroup_by_name(group));
|
||||
};
|
||||
// Merohedral: a tetragonal lattice under a group of lower Laue class than its holohedry.
|
||||
CHECK(possible("P 4", gemmi::UnitCell(47, 47, 63, 90, 90, 90)));
|
||||
CHECK_FALSE(possible("P 4 2 2", gemmi::UnitCell(47, 47, 63, 90, 90, 90)));
|
||||
// Orthorhombic: no law on a general metric - mmm is the lattice's own holohedry - and a law where
|
||||
// the C-centred cell is pseudo-hexagonal (b = a sqrt(3)).
|
||||
CHECK_FALSE(possible("C 2 2 21", gemmi::UnitCell(56, 157, 143, 90, 90, 90)));
|
||||
CHECK(possible("C 2 2 21", gemmi::UnitCell(50, 50 * std::sqrt(3.0), 143, 90, 90, 90)));
|
||||
// Monoclinic: none on a general metric, one where beta is 90 (pseudo-merohedral).
|
||||
CHECK_FALSE(possible("P 1 21 1", gemmi::UnitCell(75, 94, 99, 90, 93.1, 90)));
|
||||
CHECK(possible("P 1 21 1", gemmi::UnitCell(55, 108, 55.3, 90, 90.0, 90)));
|
||||
// ... and within the obliquity it is read at, a degree off still counts.
|
||||
CHECK(possible("P 1 21 1", gemmi::UnitCell(54, 142, 84, 90, 91.0, 90)));
|
||||
}
|
||||
|
||||
// A twin-like <|L|> in a group the lattice admits no twin law for is not a twin in that group: it is
|
||||
// reported as such, and not as "needs a twin law". Where the lattice does admit one, it is a twin.
|
||||
TEST_CASE("Twin-like statistics where no twin law is possible", "[twinning]") {
|
||||
const gemmi::SpaceGroup *sg = gemmi::find_spacegroup_by_name("P 2 2 2");
|
||||
const auto merged = MergedIn(Tetragonal("P 2 2 2", 0.12), "P 2 2 2");
|
||||
const gemmi::UnitCell orthorhombic(47, 52, 63, 90, 90, 90);
|
||||
const gemmi::UnitCell tetragonal(47, 47, 63, 90, 90, 90);
|
||||
|
||||
const auto none = AnalyzeTwinning(merged, sg, 20, nullptr, 'P', &orthorhombic);
|
||||
INFO("<|L|> " << none.mean_abs_l);
|
||||
REQUIRE(none.mean_abs_l > 0.42);
|
||||
REQUIRE(none.mean_abs_l < 0.44);
|
||||
CHECK_FALSE(none.merohedral_twinning_possible);
|
||||
CHECK_FALSE(none.twinning_suspected);
|
||||
CHECK_FALSE(none.adopted_operators_suspect);
|
||||
CHECK(none.twin_like_without_twin_law);
|
||||
CHECK(TwinningVerdictLine(none).rfind("TWIN-LIKE, NO TWIN LAW", 0) == 0);
|
||||
|
||||
const auto law = AnalyzeTwinning(merged, sg, 20, nullptr, 'P', &tetragonal);
|
||||
CHECK(law.merohedral_twinning_possible);
|
||||
CHECK(law.twinning_suspected);
|
||||
CHECK_FALSE(law.twin_like_without_twin_law);
|
||||
|
||||
// Without a cell nothing can be ruled out.
|
||||
CHECK(AnalyzeTwinning(merged, sg).merohedral_twinning_possible);
|
||||
}
|
||||
|
||||
namespace {
|
||||
// A P1 merge whose centric reflections are centric: SyntheticMergedReflections draws every
|
||||
// intensity from the acentric distribution, which is all the searches it was written for need, but
|
||||
|
||||
Reference in new issue
Block a user