Mantid
Loading...
Searching...
No Matches
StaticKuboToyabe.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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//----------------------------------------------------------------------
8// Includes
9//----------------------------------------------------------------------
12#include <cmath>
13
15
16using namespace CurveFitting;
17
18using namespace Kernel;
19
20using namespace API;
21
22DECLARE_FUNCTION(StaticKuboToyabe)
23
24void StaticKuboToyabe::init() {
25 declareParameter("A", 0.2, "Amplitude at time 0");
26 declareParameter("Delta", 0.2, "Decay rate");
27}
28
29void StaticKuboToyabe::function1D(double *out, const double *xValues, const size_t nData) const {
30 const double A = getParameter("A");
31 const double G = getParameter("Delta");
32
33 for (size_t i = 0; i < nData; i++) {
34 out[i] = A * (exp(-pow(G * xValues[i], 2) / 2) * (1 - pow(G * xValues[i], 2)) * 2.0 / 3 + 1.0 / 3);
35 }
36}
37
38} // namespace Mantid::CurveFitting::Functions
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
double getParameter(size_t i) const override
Get i-th parameter.
Provide static Kubo Toyabe fitting function.
void function1D(double *out, const double *xValues, const size_t nData) const override
Function you want to fit to.