Repository navigation
unitcell: read cell_sg, find R axes, warn when the cell lacks the symmetry - #680
Merged
Merged
Conversation
…metry - unitcell(..., sgname=None): an xfab space group name, cell_sg in a .par file. It overrides symmetry for the space group and the hkls, so a name like R-3mr (rhombohedral axes) is used for the rings, not only by transformer. A lattice letter or number that does not match it is logged. unitcell_from_parameters reads cell_sg, to_par_dict writes it. - With a space group number, an R group whose cell is on rhombohedral axes now uses them. Before, 166 on a 5,5,5,70,70,70 cell gave 350 reflections with d* < 1 instead of 438. - With any space group, a warning is logged when the Laue rotations change the cell's metric (e.g. P21/c with unique axis c). - tensor_map.sym_ops_from_phase uses unitcell.cell_choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude written - careful!
Third of the sym_u PRs proposed in #675. Uses
sym_u.laue_rotationsfrom #678.cell_sgin par filesunitcell(..., sgname=None)is a new optional keyword for an xfab space group name (cell_sgin a par file). It overrides the lattice letter or number for the space group and the hkls. SoR-3mr(rhombohedral axes) now reaches the rings and indexing; before, only transformer's theory peaks used it.unitcell_from_parametersreadscell_sg, andto_par_dictwrites it. Files without it work as before.F+Fm-3m). An incompatible one (I+Fm-3m, or229+Fm-3m) logs a warning; the name wins, as in xfab.Integer R space groups on rhombohedral axes now use those axes. Results change: with
166and a (5, 5, 5, 70, 70, 70) cell, the reflections with d* < 1 go from 350, with the hexagonal-axes centring wrongly applied, to 438. Hexagonal-axes cells are unchanged.Symmetry check. When a space group is given, a warning is logged if its Laue rotations change the cell's metric tensor by more than 1e-5 (relative). Examples: P2₁/c with unique axis c, or 225 with a ≠ b. It's only a warning: xfab has only the standard settings, so such cells can't be fixed automatically. Grain and strained cells are built with
"P", so they're not checked.tensor_map.sym_ops_from_phasenow takes the axes fromunitcell.cell_choice, so there is one rule.Not changed:
cell_sgits own way.cell_sgare left for later.Tests:
test/test_cell_sg.pycovers rhombohedral and hexagonal R axes, name vs letter/number, cells without their symmetry, and the par round trip. Passes on Python 3 (numpy 1.26) and Python 2.7. In the full Python 3 suite the new warnings fired 0 times.🤖 Generated with Claude Code