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

OptimizeCrystalPlacement v1

Summary

This algorithm optimizes goniometer settings and sample orientation to better index the peaks.

Properties

Name

Direction

Type

Default

Description

PeaksWorkspace

Input

PeaksWorkspace

Mandatory

Workspace of Peaks with UB loaded

KeepGoniometerFixedfor

Input

int list

List of run Numbers for which the goniometer settings will NOT be changed

ModifiedPeaksWorkspace

Output

PeaksWorkspace

Mandatory

Output Workspace of Peaks with optimized sample Orientations

FitInfoTable

Output

TableWorkspace

FitInfoTable

Workspace of Results

AdjustSampleOffsets

Input

boolean

False

If true sample offsets will be adjusted to give better fits, otherwise they will be fixed as zero(def=true)

OptimizeGoniometerTilt

Input

boolean

False

Set true if main error is due to a tilted Goniometer(def=false)

Chi2overDoF

Output

number

chi squared over dof

nPeaks

Output

number

Number of Peaks Used

nParams

Output

number

Number of Parameters fit

nIndexed

Output

number

Number of new Peaks that WOULD be indexed at ‘MaxIndexingError’

MaxAngularChange

Input

number

5

Max offset in degrees from current settings(def=5)

MaxIndexingError

Input

number

0.15

Use only peaks whose fractional hkl values are below this tolerance(def=0.15)

MaxHKLPeaks2Use

Input

number

-1

If less than 0 all peaks are used, otherwise only peaks whose h,k, and l values are below the level are used(def=-1)

MaxSamplePositionChangeMeters

Input

number

0.0005

Maximum Change in Sample position in meters(def=.0005)

OutputNormalisedCovarianceMatrixOptX

Output

TableWorkspace

CovarianceInfo

The name of the TableWorkspace in which to store the final covariance matrix

Description

This algorithm basically optimizes h,k, and l offsets from an integer by varying the parameters sample positions, sample orientations ( chi,phi, and omega), and/or the tilt of the goniometer for an experiment.

If the crystal orientation matrix, UB, was created from one run, that run may not need to have its goniometer settings optimized. There is a property to list the run numbers to NOT have their goniometer settings changed. This entry is IGNORED if the tilt or sample positions are included in the optimization. In this case NONE of the goniometer angles, relative to any tilt, will be changed.

The goniometer angles displayed are relative to the tilt,i,e, phi is the rotation around the axis perpendicular to the tilted plane. The resultant PeaksWorkspace has the goniometer angles relative to the Y and Z axes at that time.

The crystal orientation matrix, UB matrix, from the PeaksWorkspace should index all the runs “very well”. Otherwise iterations that slowly build a UB matrix with corrected sample orientations may be needed.

The parameters for the tilt are GRotx, GRoty, and GRotz in degrees. The usage for this information is as follows:

\(rotate(x,GRotx)*rotate(y,GRoty)*rotate(z,GRotz)* SampleOrientation\) \(( i.e. omegaRot*chiRot*phiRot)).\)

Note: To optimize by the tilt in the goniometer and then by the angles or by the sample position, it is possible to run with one optimization, then using the resultant PeaksWorkspace for input, run another optimization.

Rerunning the same optimization with the result is also a good idea. If the first guess is very close, the optimize algorithm does try cases far away and may not get back to the best value. Check the chisquared values. If they increase, that optimization should probably not be used.

Usage

Example:

ws=LoadIsawPeaks("TOPAZ_3007.peaks")
LoadIsawUB(ws,"TOPAZ_3007.mat")
wsd = OptimizeCrystalPlacement(ws)
(wsPeakOut,fitInfoTable,chi2overDoF,nPeaks,nParams,nIndexed,covrianceInfoTable) = OptimizeCrystalPlacement(ws,AdjustSampleOffsets=True)
print("Chi2: {:.4f}".format(chi2overDoF))

Output:

Chi2: 0.0003

Categories: AlgorithmIndex | Crystal\Corrections

Source

C++ header: OptimizeCrystalPlacement.h

C++ source: OptimizeCrystalPlacement.cpp