\(\renewcommand\AA{\unicode{x212B}}\)
CalculateUMatrix v1¶
Summary¶
Calculate the U matrix from a peaks workspace, given lattice parameters.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
PeaksWorkspace |
InOut |
IPeaksWorkspace |
Mandatory |
An input workspace. |
a |
Input |
number |
Mandatory |
Lattice parameter a |
b |
Input |
number |
Mandatory |
Lattice parameter b |
c |
Input |
number |
Mandatory |
Lattice parameter c |
alpha |
Input |
number |
Mandatory |
Lattice parameter alpha |
beta |
Input |
number |
Mandatory |
Lattice parameter beta |
gamma |
Input |
number |
Mandatory |
Lattice parameter gamma |
Description¶
Given a set of peaks (Q in the goniometer frame, HKL values), and given lattice parameters \((a,b,c,\alpha,\beta,\gamma)\), it will try to find the U matrix, using least squares approach and quaternions 1. Units of length are in in \(\rm \AA\), angles are in degrees.
The algorithm calculates first the B matrix according to Busing and Levi.
Given a set of peaks in the reference frame of the inner axis of the goniometer, \(\rm Q_{gon}\), indexed by \((h_i, k_i, l_i)\), we want to find the U matrix that maps peaks in the reciprocal space of the sample to the peaks in the goniometer frame
For simplicity, we define
In the real world, such a matrix is not always possible to find. Therefore we just try minimize the difference between the two sets of p
In equation (3), \(\left|\rm U \rm Q_{hkl,i}\right|^2 = |\rm Q_{hkl,i}|^2\), so the first two terms on the left side are U independent. Therefore we want to maximize
We are going to write the scalar product of the vectors in terms of quaternions 2. We define \(q_{hkl,i} = \left(0, Q_{hkl,i}\right)\), \(q_{gon,i} = \left(0, Q_{gon,i}\right)\) and the rotation U is described by quaternion \(u = \left(w,x,y,z\right)\)
Then equation (4) will be written as
We define matrices
and
Then, we can rewrite equation (5) using matrices 3, 4:
The problem of finding \(\left(w,x,y,z\right)\) that maximizes the sum can now be rewritten in terms of eigenvectors of \(HS= \sum_i \left(H_i S_i\right)\) . Let \(\epsilon_j\) and \(\nu_j\) be the eigenvalues and corresponding eigenvectors of \(HS\), with \(\epsilon_0 > \epsilon_1 > \epsilon_2 > \epsilon_3\). We can write any vector \((w,x,y,z)\) as a linear combination of the eigenvectors of \(HS\):
where \(u\) is a unit quaternion, \(\delta_0^2 + \delta_1^2 +\delta_2^2 +\delta_3 ^2=1\) (12)
Then the sum in equation (11) is maximized for \(\epsilon_0 =1, \epsilon_1 =0, \epsilon_2 =0 \epsilon_3 =0\)
Therefore U is the rotation represented by the quaternion \(u\), which is the eigenvector corresponding to the largest eigenvalue of \(HS\).
For more information see the documentation for UB matrix.
Categories: AlgorithmIndex | Crystal\UBMatrix
Source¶
C++ header: CalculateUMatrix.h
C++ source: CalculateUMatrix.cpp