Mantid
Loading...
Searching...
No Matches
MuonHelpers.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin
6// SPDX - License - Identifier: GPL - 3.0 +
7//-----------------------------------------------------------------------------
8// Includes
9//-----------------------------------------------------------------------------
11#include <cmath>
12
14
15double getAz(double xValue, const double charField) {
16 const double b = xValue / charField;
17 const double bSq = pow(b, 2);
18 const double A_z = (3.0 / 4.0) - (1.0 / (4.0 * bSq)) +
19 (pow(bSq - 1.0, 2.0) / (8.0 * pow(b, 3.0))) * log(fabs((b + 1.0) / (b - 1.0)));
20 return A_z;
21}
22
23double getDiffAz(double xValue, const double charField) {
24 double diffcharfield = -xValue / pow(charField, 2);
25 double b = xValue / charField;
26 double diffb = ((pow(b, 2) - 1) * ((pow(b, 2) + 3) * log((b + 1.0) / (b - 1.0)) - (2 * b))) / (8 * pow(b, 4));
27 double diffAz = diffcharfield * diffb;
28 if (!std::isfinite(diffAz)) {
29 diffAz = 0.0;
30 }
31 return diffAz;
32}
33
34double getActivationFunc(double xValue, const double attemptRate, const double barrier, const double unitMultiply) {
35 return attemptRate * exp(-(unitMultiply * barrier) / xValue);
36}
37
38double getAttemptRateDiff(double xValue, const double barrier, const double unitMultiply) {
39 return exp(-(unitMultiply * barrier) / xValue);
40}
41
42double getBarrierDiff(double xValue, const double attemptRate, const double barrier, const double unitMultiply) {
43 return -(attemptRate * unitMultiply * (exp(-(unitMultiply * barrier) / xValue))) / xValue;
44}
45
46} // namespace Mantid::CurveFitting::MuonHelper
#define fabs(x)
Definition: Matrix.cpp:22
double MANTID_CURVEFITTING_DLL getDiffAz(double xValue, const double charField)
Definition: MuonHelpers.cpp:23
double MANTID_CURVEFITTING_DLL getAttemptRateDiff(double xValue, const double barrier, const double unitMultipy)
Definition: MuonHelpers.cpp:38
double MANTID_CURVEFITTING_DLL getBarrierDiff(double xValue, const double attemptRate, const double barrier, const double unitMultipy)
Definition: MuonHelpers.cpp:42
double MANTID_CURVEFITTING_DLL getAz(double xValue, const double charField)
Definition: MuonHelpers.cpp:15
double MANTID_CURVEFITTING_DLL getActivationFunc(double xValue, const double attemptRate, const double barrier, const double unitMultipy)
Definition: MuonHelpers.cpp:34