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

SetUB v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Set the UB matrix, given either lattice parametersand orientation vectors or the UB matrix elements

See Also

FindUBUsingFFT, FindUBUsingIndexedPeaks, FindUBUsingLatticeParameters, FindUBUsingMinMaxD

Properties

Name

Direction

Type

Default

Description

Workspace

InOut

Workspace

Mandatory

An input workspace.

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 (degrees)

beta

Input

number

90

Lattice parameter beta (degrees)

gamma

Input

number

90

Lattice parameter gamma(degrees)

u

Input

dbl list

1,0,0

Vector along k_i, when goniometer is at 0

v

Input

dbl list

0,1,0

In plane vector perpendicular to k_i, when goniometer is at 0

UB

Input

dbl list

0,0,0,0,0,0,0,0,0

UB Matrix

MDSampleNumber

Input

number

Optional

For an MD workspace, the sample number to wich to attach an oriented lattice (starting from 0). No number, or negative number, means that it will copy to all samples

Description

The algorithms will attach an OrientedLattice object to a sample in the workspace. For MD workspaces, you can select to which sample to attach it. If nothing entered, it will attach to all. If bad number is entered, it will attach to first sample.

If UB matrix elements are entered, lattice parameters and orientation vectors are ignored. The algorithm will throw an exception if the determinant is 0. If the UB matrix is all zeros (default), it will calculate it from lattice parameters and orientation vectors (MSlice and Horace style). The algorithm will throw an exception if u and v are collinear, or one of them is very small in magnitude.

Usage

# create a workspace (or you can load one)
ws = CreateSingleValuedWorkspace(5)

#set a UB matrix using the vector along k_i as 1,1,0, and the 0,0,1 vector in the horizontal plane
SetUB(ws, a=5, b=6, c=7, alpha=90, beta=90, gamma=90, u="1,1,0", v="0,0,1")

#check that it works
from numpy import array, array_str
mat = array(ws.sample().getOrientedLattice().getUB())
print("UB matrix")
print(array_str(mat, precision=3, suppress_small=True))

Output:

 UB matrix
 [[...     ...     0.143]
  [ 0.128 -0.128  ...   ]
  [ 0.154  0.107 ...   ]]

Categories: AlgorithmIndex | Crystal\UBMatrix

Source

C++ header: SetUB.h

C++ source: SetUB.cpp