-S without -C fixes only the space group: the cell is still found and reduced

A space group given alone no longer fixes the lattice. The first pass asks the
sub-lattice / twin-composite hypotheses and the long-axis hypothesis as in a
run without -S, and a lattice they adopt is then put in the fixed group's own
Bravais class (LatticeSearchForGroup), as the indexer does with the cell it
finds. Only a cell given with -C (with or without -S) fixes the lattice and
its setting; those runs are unchanged (.hkl byte-identical on the checks).

On the private triclinic small-molecule set, -S P1 landed on 2x/4x supercells;
it now gives the primitive cell on 5 of 7 datasets (I/sigma up to 2-5x higher).
-S P12/c1 on dnba, refused in rc187 for a metric violation, now merges.
The doubled-cell hypothesis stays off under -S: without the space-group
search there is nothing to re-express its doubled cell on its centred lattice,
and adopting it doubled the primitive cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-11-16 07:51:44 +01:00
1 parent 1f5427008d
commit 1f8f0c8a6f
2 files changed
+22 -7

No files matched your search

+2 -2
View File
@@ -283,10 +283,10 @@ For very long axes the direction grid's angular resolution binds well below 500
| `--force-still` | Treat a rotation (goniometer) dataset as independent stills instead of rotation; several masters are then read as one stills run |
| `-X, --indexing-algorithm <txt>` | `Auto` (default) \| `FFT` \| `cuFFT` \| `FFTW` \| `FFBIDX` \| `None`, case-insensitive. `FFT` is the de-novo FFT search, on the GPU (cuFFT) where there is one and `--no-gpu` is not given, otherwise on the CPU (FFTW); `cuFFT` and `FFTW` name one implementation each (`FFTW` keeps its old name: the CPU transforms are pocketfft's); `cuFFT` needs a GPU and is refused without one. `FFBIDX` (known cell, `-C`) runs on the GPU where there is one and otherwise on the CPU. `Auto` takes `FFBIDX` on stills with a known cell, and `FFT` otherwise. `FFBIDX` without a cell (`-C`, or one from `-z`) resolves to `None` and indexes nothing, with no error. On rotation data `-X` is not consulted: the FFT search runs on the GPU where there is one and on the CPU otherwise, so `Auto`, `FFT`, `cuFFT` (with a GPU) and `FFTW` (without one, or under `--no-gpu`) are accepted and any other value stops the run at indexing; `FFBIDX` and `None` are for stills |
| `-F` | Short for `-X FFT`, kept for old command lines |
| `-C, --unit-cell <cell>` | Reference unit cell `"a,b,c,alpha,beta,gamma"` (required by `ffbidx`). On rotation data it also widens the FFT search to cover the cell given, at both ends: the longest axis looked for is raised to reach it, and `--fft-min-unit-cell` is lowered to admit it. A candidate that is an integer supercell of the cell given (a twin's coincidence lattice, a row taken at a multiple of its length) is stepped down to it. On stills the run always uses it: the geometry refinement takes it as a prior (1 % on the lengths, 1° on the angles the crystal system leaves free), and the log warns - with both numbers - where the frames refine its shape more than 3 % / 3° away, or where a sample of frames indexed de novo puts materially more spots on the lattice than the cell given ([§7.7](CPU_DATA_ANALYSIS_INDEXING.md#77-stills-a-given-cell-and-the-detector-modules)). Without `-S` the cell fixes the crystal system, read from the angles as typed: an angle is 90° or 120° only where it is typed so (`90` or `90.00`, not `90.03`). Three 90s: orthorhombic, or tetragonal / cubic where the lengths are equal within tolerance; two 90s and a 120: hexagonal (or rhombohedral in hexagonal axes); two 90s: monoclinic; three equal angles: rhombohedral; anything else: triclinic, and the run behaves as with `-S P1`. The lattice is indexed in that system, never above or below it, on the axes of the cell as typed (an F- or R-centred one in its conventional setting), and only the space group within it is searched |
| `-C, --unit-cell <cell>` | Reference unit cell `"a,b,c,alpha,beta,gamma"` (required by `ffbidx`). On rotation data it also widens the FFT search to cover the cell given, at both ends: the longest axis looked for is raised to reach it, and `--fft-min-unit-cell` is lowered to admit it. A candidate that is an integer supercell of the cell given (a twin's coincidence lattice, a row taken at a multiple of its length) is stepped down to it. On stills the run always uses it: the geometry refinement takes it as a prior (1 % on the lengths, 1° on the angles the crystal system leaves free), and the log warns - with both numbers - where the frames refine its shape more than 3 % / 3° away, or where a sample of frames indexed de novo puts materially more spots on the lattice than the cell given ([§7.7](CPU_DATA_ANALYSIS_INDEXING.md#77-stills-a-given-cell-and-the-detector-modules)). Without `-S` the cell fixes the crystal system, read from the angles as typed: an angle is 90° or 120° only where it is typed so (`90` or `90.00`, not `90.03`). Three 90s: orthorhombic, or tetragonal / cubic where the lengths are equal within tolerance; two 90s and a 120: hexagonal (or rhombohedral in hexagonal axes); two 90s: monoclinic; three equal angles: rhombohedral; anything else: triclinic, and the run behaves as with this cell and `-S P1`. The lattice is indexed in that system, never above or below it, on the axes of the cell as typed (an F- or R-centred one in its conventional setting), and only the space group within it is searched |
| `--fft-min-unit-cell <num>` | Shortest cell axis the FFT search accepts, Å (default: 10; accepted 5-40). A candidate with a shorter axis is discarded — but on rotation data a row shorter than the floor, down to 3 Å, is recognised under the multiple of it the search reports past the floor, so a small-molecule cell is indexed without this flag. `-C` lowers the floor on its own to cover the cell given. On stills a crystal below the floor cannot be indexed unless this is lowered |
| `--min-indexed-spots <num>` | Spots a frame must have on the lattice before it counts as indexed (default: 6, minimum 4). It sets the reported indexing rate and the count the rotation first pass ranks candidate lattices by; whether the run has a lattice at all is decided on the pooled spots instead ([§4.1](CPU_DATA_ANALYSIS_INDEXING.md#41-indexed-spot-decision-inlier-test)), and integration is not gated by it |
| `-S, --space-group <num\|symbol>` | Space group number (`96`) or Hermann-Mauguin symbol (`P43212`) — for indexing and scaling. On serial stills whose group admits two indexings, it also lets the crystals be put on one from the data ([the indexing ambiguity](RUGNUX_ADVANCED.md#the-indexing-ambiguity)). A fixed group fixes the lattice: indexing puts the crystal in the group's own Bravais class and nothing promotes, demotes, reduces or doubles it afterwards. A primitive group on a lattice with no primitive cell of its system (P2 on a C-centred monoclinic crystal, P3 on a rhombohedral one) is merged on the centred cell, and the positions the centring extinguishes are kept (they read about zero). With `-C` as well, the cell is written on the given cell's axes |
| `-S, --space-group <num\|symbol>` | Space group number (`96`) or Hermann-Mauguin symbol (`P43212`) — for indexing and scaling. On serial stills whose group admits two indexings, it also lets the crystals be put on one from the data ([the indexing ambiguity](RUGNUX_ADVANCED.md#the-indexing-ambiguity)). Without `-C` the group fixes only the symmetry, not the cell: the lattice is found and reduced as in a run without `-S` (a supercell the indexer returns is still stepped down to the crystal's cell, a long axis is still looked for), indexing puts the crystal in the group's own Bravais class, nothing promotes or demotes it past that class, and the group is applied to the cell found, in its conventional setting. With `-C` as well, the lattice and its setting are the ones given and nothing reduces or doubles the cell. A primitive group on a lattice with no primitive cell of its system (P2 on a C-centred monoclinic crystal, P3 on a rhombohedral one) is merged on the centred cell, and the positions the centring extinguishes are kept (they read about zero). With `-C`, the cell is written on the given cell's axes |
| `-r, --geom-refine <txt>` | Geometry refinement: `none` \| `orientation` \| `beam_and_lattice` (default; on rotation data restrained toward the sweep's geometry, [§7.4](CPU_DATA_ANALYSIS_INDEXING.md#74-multi-stage-tightening-of-inlier-tolerance)) \| `flex` (try all three per image, keep whichever indexes the most spots; alias `multi`) |
| `-R, --two-pass-rotation[=num]` | Two-pass offline rotation indexing (default for goniometer data; optional first-pass image count, default 100) |
| `--force-rotation-lattice <vec>` | Force rotation lattice (9 floats, Å), skipping the first pass |
+20 -5
View File
@@ -212,7 +212,7 @@ void Rugnux::FirstPassRun::StartLongAxisSearch(std::unique_ptr<DiffractionExperi
}
void Rugnux::FirstPassRun::StartLongAxisCoarse() {
if (rx.cancelled_ || rx.experiment_.GetUnitCell().has_value() || rx.user_fixed_sg_)
if (rx.cancelled_ || rx.experiment_.GetUnitCell().has_value())
return;
const LongAxisReach reach = LongAxisBound();
if (!(reach.bound_A > indexing_bound_A))
@@ -273,7 +273,7 @@ void Rugnux::FirstPassRun::JoinLongAxisSpeculation() {
// Not when a cell was given: the standard pass was already sized for it (RaiseFFTBoundForKnownCell).
auto Rugnux::FirstPassRun::LongAxisHypothesis(FirstPass standing) -> FirstPass {
JoinLongAxisSpeculation();
if (rx.cancelled_ || rx.experiment_.GetUnitCell().has_value() || rx.user_fixed_sg_)
if (rx.cancelled_ || rx.experiment_.GetUnitCell().has_value())
return standing;
const auto start = std::chrono::steady_clock::now();
const LongAxisReach reach = LongAxisBound();
@@ -961,8 +961,9 @@ namespace {
}
auto Rugnux::FirstPassRun::SubLatticeHypothesis(FirstPass best) -> FirstPass {
// A space group or a cell the user fixed fixes the lattice, its volume included.
if (rx.user_fixed_sg_ || rx.experiment_.GetIndexingSettings().GetFixedLatticeSystem())
// A cell the user fixed with -C fixes the lattice, its volume included. A space group alone does
// not: the cell is still found and reduced, and the group is applied to it.
if ((rx.user_cell_ && rx.user_fixed_sg_) || rx.experiment_.GetIndexingSettings().GetFixedLatticeSystem())
return best;
// Asked again of each sub-lattice it adopts: a cell doubled along two or three axes is a sub-lattice
// of index 4 or 8, reached one halving at a time. Each cell on the way is first asked whether it is
@@ -970,9 +971,12 @@ auto Rugnux::FirstPassRun::SubLatticeHypothesis(FirstPass best) -> FirstPass {
// halving of their composite, and a halving can split the composite and lose one domain. A domain's
// cell can itself be a multiple of the true one, and is halved on as any other; the overlap it
// carries is a vector of every finer lattice in its orientation, so it holds through the halving.
bool changed = false;
for (int level = 0;; level++) {
if (best.result.has_value() && !best.result->twin_overlap.has_value())
if (best.result.has_value() && !best.result->twin_overlap.has_value()) {
best = TwinCompositeHypothesis(std::move(best));
changed |= best.result.has_value() && best.result->twin_overlap.has_value();
}
if (level == 3 || rx.cancelled_ || !best.result.has_value() || best.score <= 0)
break;
const CrystalLattice prim = best.result->lattice
@@ -1084,6 +1088,17 @@ auto Rugnux::FirstPassRun::SubLatticeHypothesis(FirstPass best) -> FirstPass {
if (!adopt)
break;
best = std::move(*sub_best);
changed = true;
}
// A space group the user fixed is applied to the cell found here as the indexer applies it to the
// cell it finds: the lattice is put in the group's own Bravais class (LatticeSearchForGroup).
if (changed && rx.user_fixed_sg_ && best.result.has_value()) {
RotationIndexerResult &r = *best.result;
if (const auto fixed = LatticeSearchForGroup(r.lattice.ToPrimitive(r.search_result.centering),
*rx.user_fixed_sg_)) {
r.search_result = *fixed;
r.lattice = fixed->conventional;
}
}
return best;
}