Mantid
Loading...
Searching...
No Matches
DebyeWallerFactorCorrectionMD.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2025 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7
10
11namespace Mantid {
12namespace MDAlgorithms {
17
18// Register the algorithm into the AlgorithmFactory
19DECLARE_ALGORITHM(DebyeWallerFactorCorrectionMD)
20
21//----------------------------------------------------------------------------------------------
22
23
24const std::string DebyeWallerFactorCorrectionMD::name() const { return "DebyeWallerFactorCorrectionMD"; }
25
28
30const std::string DebyeWallerFactorCorrectionMD::category() const { return "MDAlgorithms"; }
31
33const std::string DebyeWallerFactorCorrectionMD::summary() const {
34 return "Apply Debye-Waller factor correction to MD events by dividing signal with exp(-q^2 * u^2 / 3)";
35}
36const std::vector<std::string> DebyeWallerFactorCorrectionMD::seeAlso() const { return {"DebyWallerFactorCorrection"}; }
37// //----------------------------------------------------------------------------------------------
38// /** Initialize the algorithm's properties.
39// */
42 auto mustBePositive = std::make_shared<BoundedValidator<double>>();
43 mustBePositive->setLower(0.0);
44 declareProperty(std::make_unique<PropertyWithValue<double>>("MeanSquaredDisplacement", EMPTY_DBL(),
45 std::move(mustBePositive), Direction::Input),
46 "Mandatory: Mean squared displacement <u^2>. Often obtained from Rietveld refinement.");
47}
48
49// //----------------------------------------------------------------------------------------------
50// /** Execute the algorithm.
51// */
53 u2 = getProperty("MeanSquaredDisplacement");
55}
56
57// implement correction method
58double DebyeWallerFactorCorrectionMD::correction(const double q2) const {
59 const double inverse_DWF = exp(u2 * q2 / 3.0);
60 return inverse_DWF;
61}
62
63} // namespace MDAlgorithms
64} // namespace Mantid
std::string name
Definition Run.cpp:60
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
BoundedValidator is a validator that requires the values to be between upper or lower bounds,...
The concrete, templated class for properties.
DebyeWallerCorrectionMD : Correct event signal and error values for Debye-Waller factor.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
const std::string category() const override
Algorithm's category for identification.
void init() override
Virtual method - must be overridden by concrete algorithm.
int version() const override
Algorithm's version for identification.
void exec() override
Virtual method - must be overridden by concrete algorithm.
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
void init() override
Initialize the algorithm's properties.
void exec() override
Execute the algorithm.
Helper class which provides the Collimation Length for SANS instruments.
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition EmptyValues.h:42
STL namespace.
Describes the direction (within an algorithm) of a Property.
Definition Property.h:50
@ Input
An input workspace.
Definition Property.h:53