\(\renewcommand\AA{\unicode{x212B}}\)

FindUBFromScatteringPlane v1

Summary

Properties

Name

Direction

Type

Default

Description

Vector1

Input

dbl list

Mandatory

First vector in the scattering plane in reciprocal lattice units - i.e. H,K,L

Vector2

Input

dbl list

Mandatory

Second vector in the scattering plane in reciprocal lattice units - i.e. H,K,L

PeaksWorkspace

Input

IPeaksWorkspace

Mandatory

PeaksWorkspace with 1 peak in the scattering plane, if more than 1 peak is providedthe first peak in the Workspace is chosen

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 Parameter alpha

beta

Input

number

90

Lattice Parameter beta

gamma

Input

number

90

Lattice Parameter gamma

Description

Given 2 vectors defining a scattering plane, 1 peak and lattice parameters this algorithm calculates a UB matrix that best maps the Qs calculated from hkl and Qs measured. Angle is found by minimising the norm(qsample_predicted-qsample_observed). The order of the two input vectors dictates the sign of the orthogonal direction produced by the cross-product - however the resulting UB matrices are equivalent

Usage

Example:

inst_ws = LoadEmptyInstrument(Filename="SXD_Definition.xml", OutputWorkspace="empty_SXD")
peaks1 = CreatePeaksWorkspace(InstrumentWorkspace=inst_ws, NumberOfPeaks=0, OutputWorkspace="peaks1")
SetUB(peaks1, u=[1, -0.83, 0], v=[0.8, 1, 0], a=5.4, b=5.4, c=5.4, alpha=90, beta=90, gamma=90)
AddPeakHKL(peaks1, [2, 2, 0])
ClearUB(peaks1)
FindUBFromScatteringPlane(Vector1=[1, -1, 0], Vector2=[1, 1, 0], a=5.4, b=5.4, c=5.4, alpha=90, beta=90, gamma=90, PeaksWorkspace=peaks1)
print(np.round(peaks1.sample().getOrientedLattice().getUB(),4))

Output:

[[ 0.1183  0.1425 -0.    ]
 [ 0.      0.      0.1852]
 [ 0.1425 -0.1183  0.    ]]

Categories: AlgorithmIndex | Crystal\UBMatrix

Source

Python: FindUBFromScatteringPlane.py