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

AddAbsorptionWeightedPathLengths v1

Summary

Add absorption weighted path lengths to each peak in a peaks workspace.

See Also

MonteCarloAbsorption, SetSample, SaveReflections

Properties

Name

Direction

Type

Default

Description

InputWorkspace

InOut

PeaksWorkspace

Mandatory

An input/output peaks workspace that the path distances will be added to.

UseSinglePath

Input

boolean

False

Use a single path with a scatter point at the sample position

EventsPerPoint

Input

number

1000

The number of “neutron” events to generate per peak

SeedValue

Input

number

123456789

Seed the random number generator with this value

MaxScatterPtAttempts

Input

number

5000

Maximum number of tries made to generate a scattering point within the sample. Objects with holes in them, e.g. a thin annulus can cause problems if this number is too low. If a scattering point cannot be generated by increasing this value then there is most likely a problem with the sample geometry.

Description

This algorithm uses the Monte Carlo simulation (originally designed for calculating absorption corrections) to calculate the absorption weighted path length for each peak in a peaks workspace. The absorption weighted path length is used to calculate extinction corrections in single crystal diffraction.

The absorption weighted path length is also referred to as “t-bar” in some literature.

The definition of the absorption weighted path length (in cm) for each peak is:

\(\bar{t}= -100 * \frac{log{A}}{\mu(\lambda)}\)

Where A is the average attenuation factor for all simulated tracks and \(\mu\) is the attenuation coefficient (in \(m^{-1}\)) for the sample material.

The algorithm requires an input workspace with a sample defined but no sample environment. The sample must have a material and a shape defined.

By default the beam is assumed to be the a slit with width and height matching the width and height of the sample. This can be overridden using SetBeam.

The algorithm generates some statistics on the scattering angle for the simulated tracks when the log level is set to debug.

Method

The material for the sample defines the values of the cross section used to compute the attenuation coefficient and will include contributions from both the total scattering cross section & absorption cross section. This follows the Hamilton-Darwin [1], [2] approach as described by T. M. Sabine in the International Tables of Crystallography Vol. C [3].

The algorithm for calculating the attenuation factor A proceeds as follows. For each peak:

  1. look up the associated detector position and wavelength in the peaks workspace

  2. for each event in NEvents

    • generate a random point on the beam face defined by the input height & width. If the point is outside of the area defined by the face of the sample then it is pulled to the boundary of this area

    • generate a random point within the sample object as the scatter point and create a Track from the selected position on the beam face to the scatter point

    • test for intersections of the track & sample object, giving the number of subsections and corresponding distances within the object for each section, call them \(l_{1i}\). There will typically be a single intersection and subsection but for complex sample shapes it could in theory be more

    • form a second Track with the scatter position as the starting point and the direction defined by detPos - scatterPos

    • test for intersections of the track & sample object, giving the number of subsections and corresponding distances within the object for each section, call them \(l_{2i}\)

    • assume elastic scattering so that the wavelength is the same before and after scattering

    • compute the self-attenuation factor for all intersections as

      \(\prod\limits_{i} \exp(-(\mu(\lambda)l_{1i} + \mu(\lambda)l_{2i}))\) where \(\mu\) is the attenuation coefficient of the sample material

    • accumulate this wavelength-specific factor across all NEvents

  3. average the accumulated attentuation factors over NEvents and assign this as the correction factor for this \(\lambda\).

Usage

Example: A simple cylindrical sample

# load a peaks workspace from file
peaks = LoadIsawPeaks(Filename=r'Peaks5637.integrate')

SetSample(peaks,Geometry={'Shape': 'Cylinder','Height': 5.0,'Radius': 1.0,'Center': [0.,0.,0.]},
                          Material={'ChemicalFormula': 'V'})

# populate the t bar column in the peaks workspace
AddAbsorptionWeightedPathLengths(peaks)

print("Tbar for first peak {:.11f} cm".format(peaks.getPeak(0).getAbsorptionWeightedPathLength()))

Output:

Tbar for first peak 1.57247690371 cm

References

Categories: AlgorithmIndex | Crystal\Peaks

Source

C++ header: AddAbsorptionWeightedPathLengths.h

C++ source: AddAbsorptionWeightedPathLengths.cpp