17#include <boost/math/special_functions/bessel.hpp>
36 this->declareParameter(
"Height", 1.0,
"scaling factor");
37 this->declareParameter(
"Radius", 0.98,
"radius of rotation (Angstroms)");
38 this->declareParameter(
"Tau", 10.0,
"Relaxation time, inverse of the rotational diffusion coefficient (ps)");
39 this->declareParameter(
"Centre", 0.0,
"Shift along the X-axis");
50 auto HeightConstraint = std::make_unique<BConstraint>(
this,
"Height", std::numeric_limits<double>::epsilon(),
true);
52 auto RadiusConstraint = std::make_unique<BConstraint>(
this,
"Radius", std::numeric_limits<double>::epsilon(),
true);
54 auto DiffusionConstraint = std::make_unique<BConstraint>(
this,
"Tau", std::numeric_limits<double>::epsilon(),
true);
65 double hbar(0.658211626);
74 if (R < std::numeric_limits<double>::epsilon()) {
75 for (
size_t j = 0; j < nData; j++) {
76 out[j] = std::numeric_limits<double>::infinity();
82 std::vector<double> al(N);
83 std::vector<double> HWHM(N);
84 for (
size_t i = 0; i < N; i++) {
85 auto l =
static_cast<unsigned int>(i + 1);
86 auto ld =
static_cast<double>(l);
87 al[i] = (2 * ld + 1) * pow(boost::math::sph_bessel(l, Q * R), 2);
88 HWHM[i] = ld * (ld + 1) * hbar / T;
91 for (
size_t j = 0; j < nData; j++) {
93 auto E = xValues[j] - C;
94 for (
size_t i = 0; i < N; i++) {
96 out[j] += H * al[i] * G / (G * G + E * E) / M_PI;
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
Attribute is a non-fitting parameter.
int asInt() const
Returns int value if attribute is a int, throws exception otherwise.
double asDouble() const
Returns double value if attribute is a double, throws exception otherwise.
virtual Attribute getAttribute(const std::string &name) const
Return a value of attribute attName.
virtual void addConstraint(std::unique_ptr< IConstraint > ic)
Add a constraint to function.
double getParameter(size_t i) const override
Get i-th parameter.
A boundary constraint is designed to be used to set either upper or lower (or both) boundaries on a s...
Inelastic part of the IsoRotDiff function.
void init() override
overwrite IFunction base class methods
void function1D(double *out, const double *xValues, const size_t nData) const override
Calculate function values on an energy domain.
The Logger class is in charge of the publishing messages from the framework through various channels.