Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
PeaksWorkspace | InOut | PeaksWorkspace | 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 |
Given a set of peaks (Q in the goniometer frame, HKL values), and given lattice parameters (a,b,c,α,β,γ), it will try to find the U matrix, using least squares approach and quaternions 1. Units of length are in in Å, 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, Qgon, indexed by (hi,ki,li), 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), |UQhkl,i|2=|Qhkl,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 qhkl,i=(0,Qhkl,i), qgon,i=(0,Qgon,i) and the rotation U is described by quaternion u=(w,x,y,z)
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 (w,x,y,z) that maximizes the sum can now be rewritten in terms of eigenvectors of HS=∑i(HiSi) . Let ϵj and νj be the eigenvalues and corresponding eigenvectors of HS, with ϵ0>ϵ1>ϵ2>ϵ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, δ20+δ21+δ22+δ23=1 (12)
Then the sum in equation (11) is maximized for ϵ0=1,ϵ1=0,ϵ2=0ϵ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
C++ header: CalculateUMatrix.h (last modified: 2020-03-20)
C++ source: CalculateUMatrix.cpp (last modified: 2020-04-07)