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

ApplyDetailedBalanceMD v1

../_images/ApplyDetailedBalanceMD-v1_dlg.png

ApplyDetailedBalanceMD dialog.

Summary

Apply detailed balance to MDEventWorkspace

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MDEventWorkspace

Mandatory

An input MDEventWorkspace. Must be in Q_sample/Q_lab frame. Must have an axis as DeltaE

Temperature

Input

string

SampleLog variable name that contains the temperature or a number

OutputWorkspace

Output

MDEventWorkspace

Mandatory

The output MDEventWorkspace with detailed balance applied

Description

The fluctuation dissipation theorem [1,2] relates the dynamic susceptibility to the scattering function

\(\left(1-e^{-\frac{E}{k_B T}}\right) S(\mathbf{q}, E) = \frac{1}{\pi} \chi'' (\mathbf{q}, E)\)

For the MD events, the detailed balance is calculated and applied as below.

\(F = \pi(1-e^{-\frac{\Delta E}{k_B T(i)}})\)

\(I *= F\)

\(Err^2 *= F^2\)

where \(E\) is the energy transfer to the system. The algorithm assumes that the signal of the input workspace contains the scattering function \(S\). The signal of the output workspace will contain the dynamic susceptibility. The temperature is either extracted as the average of the values stored in the appropriate entry of the log attached to the workspace (user supplies the name of the entry) or user can pass a number for the temperature.

[1] S. W. Lovesey - Theory of Neutron Scattering from Condensed Matter, vol 1

[2] I. A. Zaliznyak and S. H. Lee - Magnetic Neutron Scattering in “Modern techniques for characterizing magnetic materials”

Usage

Example - Run Applied Detailed Balance

we1 = CreateSampleWorkspace(WorkspaceType='Event',
                           Function='Flat background',
                           BankPixelWidth=1,
                           XUnit='DeltaE',
                           XMin=-10,
                           XMax=19,
                           BinWidth=0.5)

AddSampleLog(Workspace=we1,LogName='Ei', LogText='20.', LogType='Number')
MoveInstrumentComponent(Workspace=we1, ComponentName='bank1', X=3, Z=3, RelativePosition=False)
MoveInstrumentComponent(Workspace=we1, ComponentName='bank2', X=-3, Z=-3, RelativePosition=False)
AddSampleLog(Workspace=we1,LogName='SampleTemp', LogText='25.0', LogType='Number Series')
SetGoniometer(Workspace=we1, Axis0='0,0,1,0,1')

# old way
weadb1 = ApplyDetailedBalance(InputWorkspace=we1, Temperature='SampleTemp')
mdabd1 = ConvertToMD(InputWorkspace=weadb1, QDimensions='Q3D')

# use algorithm ApplyDetailedBalanceMD
md1 = ConvertToMD(InputWorkspace=we1, QDimensions='Q3D')
test_db_md = ApplyDetailedBalanceMD(md1, 'SampleTemp')

r = CompareMDWorkspaces(test_db_md, mdabd1, CheckEvents=True, Tolerance=0.00001)
print('Number of MDEvents: {} == {}'.format(test_db_md.getNEvents(), mdabd1.getNEvents()))
print('Workspaces are {} equal'.format(r.Equals))

Output:

Number of MDEvents: 1972 == 1972
Workspaces are True equal

Categories: AlgorithmIndex | MDAlgorithms

Source

C++ header: ApplyDetailedBalanceMD.h

C++ source: ApplyDetailedBalanceMD.cpp