26 this->declareParameter(
"Height", 1.0,
"scaling factor");
27 this->declareParameter(
"DiffCoeff", 2.3,
"Diffusion coefficient (10^(-5)cm^2/s)");
28 this->declareParameter(
"Tau", 1.25,
"Residence time (ps)");
29 this->declareParameter(
"Centre", 0.0,
"Shift along the X-axis");
39 double hbar(0.658211626);
48 if (H < std::numeric_limits<double>::epsilon() || D < std::numeric_limits<double>::epsilon() ||
49 T < std::numeric_limits<double>::epsilon()) {
50 for (
size_t j = 0; j < nData; j++) {
51 out[j] = std::numeric_limits<double>::infinity();
59 auto G = hbar * D * Q * Q / (1 + D * Q * Q * T);
60 for (
size_t j = 0; j < nData; j++) {
61 auto E = xValues[j] - C;
62 out[j] += H * G / (G * G + E * E) / M_PI;
73 const double deltaF{0.1};
74 const size_t nParam = this->
nParams();
77 std::map<std::string, double> cutoff;
78 cutoff[
"DiffCoeff"] = 0.2;
80 cutoff[
"Centre"] = 0.0001;
81 std::vector<double> out(nData);
85 for (
size_t iP = 0; iP < nParam; iP++) {
90 if (pName ==
"Height") {
94 this->
function1D(derivative.data(), xValues, nData);
97 double delta = cutoff[pName] >
fabs(pVal * deltaF) ? cutoff[pName] : pVal * deltaF;
100 this->
function1D(derivative.data(), xValues, nData);
101 for (
size_t i = 0; i < nData; i++) {
107 for (
size_t i = 0; i < nData; i++) {
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
virtual void derivative(const FunctionDomain &domain, FunctionValues &values, const size_t order=1) const
double asDouble() const
Returns double value if attribute is a double, throws exception otherwise.
bool isActive(size_t i) const
Check if an active parameter i is actually active.
virtual Attribute getAttribute(const std::string &name) const
Return a value of attribute attName.
virtual void applyTies()
Apply the ties.
virtual double activeParameter(size_t i) const
Value of i-th active parameter.
virtual void setActiveParameter(size_t i, double value)
Set new value of i-th active parameter.
Represents the Jacobian in IFitFunction::functionDeriv.
virtual void set(size_t iY, size_t iP, double value)=0
Set a value to a Jacobian matrix element.
std::string parameterName(size_t i) const override
Returns the name of parameter i.
size_t nParams() const override
Total number of parameters.
double getParameter(size_t i) const override
Get i-th parameter.
Teixeira's model to describe the translational diffusion of water.
void function1D(double *out, const double *xValues, const size_t nData) const override
Calculate function values on an energy domain.
void functionDeriv1D(Mantid::API::Jacobian *jacobian, const double *xValues, const size_t nData) override
analytical/numerical derivative with respect to fitting parameters We carry out analytical derivative...
The Logger class is in charge of the publishing messages from the framework through various channels.
Kernel::Logger g_log("DetermineSpinStateOrder")