ReorientUnitCell v1¶
Summary¶
Select the unit cell most aligned to goniometer axes.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
|---|---|---|---|---|
PeaksWorkspace |
InOut |
IPeaksWorkspace |
Mandatory |
The peaks workspace to reorient (modified in place). |
Tolerance |
Input |
number |
0.12 |
Indexing tolerance for algorithm TransformHKL. |
CrystalSystem |
Input |
string |
Monoclinic |
Crystal system. Allowed values: [‘Cubic’, ‘Hexagonal’, ‘Tetragonal’, ‘Trigonal’, ‘Orthorhombic’, ‘Monoclinic’] |
LatticeSystem |
Input |
string |
Rhombohedral |
Lattice system (for Trigonal: Rhombohedral or Hexagonal). Defaults to CrystalSystem value. Allowed values: [‘Rhombohedral’, ‘Hexagonal’] |
Description¶
ReorientUnitCell finds the orientation of the reciprocal lattice vectors \((\vec{a^{*}}, \vec{b^{*}}, \vec{c^{*}})\) such that \(\vec{a^{*}}\) is aligned as closely as possible with the beam direction (Z-axis in the laboratory frame of reference). Thinking of the orthonormal reciprocal basis \((\vec{u^{*}}, \vec{v^{*}}, \vec{w^{*}})\) resulting from transforming the reciprocal lattice vectors by the Busing matrix \(B\), the algorithm will try the following alignment:
align \(\vec{u^{*} \equiv \vec{a^{*}}\) with the neutron beam ( \(Z\) axis)
align \(\vec{v^{*}}\) with the horizontal axis ( \(X\) axis)
align \(\vec{w^{*}}\) with the vertical axis ( \(Y\) axis)
Matrix \(U\) describes the rotation transforming the orthonormal reciprocal basis to the laboratory frame of reference \((\vec{x}, \vec{y}, \vec{z})\). For the previous alignment, we have:
where matrix \(R\) is the particular \(U\) matrix representing this alignment.
Starting from some initial orientation of the crystal, denoted by transformation matrix \(U_0 \cdot B\), the algorithm will try to find an orientation \(U \cdot B\) such that \(U \cdot B \approx R \cdot B\). This is accomplished by applying the proper point symmetry operations \(S\) (rotations) of the lattice system.
The algorithm selects the rotation \(S\) such that composite rotation \(R^{-1} \cdot U\) is as close as possible to the identity matrix \(I\). The similarity to the identity matrix is quantified by the angle of rotation \(\theta\), which can be calculated from its trace:
Minimizing \(\theta\) is therefore equivalent to maximizing this trace.
Note: The triclinic crystal system has no symmetry operations other than the identity, so no reorientation is possible. Hence, this algorithm does not support triclinic crystals.
Usage¶
Note
To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.
Example - ReorientUnitCell:
import numpy as np
def getuVector():
ol = mtd['peaks'].sample().getOrientedLattice()
return "(" + ', '.join([f"{x:.1f}" for x in ol.getuVector()]) + ")"
filename = 'TOPAZ_Monoclinic_P_5sig.integrate'
LoadIsawPeaks(Filename=filename, OutputWorkspace='peaks')
FindUBUsingIndexedPeaks(PeaksWorkspace='peaks')
ol = mtd['peaks'].sample().getOrientedLattice()
# U represents a 120 degree rotation around axis <1 1 -1>
U = np.array([[0, 1, 0], [0, 0, -1], [-1, 0, 0]], dtype=float)
SetUB(Workspace='peaks', UB=(U @ ol.getB()).flatten().tolist())
IndexPeaks(PeaksWorkspace='peaks', CommonUBForAll=True)
print(f"(before) u = {getuVector()}")
ReorientUnitCell(PeaksWorkspace='peaks', CrystalSystem='Monoclinic')
print(f"(after) u = {getuVector()}")
Output:
(before) u = (-9.2, 0.0, 0.0)
(after ) u = (9.2, 0.0, 0.0)
Categories: AlgorithmIndex | Crystal\UBMatrix
Source¶
Python: ReorientUnitCell.py