34 this->declareParameter(
"Height", 1.0,
"scaling factor");
35 this->declareParameter(
"DiffCoeff", 2.3,
"Diffusion coefficient (10^(-5)cm^2/s)");
36 this->declareParameter(
"Tau", 1.25,
"Residence time (ps)");
37 this->declareParameter(
"Centre", 0.0,
"Shift along the X-axis");
47 double hbar(0.658211626);
56 if (H < std::numeric_limits<double>::epsilon() || D < std::numeric_limits<double>::epsilon() ||
57 T < std::numeric_limits<double>::epsilon()) {
58 for (
size_t j = 0; j < nData; j++) {
59 out[j] = std::numeric_limits<double>::infinity();
67 auto G = hbar * D * Q * Q / (1 + D * Q * Q * T);
68 for (
size_t j = 0; j < nData; j++) {
69 auto E = xValues[j] - C;
70 out[j] += H * G / (G * G + E * E) / M_PI;
81 const double deltaF{0.1};
82 const size_t nParam = this->
nParams();
85 std::map<std::string, double> cutoff;
86 cutoff[
"DiffCoeff"] = 0.2;
88 cutoff[
"Centre"] = 0.0001;
89 std::vector<double> out(nData);
93 for (
size_t iP = 0; iP < nParam; iP++) {
98 if (pName ==
"Height") {
102 this->
function1D(derivative.data(), xValues, nData);
105 double delta = cutoff[pName] >
fabs(pVal * deltaF) ? cutoff[pName] : pVal * deltaF;
108 this->
function1D(derivative.data(), xValues, nData);
109 for (
size_t i = 0; i < nData; i++) {
115 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("ExperimentInfo")
static logger object