29 int nlevels = en.len();
30 for (
size_t iT = 0; iT < nData; iT++) {
34 const double beta = 1 / (k_B * xValues[iT]);
36 for (
auto iE = 1; iE <= nlevels; iE++) {
37 double expfact = exp(-beta * en(iE));
39 U += en(iE) * expfact;
40 U2 += en(iE) * en(iE) * expfact;
44 out[iT] = ((U2 - U * U) / (k_B * xValues[iT] * xValues[iT])) * convfact;
55 calculate(out, xValues, nData,
m_en);
58 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.
This is a specialization of IFunction for functions of one real argument.
Attribute is a non-fitting parameter.
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.
void declareAttribute(const std::string &name, const API::IFunction::Attribute &defaultValue)
Declare a single attribute.
Implements the part of IFunction interface dealing with parameters.
CrystalFieldHeatCapacity is a function that calculates the molar magnetic heat capacity (in J/K/mol) ...
void function1D(double *out, const double *xValues, const size_t nData) const override
Function you want to fit to.
CrystalFieldHeatCapacityBase()
void setEnergy(const DoubleFortranVector &en)
CrystalFieldHeatCapacityCalculation()
void setEnergy(const DoubleFortranVector &en)
void function1D(double *out, const double *xValues, const size_t nData) const override
Function you want to fit to.
CrystalFieldPeaks is a function that calculates crystal field peak positions and intensities.
void calculateEigenSystem(DoubleFortranVector &en, ComplexFortranMatrix &wf, ComplexFortranMatrix &ham, ComplexFortranMatrix &hz, int &nre) const
Calculate the crystal field eigensystem.
FortranVector< EigenVector > DoubleFortranVector
MANTID_GEOMETRY_DLL Raster calculate(const Kernel::V3D &beamDirection, const IObject &shape, const double cubeSizeInMetre)
static constexpr double BoltzmannConstant
Boltzmann Constant in meV/K Taken from http://physics.nist.gov/cuu/Constants on 10/07/2012.
static constexpr double N_A
Avagodro constant in mol-1.
static constexpr double meV
1 meV in Joules.