\(\renewcommand\AA{\unicode{x212B}}\)
FindMultipleUMatrices v1¶
Summary¶
Finds multiple UB matrices using lattice parameters  can be used to find UBs in the presence of mutiple domains, crystallites or in the presence of spurious peaks.
See Also¶
Properties¶
Name 
Direction 
Type 
Default 
Description 

PeaksWorkspace 
Input 
IPeaksWorkspace 
Mandatory 
A PeaksWorkspace containing the peaks to integrate. 
OutputWorkspace 
Output 
WorkspaceGroup 
Mandatory 
The output peak workspaces with UBs set  1 per UB requested. 
NumberOfUBs 
Input 
number 
1 
Number of UB matrices to find. 
a 
Input 
number 
1 
Lattice parameter a 
b 
Input 
number 
1 
Lattice parameter b 
c 
Input 
number 
1 
Lattice parameter c 
alpha 
Input 
number 
90 
Lattice angle alpha (in degrees) 
beta 
Input 
number 
90 
Lattice angle beta (in degrees) 
gamma 
Input 
number 
90 
Lattice angle gamma (in degrees) 
HKLTolerance 
Input 
number 
0.15 
Tolerance to index peaks in in H,K and L  see IndexPeaks for details. 
DSpacingTolerance 
Input 
number 
0.05 
Tolerance in dspacing used to try and index peaks 
AngleTolerance 
Input 
number 
1 
Tolerance (in degrees) of angle between peaks in QLab when identifying possible pairs of HKL. 
MinAngleBetweenPeaks 
Input 
number 
2 
Minimum angle in QLab (in degrees) between pairs of peaks in when calculating U matrix. 
MinAngleBetweenUB 
Input 
number 
2 
Minimum angle in degrees between u and v vectors (converted from HKL to QLab) of different UB. 
MinDSpacing 
Input 
number 
0 
Min dspacing of reflections to consider. 
MaxDSpacing 
Input 
number 
0 
Max dspacing of reflections to consider. 
Spacegroup 
Input 
string 
Spacegroup Hermann–Mauguin symbol used to determine the point group of the Laue class. 

MaxOrder 
Input 
number 
0 
Maximum order to apply ModVectors. Default = 0 
ModVector1 
Input 
string 
0.0,0.0,0.0 
Offsets for h, k, l directions 
ModVector2 
Input 
string 
0.0,0.0,0.0 
Offsets for h, k, l directions 
ModVector3 
Input 
string 
0.0,0.0,0.0 
Offsets for h, k, l directions 
OptimiseFoundUBs 
Input 
boolean 
True 
Optimise final UBs using all peaks indexed best by that UB. 
Description¶
FindMultipleUMatrices will use the lattice parameters and spacegroup provided to optimise a number (NumberOfUBs
)
of UB matrices (B is hardcoded due to the lattice parameters provided) and returns a group of peak workspaces
one for each UB, containing the peaks that are indexed most accurately by that UB.
This algorithm is useful for finding a single UB in the presence of spurious peaks, or finding multiple UBs when there are multiple domains.
The algorithm proceeds by looping over each pair of peaks in PeaksWorkspace
within the dspacing limits
(MinDSpacing
and MaxDSpacing
), trying to index them based on their dspacing and angle between the
peaks (within tolerances given by DSpacingTolerance
and AngleTolerance
). It then calculates the HKL
errors (difference in HKL residuals squared) for all peaks in PeaksWorkspace
and identifies the UBs that
index the most peaks with the highest accuracy (i.e. better than any other UB found)
Note that although the user can provide modulation vectors, these are not currently used to index pairs of peaks but are indexed by each candidate UB found and used to determine the best UBs to return.
Peaks with relatively higher dspacing are easier to index correctly, try using a smaller number of higher dspacing peaks to start.
Useage¶
Example:
from mantid.simpleapi import *
from scipy.spatial.transform import Rotation as rot
ws = LoadEmptyInstrument(InstrumentName='SXD', OutputWorkspace='empty_SXD')
axis = ws.getAxis(0)
axis.setUnit("TOF")
# create a peak tables of orthorhombic domains with lattice parameters a=4, b=5, c=10
alatt = {'a': 4, 'b': 5, 'c': 10, 'alpha': 90, 'beta': 90, 'gamma': 90}
ubs = [np.diag([1/alatt['a'], 1/alatt['b'], 1/alatt['c']])]
ubs.append(rot.from_rotvec([0,0,90], degrees=True).as_matrix() @ ubs[0])
peaks = CreatePeaksWorkspace(InstrumentWorkspace=ws, NumberOfPeaks=0, OutputWorkspace=f"peaks")
for iub, ub in enumerate(ubs):
SetUB(peaks, UB=ub)
for h in range(1, 3):
for k in range(1, 3):
for l in range(2,4):
pk = peaks.createPeakHKL([h, k ,l])
if pk.getDetectorID() > 0:
peaks.addPeak(pk)
peaks_out = FindMultipleUMatrices(PeaksWorkspace=peaks, OutputWorkspace='peaks_out', **alatt,
MinDSpacing=1.25, MaxDSpacing=3.5, Spacegroup='P m m m',
NumberOfUBs=2)
for ipk, pks in enumerate(peaks_out):
print("HKL along xaxis of QLab = ", abs(np.round(pks.sample().getOrientedLattice().getvVector())))
Output:
HKL along xaxis of QLab = [4. 0. 0.]
HKL along xaxis of QLab = [0. 5. 0.]
Categories: AlgorithmIndex  Diffraction\Reduction  Crystal\UBMatrix
Source¶
Python: FindMultipleUMatrices.py