Repository navigation
sym_u: Laue class rotations of any space group, from xfab - #678
Conversation
sym_u.laue_rotations(spacegroup, cell_choice) builds the rotations of a space group's Laue class from xfab.sglib, as a group acting on ubi like cubic() etc. sym_u.cartesian(grp, B) gives them as rotations of the crystal frame: (op.ubi)^-1 = U.S.B. tensor_map.sym_ops_from_phase uses them. For the 187 space groups it handled the operators are identical; the 50 with Laue class 4/m, -3, -31m, 6/m or m-3 no longer raise. A cell outside the standard setting now raises instead of returning matrices that are not rotations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_sym_u: both PRs defined CELLS; the crystal-system one is now SYSTEM_CELLS. laue_rotations(150) is compared with the fixed trigonal(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonwright
left a comment
There was a problem hiding this comment.
So I see you are making the list of proper rotations, but I didn't understand why? Doesn't a Laue group include mirrors and inversion too? Or is the purpose just to get the list of proper rotations ... presumably for some good reason. I think I miss where is this code used - it is in tensor map apparently - isn't it that we miss the list of all 11 classes in the form "trigonal", etc, together with mappings to those?
Probably OK to merge, but for now, I have not fully understood why we have this done like this. There should be ~11 Laue groups and like this they are hard-wired to xfab anyway, so non-standard settings are banned. It is deriving them from a small table but looking up the operators from a table. I suspect it could just be a small table if the tabulation is used, or the function if the the list of operators comes in
| for r in sg.sg(sgno=spacegroup, cell_choice=cell_choice).rot: | ||
| # xfab has x' = W.x, here W.T acts on the rows of ubi. | ||
| # The inversion in the Laue class makes each operation proper. | ||
| w = np.array(r, float).T * np.sign(np.linalg.det(r)) |
There was a problem hiding this comment.
Why is sign of determinant being done? You are making these all be rotations with no mirrors?
As suggested in review: laue_generators holds the generators of the 14 rotation groups (11 Laue classes, -3m1 and -31m on hexagonal axes, -3 and -3m on rhombohedral axes), using the same strings as cubic() etc, so those are the same group objects. laue_class() looks up the class of a space group in xfab. The operators xfab lists are now the test: the table gives the same groups for all 230 space groups and the rhombohedral settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude written - careful!
Second of the sym_u PRs proposed in #675. Independent of the trigonal fix PR.
sym_u.laue_rotations(spacegroup, cell_choice="standard"): rotations of a space group's Laue class, built fromxfab.sglib. These are the orientations diffraction cannot tell apart. It returns a sym_ugroup, so it works withfind_uniq_ulikecubic()etc.cell_choice="rhombohedral"covers R groups on rhombohedral axes.sym_u.cartesian(grp, B): the same operations as rotations S of the crystal frame, with (op·ubi)⁻¹ = U·S·B.tensor_map.sym_ops_from_phaseuses them. Its signature is unchanged; the private helpers it no longer needs are removed (added in 988ca39, in no release).Existing sym_u functions are unchanged.
Results change in tensor_map (KAM, GROD, grain mean orientation):
ValueErrorValueErrorTests:
op @ ubi.cartesiansatisfies the identity above.Run with numpy 1.26; not run under Python 2.7 or numpy 2.
🤖 Generated with Claude Code