CalculateUMatrix v1

Summary

Calculate the U matrix from a peaks workspace, given lattice parameters.

See Also

SetUB

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,α,β,γ), 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

(1)UB(hikili)=Qgon,i

For simplicity, we define

(2)Qhkl,i=B(hikili)

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

(3)i|UQhkl,iQgon,i|2=i(|UQhkl,i|2+|Qgon,i|22UQhkl,iQgon,i)

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

(4)i(UQhkl,iQgon,i)

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

(5)i(UQhkl,iQgon,i)=0.5(uqhkl,iu)qgon,i +0.5qgon,i(uqhkl,iu)

We define matrices

(6)Hi=(0qhkl,i,xqhkl,i,yqhkl,i,zqhkl,i,x0qhkl,i,zqhkl,i,yqhkl,i,yqhkl,i,z0qhkl,i,xqhkl,i,zqhkl,i,yqhkl,i,x0)

and

(7)Si=(0qgonl,i,xqgon,i,yqgon,i,zqgon,i,x0qgon,i,zqgon,i,yqgon,i,yqgon,i,z0qgon,i,xqgon,i,zqgon,i,yqgon,i,x0)

Then, we can rewrite equation (5) using matrices 3, 4:

(8)i(UQhkl,iQgon,i)=(wxyz)iHiSi(wxyz)

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:

(9)(w,x,y,z)=δ0ν0+δ1ν1+δ2ν2+δ3ν3
(10)(wxyz)HS(wxyz)=δ02ν0HSν0+δ12ν1HSν1+δ22ν2HSν2+δ3ν3HSν3
(11)=δ02ϵ0+δ12ϵ1+δ22ϵ2+δ32ϵ3

where u is a unit quaternion, δ02+δ12+δ22+δ32=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

Source

C++ header: CalculateUMatrix.h

C++ source: CalculateUMatrix.cpp