Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Mantid::CurveFitting::Functions::CrystalFieldFunction Class Reference

Calculates crystal field spectra. More...

#include <CrystalFieldFunction.h>

Inheritance diagram for Mantid::CurveFitting::Functions::CrystalFieldFunction:
Mantid::API::IFunction

Public Member Functions

const std::string category () const override
 The categories the Fit function belong to. More...
 
std::vector< API::IFunction_sptrcreateEquivalentFunctions () const override
 Split this function (if needed) into a list of independent functions. More...
 
 CrystalFieldFunction ()
 Constructor. More...
 
void function (const API::FunctionDomain &domain, API::FunctionValues &values) const override
 Evaluate the function. More...
 
API::IConstraintgetConstraint (size_t i) const override
 Get the i-th constraint. More...
 
double getError (const std::string &name) const override
 Get the fitting error for a parameter by name. More...
 
double getError (size_t i) const override
 Get the fitting error for a parameter. More...
 
size_t getNumberDomains () const override
 Get number of domains required by this function. More...
 
double getParameter (const std::string &name) const override
 Get parameter by name. More...
 
double getParameter (size_t i) const override
 Get i-th parameter. More...
 
size_t getParameterIndex (const API::ParameterReference &ref) const override
 Return parameter index from a parameter reference. More...
 
API::ParameterTiegetTie (size_t i) const override
 Get the tie for i-th parameter. More...
 
bool hasParameter (const std::string &name) const override
 Check if function has a parameter with this name. More...
 
bool ignoreTie (const API::ParameterTie &tie) const override
 Checks if whether tie should be ignored. More...
 
bool isExplicitlySet (size_t i) const override
 Checks if a parameter has been set explicitly. More...
 
std::string name () const override
 Returns the function's name. More...
 
size_t nParams () const override
 Total number of parameters. More...
 
std::string parameterDescription (size_t i) const override
 Returns the description of parameter i. More...
 
size_t parameterIndex (const std::string &name) const override
 Returns the index of parameter name. More...
 
std::string parameterName (size_t i) const override
 Returns the name of parameter i. More...
 
void setError (const std::string &name, double err) override
 Set the fitting error for a parameter by name. More...
 
void setError (size_t i, double err) override
 Set the fitting error for a parameter. More...
 
void setParameter (const std::string &name, const double &value, bool explicitlySet=true) override
 Set parameter by name. More...
 
void setParameter (size_t, const double &value, bool explicitlySet=true) override
 Set i-th parameter. More...
 
void setParameterDescription (const std::string &name, const std::string &description) override
 Set description of parameter by name. More...
 
void setParameterDescription (size_t, const std::string &description) override
 Set i-th parameter description. More...
 
void setUpForFit () override
 Set up the function for a fit. More...
 
Attributes
size_t nAttributes () const override
 Returns the number of attributes associated with the function. More...
 
std::vector< std::string > getAttributeNames () const override
 Returns a list of attribute names. More...
 
Attribute getAttribute (const std::string &name) const override
 Return a value of attribute attName. More...
 
void setAttribute (const std::string &name, const Attribute &) override
 Set a value to attribute attName. More...
 
bool hasAttribute (const std::string &name) const override
 Check if attribute attName exists. More...
 
- Public Member Functions inherited from Mantid::API::IFunction
std::string asString () const
 Writes itself into a string. More...
 
bool cancellationRequestReceived () const
 Returns true if a progress reporter is set & evalaution has been requested to stop. More...
 
virtual const std::vector< std::string > categories () const
 Function to return all of the categories that contain this algorithm. More...
 
virtual const std::string category () const
 The categories the Fit function belong to. More...
 
virtual const std::string categorySeparator () const
 Function to return the sperator token for the category string. More...
 
virtual std::shared_ptr< IFunctionclone () const
 Virtual copy constructor. More...
 
virtual int64_t estimateNoProgressCalls () const
 Returns an estimate of the number of progress reports a single evaluation of the function will have. More...
 
virtual void function (const FunctionDomain &domain, FunctionValues &values) const =0
 Evaluates the function for all arguments in the domain. More...
 
virtual void functionDeriv (const FunctionDomain &domain, Jacobian &jacobian)
 Derivatives of function with respect to active parameters. More...
 
 IFunction ()
 Constructor. More...
 
 IFunction (const IFunction &)=delete
 No copying. More...
 
virtual void initialize ()
 Iinialize the function. More...
 
virtual void iterationFinished ()
 Called at the end of an iteration. More...
 
virtual void iterationStarting ()
 Called at the start of each iteration. More...
 
virtual std::string name () const =0
 Returns the function's name. More...
 
IFunctionoperator= (const IFunction &)=delete
 No copying. More...
 
virtual void registerFunctionUsage (bool internal)
 Registers the usage of the algorithm with the UsageService. More...
 
void reportProgress (const std::string &msg="") const
 Reports progress with an optional message. More...
 
virtual void setMatrixWorkspace (std::shared_ptr< const API::MatrixWorkspace > workspace, size_t wi, double startX, double endX)
 Set matrix workspace. More...
 
void setProgressReporter (std::shared_ptr< Kernel::ProgressBase > reporter)
 Attach a progress reporter. More...
 
virtual void setWorkspace (std::shared_ptr< const Workspace > ws)
 Set the workspace. More...
 
virtual ~IFunction ()
 Virtual destructor. More...
 
bool isFixed (size_t i) const
 Check if a parameter i is fixed. More...
 
bool isFixedByDefault (size_t i) const
 Check if a parameter i is fixed by default (not by user). More...
 
void fix (size_t i, bool isDefault=false)
 Removes a parameter i from the list of active. More...
 
void unfix (size_t i)
 Restores a declared parameter i to the active status. More...
 
void fixParameter (const std::string &name, bool isDefault=false)
 Fix a parameter. More...
 
void unfixParameter (const std::string &name)
 Free a parameter. More...
 
void fixAll (bool isDefault=false)
 Fix all parameters. More...
 
void unfixAll ()
 Free all parameters. More...
 
void unfixAllDefault ()
 Free all parameters fixed by default. More...
 
void fixAllActive (bool isDefault=false)
 Fix all active parameters. More...
 
std::vector< std::string > getParameterNames () const
 Return a vector with all parameter names. More...
 
virtual double activeParameter (size_t i) const
 Value of i-th active parameter. More...
 
virtual void setActiveParameter (size_t i, double value)
 Set new value of i-th active parameter. More...
 
virtual std::string nameOfActive (size_t i) const
 Returns the name of active parameter i. More...
 
virtual std::string descriptionOfActive (size_t i) const
 Returns the name of active parameter i. More...
 
bool isActive (size_t i) const
 Check if an active parameter i is actually active. More...
 
virtual void tie (const std::string &parName, const std::string &expr, bool isDefault=false)
 Tie a parameter to other parameters (or a constant) More...
 
virtual void addTies (const std::string &ties, bool isDefault=false)
 Add several ties. More...
 
virtual void applyTies ()
 Apply the ties. More...
 
virtual void removeTie (const std::string &parName)
 Removes the tie off a parameter. More...
 
virtual void clearTies ()
 Remove all ties. More...
 
virtual bool removeTie (size_t i)
 Removes i-th parameter's tie. More...
 
void sortTies ()
 Put all ties in order in which they will be applied correctly. More...
 
std::string writeTies () const
 Write a parameter tie to a string. More...
 
virtual void addConstraints (const std::string &str, bool isDefault=false)
 Add a list of conatraints from a string. More...
 
virtual void addConstraint (std::unique_ptr< IConstraint > ic)
 Add a constraint to function. More...
 
virtual void removeConstraint (const std::string &parName)
 Remove a constraint. More...
 
virtual void setConstraintPenaltyFactor (const std::string &parName, const double &c)
 Set a constraint penalty. More...
 
std::string writeConstraints () const
 Write a parameter constraint to a string. More...
 
virtual void clearConstraints ()
 Remove all constraints. More...
 
virtual std::string attributeName (size_t index) const
 Get name of ith attribute. More...
 
template<typename T >
void setAttributeValue (const std::string &attName, const T &value)
 Set an attribute value. More...
 
void setAttributeValue (const std::string &attName, const char *value)
 Overload for const char* values. More...
 
void setAttributeValue (const std::string &attName, const std::string &value)
 Set string attribute by value. More...
 
virtual std::shared_ptr< IFunctiongetFunction (size_t i) const
 Returns the pointer to i-th child function. More...
 
virtual std::size_t nFunctions () const
 Number of child functions. More...
 
virtual size_t getValuesSize (const FunctionDomain &domain) const
 Get number of values for a given domain. More...
 
void calNumericalDeriv (const FunctionDomain &domain, Jacobian &jacobian)
 Calculate numerical derivatives. More...
 
double calculateStepSize (const double parameterValue) const
 Calculate step size for the given parameter value. More...
 
void setCovarianceMatrix (const std::shared_ptr< Kernel::Matrix< double > > &covar)
 Set the covariance matrix. More...
 
std::shared_ptr< const Kernel::Matrix< double > > getCovarianceMatrix () const
 Get the covariance matrix. More...
 
void setReducedChiSquared (double chi2)
 Set the reduced chi^2. More...
 
double getReducedChiSquared () const
 Get the reduced chi^2. More...
 
void setParallel (bool on)
 Set the parallel hint. More...
 
bool isParallel () const
 Get the parallel hint. More...
 
void setHandler (std::unique_ptr< FunctionHandler > handler)
 Set a function handler. More...
 
FunctionHandlergetHandler () const
 Return the handler. More...
 
virtual void setStepSizeMethod (const StepSizeMethod method)
 Sets the StepSizeMethod to use when calculation the step size. More...
 

Checks

CrystalFieldControl m_control
 Function that creates the source function. More...
 
API::IFunction_sptr m_source
 Function that calculates parameters of the target function. More...
 
API::CompositeFunction_sptr m_target
 Function that actually calculates the output. More...
 
size_t m_nControlParams
 Cached number of parameters in m_control. More...
 
size_t m_nControlSourceParams
 Cached number of parameters in m_control and m_source. More...
 
bool m_dirtyTarget
 Flag indicating that updateTargetFunction() is required. More...
 
std::unordered_map< std::string, size_t > m_mapNames2Indices
 Map parameter names to indices. More...
 
std::vector< std::string > m_mapIndices2Names
 Map parameter indices to names. More...
 
std::vector< std::string > m_attributeNames
 Attribute names. More...
 
std::unordered_map< std::string, API::IFunction_sptrm_mapPrefixes2PhysProps
 Map parameter/attribute prefixes to pointers to phys prop functions. More...
 
std::vector< double > m_parameterResetCache
 Temporary cache for parameter values during source function resetting. More...
 
std::vector< bool > m_fixResetCache
 
bool isMultiSite () const
 Check if the function is set up for a multi-site calculations. More...
 
bool isMultiSpectrum () const
 Check if the function is set up for a multi-spectrum calculations (Multiple temperatures defined) More...
 
bool hasBackground () const
 Check if the spectra have a background. More...
 
bool hasPeaks () const
 Check if there are peaks (there is at least one spectrum). More...
 
bool hasPhysProperties () const
 Check if there are any phys. properties. More...
 
void checkSourceFunction () const
 Build source function if necessary. More...
 
void buildTargetFunction () const
 Build target function. More...
 
size_t nSpectra () const
 Get number of the number of spectra (excluding phys prop data). More...
 
void declareParameter (const std::string &name, double initValue=0, const std::string &description="") override
 Declare a new parameter. More...
 
void setParameterStatus (size_t i, ParameterStatus status) override
 Change status of parameter. More...
 
ParameterStatus getParameterStatus (size_t i) const override
 Get status of parameter. More...
 
void buildSourceFunction () const
 Build the source function. More...
 
void updateTargetFunction () const
 Update the target function. More...
 
void buildSingleSite () const
 Build the target function in a single site case. More...
 
void buildMultiSite () const
 Build the target function in a multi site case. More...
 
void buildSingleSiteSingleSpectrum () const
 Build the target function in a single site - single spectrum case. More...
 
void buildSingleSiteMultiSpectrum () const
 Build the target function in a single site - multi spectrum case. More...
 
void buildMultiSiteSingleSpectrum () const
 Build the target function in a multi site - single spectrum case. More...
 
void buildMultiSiteMultiSpectrum () const
 Build the target function in a multi site - multi spectrum case. More...
 
void updateSingleSite () const
 Update the target function in a single site case. More...
 
void updateMultiSite () const
 Update the target function in a multi site case. More...
 
void updateSingleSiteSingleSpectrum () const
 Update the target function in a single site - single spectrum case. More...
 
void updateSingleSiteMultiSpectrum () const
 Update the target function in a single site - multi spectrum case. More...
 
void updateMultiSiteSingleSpectrum () const
 Update the target function in a multi site - single spectrum case. More...
 
void updateMultiSiteMultiSpectrum () const
 Update the target function in a multi site - multi spectrum case. More...
 
API::IFunction_sptr buildSpectrum (int nre, const DoubleFortranVector &en, const ComplexFortranMatrix &wf, double temperature, double fwhm, size_t i, bool addBackground, double intensityScaling) const
 Build a function for a single spectrum. More...
 
void updateSpectrum (API::IFunction &spectrum, int nre, const DoubleFortranVector &en, const ComplexFortranMatrix &wf, double temperature, double fwhm, size_t iSpec, size_t iFirst, double intensityScaling) const
 Update a function for a single spectrum. More...
 
void calcExcitations (int nre, const DoubleFortranVector &en, const ComplexFortranMatrix &wf, double temperature, API::FunctionValues &values, double intensityScaling) const
 Calculate excitations at given temperature. More...
 
API::IFunction_sptr buildPhysprop (int nre, const DoubleFortranVector &en, const ComplexFortranMatrix &wf, const ComplexFortranMatrix &ham, const std::string &propName) const
 Build a physical property function. More...
 
void updatePhysprop (int nre, const DoubleFortranVector &en, const ComplexFortranMatrix &wf, const ComplexFortranMatrix &ham, API::IFunction &fun) const
 Update a physical property function. More...
 
void setSource (API::IFunction_sptr source) const
 Set the source function. More...
 
void checkTargetFunction () const
 Update target function if necessary. More...
 
API::CompositeFunctioncompositeSource () const
 Get a reference to the source function if it's composite. More...
 
std::pair< API::IFunction *, std::string > getAttributeReference (const std::string &attName) const
 Get a reference to an attribute. More...
 
void buildAttributeNames () const
 Build and cache the attribute names. More...
 
void makeMaps () const
 Make maps between parameter names and indices. More...
 
void makeMapsSingleSiteSingleSpectrum () const
 Parameter-index map for single-site single-spectrum. More...
 
void makeMapsSingleSiteMultiSpectrum () const
 Parameter-index map for single-site multi-spectrum. More...
 
void makeMapsMultiSiteSingleSpectrum () const
 Parameter-index map for multi-site single-spectrum. More...
 
void makeMapsMultiSiteMultiSpectrum () const
 Parameter-index map for multi-site multi-spectrum. More...
 
size_t makeMapsForFunction (const IFunction &fun, size_t iFirst, const std::string &prefix) const
 Make parameter names from names of a function and map them to indices. More...
 
void cacheSourceParameters () const
 Temporary cache parameter values of the source function if it's initialised. More...
 

Additional Inherited Members

- Public Types inherited from Mantid::API::IFunction
enum  ParameterStatus { Active , Fixed , FixedByDefault , Tied }
 Describe parameter status in relation to fitting: Active: Fit varies such parameter directly. More...
 
enum class  StepSizeMethod { DEFAULT , SQRT_EPSILON }
 Describes the method in which the step size will be calculated: DEFAULT: Uses the traditional Mantid method of calculating the step size. More...
 
- Protected Member Functions inherited from Mantid::API::IFunction
virtual void init ()
 Function initialization. Declare function parameters in this method. More...
 
double convertValue (double value, Kernel::Unit_sptr &outUnit, const std::shared_ptr< const MatrixWorkspace > &ws, size_t wsIndex) const
 Convert a value from one unit (inUnit) to unit defined in workspace (ws) More...
 
void convertValue (std::vector< double > &values, Kernel::Unit_sptr &outUnit, const std::shared_ptr< const MatrixWorkspace > &ws, size_t wsIndex) const
 Convert values from unit defined in workspace (ws) to outUnit. More...
 
virtual void declareAttributes ()
 Override to declare function attributes. More...
 
virtual void declareParameters ()
 Override to declare function parameters. More...
 
void declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue)
 Declare a single attribute. More...
 
void declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue, const Kernel::IValidator &validator)
 Declare a single attribute with validator. More...
 
void checkAttributeName (const std::string &name)
 Check Attribute to declare does not already exist. More...
 
void storeAttributeValue (const std::string &name, const API::IFunction::Attribute &value)
 Store an attribute's value. More...
 
void storeReadOnlyAttribute (const std::string &name, const API::IFunction::Attribute &value) const
 A read-only ("mutable") attribute can be stored in a const method. More...
 
virtual void addTie (std::unique_ptr< ParameterTie > tie)
 Add a new tie. Derived classes must provide storage for ties. More...
 
bool hasOrderedTies () const
 
void applyOrderedTies ()
 
virtual std::string writeToString (const std::string &parentLocalAttributesStr="") const
 Writes itself into a string. More...
 
- Protected Attributes inherited from Mantid::API::IFunction
bool m_isParallel
 Flag to hint that the function is being used in parallel computations. More...
 
std::unique_ptr< FunctionHandlerm_handler
 Pointer to a function handler. More...
 
std::shared_ptr< Kernel::ProgressBasem_progReporter
 Pointer to the progress handler. More...
 

Detailed Description

Calculates crystal field spectra.

Definition at line 22 of file CrystalFieldFunction.h.

Constructor & Destructor Documentation

◆ CrystalFieldFunction()

Mantid::CurveFitting::Functions::CrystalFieldFunction::CrystalFieldFunction ( )

Constructor.

Definition at line 99 of file CrystalFieldFunction.cpp.

Member Function Documentation

◆ buildAttributeNames()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildAttributeNames ( ) const
private

◆ buildMultiSite()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSite ( ) const
private

Build the target function in a multi site case.

Definition at line 690 of file CrystalFieldFunction.cpp.

References buildMultiSiteMultiSpectrum(), buildMultiSiteSingleSpectrum(), and isMultiSpectrum().

Referenced by buildTargetFunction().

◆ buildMultiSiteMultiSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteMultiSpectrum ( ) const
private

◆ buildMultiSiteSingleSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum ( ) const
private

◆ buildPhysprop()

API::IFunction_sptr Mantid::CurveFitting::Functions::CrystalFieldFunction::buildPhysprop ( int  nre,
const DoubleFortranVector energies,
const ComplexFortranMatrix waveFunctions,
const ComplexFortranMatrix hamiltonian,
const std::string &  propName 
) const
private

Build a physical property function.

Parameters
nre:: An id of the ion.
energies:: A vector with energies.
waveFunctions:: A matrix with wave functions.
hamiltonian:: A matrix with the hamiltonian.
propName:: the name of the physical property.

Definition at line 945 of file CrystalFieldFunction.cpp.

Referenced by buildMultiSiteMultiSpectrum(), and buildSingleSiteMultiSpectrum().

◆ buildSingleSite()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSite ( ) const
private

Build the target function in a single site case.

Definition at line 681 of file CrystalFieldFunction.cpp.

References buildSingleSiteMultiSpectrum(), buildSingleSiteSingleSpectrum(), and isMultiSpectrum().

Referenced by buildTargetFunction().

◆ buildSingleSiteMultiSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteMultiSpectrum ( ) const
private

◆ buildSingleSiteSingleSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum ( ) const
private

◆ buildSourceFunction()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSourceFunction ( ) const
protected

◆ buildSpectrum()

API::IFunction_sptr Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSpectrum ( int  nre,
const DoubleFortranVector energies,
const ComplexFortranMatrix waveFunctions,
double  temperature,
double  fwhm,
size_t  iSpec,
bool  addBackground,
double  intensityScaling 
) const
private

Build a function for a single spectrum.

Parameters
nre:: An id of the ion.
energies:: A vector with energies.
waveFunctions:: A matrix with wave functions.
temperature:: A temperature of the spectrum.
fwhm:: A full width at half maximum to set to each peak.
iSpec:: An index of the created spectrum in m_target composite function.
addBackground:: An option to add a background to the spectrum.
intensityScaling:: A scaling factor for the peak intensities.

Definition at line 910 of file CrystalFieldFunction.cpp.

References Mantid::API::IFunction::Attribute::asBool(), Mantid::API::IFunction::Attribute::asDouble(), Mantid::API::IFunction::Attribute::asInt(), Mantid::API::IFunction::Attribute::asString(), Mantid::API::IFunction::Attribute::asUnquotedString(), Mantid::CurveFitting::Functions::CrystalFieldUtils::buildSpectrumFunction(), calcExcitations(), Mantid::API::IFunction::CompositeFunction, getAttribute(), Mantid::API::CompositeFunction::getFunction(), Mantid::Kernel::SingletonHolder< T >::Instance(), and m_control.

Referenced by buildMultiSiteMultiSpectrum(), and buildSingleSiteMultiSpectrum().

◆ buildTargetFunction()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::buildTargetFunction ( ) const

Build target function.

Uses source to calculate peak centres and intensities then populates m_spectrum with peaks of type given in PeakShape attribute.

Definition at line 669 of file CrystalFieldFunction.cpp.

References buildMultiSite(), buildSingleSite(), checkSourceFunction(), isMultiSite(), m_attributeNames, and m_dirtyTarget.

Referenced by getNumberDomains(), and updateTargetFunction().

◆ cacheSourceParameters()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::cacheSourceParameters ( ) const
private

Temporary cache parameter values of the source function if it's initialised.

Definition at line 1353 of file CrystalFieldFunction.cpp.

References m_fixResetCache, m_parameterResetCache, and m_source.

Referenced by setAttribute().

◆ calcExcitations()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::calcExcitations ( int  nre,
const DoubleFortranVector energies,
const ComplexFortranMatrix waveFunctions,
double  temperature,
API::FunctionValues values,
double  intensityScaling 
) const
private

Calculate excitations at given temperature.

Parameters
nre:: An id of the ion.
energies:: A vector with energies.
waveFunctions:: A matrix with wave functions.
temperature:: A temperature of the spectrum.
values:: An object to receive computed excitations.
intensityScaling:: A scaling factor for the intensities.

Definition at line 879 of file CrystalFieldFunction.cpp.

References Mantid::API::IFunction::Attribute::asDouble(), Mantid::CurveFitting::Functions::calculateExcitations(), Mantid::CurveFitting::Functions::calculateIntensities(), Mantid::API::FunctionValues::expand(), Mantid::CurveFitting::EigenVector::get(), getAttribute(), Mantid::API::FunctionValues::setCalculated(), and Mantid::CurveFitting::EigenVector::size().

Referenced by buildSpectrum(), and updateSpectrum().

◆ category()

const std::string Mantid::CurveFitting::Functions::CrystalFieldFunction::category ( ) const
inlineoverridevirtual

The categories the Fit function belong to.

Categories must be listed as a semi colon separated list. For example: "General, Muon\\Custom" which adds a function to the category "General" and the sub-category "Muon\\Custom"

Reimplemented from Mantid::API::IFunction.

Definition at line 26 of file CrystalFieldFunction.h.

◆ checkSourceFunction()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::checkSourceFunction ( ) const

◆ checkTargetFunction()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::checkTargetFunction ( ) const
private

◆ compositeSource()

API::CompositeFunction & Mantid::CurveFitting::Functions::CrystalFieldFunction::compositeSource ( ) const
private

◆ createEquivalentFunctions()

std::vector< IFunction_sptr > Mantid::CurveFitting::Functions::CrystalFieldFunction::createEquivalentFunctions ( ) const
overridevirtual

Split this function (if needed) into a list of independent functions.

The number of functions must be the number of domains this function is working on (== getNumberDomains()). The result of evaluation of the created functions on their domains must be the same as if this function was evaluated on the composition of those domains.

Reimplemented from Mantid::API::IFunction.

Definition at line 126 of file CrystalFieldFunction.cpp.

References Mantid::API::CompositeFunction::checkFunction(), checkTargetFunction(), and Mantid::API::CompositeFunction::getFunction().

◆ declareParameter()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::declareParameter ( const std::string &  name,
double  initValue = 0,
const std::string &  description = "" 
)
overrideprotectedvirtual

Declare a new parameter.

Implements Mantid::API::IFunction.

Definition at line 393 of file CrystalFieldFunction.cpp.

◆ function()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::function ( const API::FunctionDomain domain,
API::FunctionValues values 
) const
overridevirtual

Evaluate the function.

Implements Mantid::API::IFunction.

Definition at line 103 of file CrystalFieldFunction.cpp.

References m_target, and updateTargetFunction().

Referenced by updatePhysprop().

◆ getAttribute()

IFunction::Attribute Mantid::CurveFitting::Functions::CrystalFieldFunction::getAttribute ( const std::string &  attName) const
overridevirtual

Return a value of attribute attName.

Parameters
attName:: Name of an attribute.

Reimplemented from Mantid::API::IFunction.

Definition at line 487 of file CrystalFieldFunction.cpp.

References Mantid::API::IFunction::getAttribute(), and getAttributeReference().

Referenced by buildMultiSiteSingleSpectrum(), buildSingleSiteSingleSpectrum(), buildSpectrum(), calcExcitations(), hasBackground(), updateMultiSiteSingleSpectrum(), and updateSpectrum().

◆ getAttributeNames()

std::vector< std::string > Mantid::CurveFitting::Functions::CrystalFieldFunction::getAttributeNames ( ) const
overridevirtual

Returns a list of attribute names.

Reimplemented from Mantid::API::IFunction.

Definition at line 480 of file CrystalFieldFunction.cpp.

References buildAttributeNames(), and m_attributeNames.

◆ getAttributeReference()

std::pair< API::IFunction *, std::string > Mantid::CurveFitting::Functions::CrystalFieldFunction::getAttributeReference ( const std::string &  attName) const
private

Get a reference to an attribute.

Parameters
attName:: A name of an attribute. It can be a code rather than an actual name. This method interprets the code and finds the function and attribute it refers to.
Returns
:: A pair (IFunction, attribute_name) where attribute_name is a name that the IFunction has.

Definition at line 527 of file CrystalFieldFunction.cpp.

References Mantid::CurveFitting::Functions::CrystalFieldControl::buildControls(), Mantid::API::CompositeFunction::getFunction(), m_control, m_mapPrefixes2PhysProps, name(), and Mantid::API::CompositeFunction::nFunctions().

Referenced by getAttribute(), hasAttribute(), and setAttribute().

◆ getConstraint()

IConstraint * Mantid::CurveFitting::Functions::CrystalFieldFunction::getConstraint ( size_t  i) const
overridevirtual

◆ getError() [1/2]

double Mantid::CurveFitting::Functions::CrystalFieldFunction::getError ( const std::string &  name) const
overridevirtual

Get the fitting error for a parameter by name.

Get the fitting error for a parameter.

Implements Mantid::API::IFunction.

Definition at line 301 of file CrystalFieldFunction.cpp.

References checkSourceFunction(), checkTargetFunction(), Mantid::API::CompositeFunction::getError(), index, m_control, m_nControlParams, m_nControlSourceParams, m_source, m_target, name(), and parameterIndex().

◆ getError() [2/2]

double Mantid::CurveFitting::Functions::CrystalFieldFunction::getError ( size_t  i) const
overridevirtual

◆ getNumberDomains()

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::getNumberDomains ( ) const
overridevirtual

Get number of domains required by this function.

If it returns a number greater than 1 then the domain passed to function(domain, values) method must have a CompositeDomain type with the same number of parts.

Reimplemented from Mantid::API::IFunction.

Definition at line 115 of file CrystalFieldFunction.cpp.

References buildTargetFunction(), and m_target.

◆ getParameter() [1/2]

double Mantid::CurveFitting::Functions::CrystalFieldFunction::getParameter ( const std::string &  name) const
overridevirtual

Get parameter by name.

Implements Mantid::API::IFunction.

Definition at line 213 of file CrystalFieldFunction.cpp.

References getParameter(), index, name(), and parameterIndex().

◆ getParameter() [2/2]

double Mantid::CurveFitting::Functions::CrystalFieldFunction::getParameter ( size_t  i) const
overridevirtual

◆ getParameterIndex()

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::getParameterIndex ( const API::ParameterReference ref) const
overridevirtual

◆ getParameterStatus()

IFunction::ParameterStatus Mantid::CurveFitting::Functions::CrystalFieldFunction::getParameterStatus ( size_t  i) const
overrideprotectedvirtual

◆ getTie()

ParameterTie * Mantid::CurveFitting::Functions::CrystalFieldFunction::getTie ( size_t  i) const
overridevirtual

◆ hasAttribute()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::hasAttribute ( const std::string &  name) const
overridevirtual

Check if attribute attName exists.

Reimplemented from Mantid::API::IFunction.

Definition at line 513 of file CrystalFieldFunction.cpp.

References getAttributeReference().

Referenced by hasBackground().

◆ hasBackground()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::hasBackground ( ) const

◆ hasParameter()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::hasParameter ( const std::string &  name) const
overridevirtual

Check if function has a parameter with this name.

Implements Mantid::API::IFunction.

Definition at line 183 of file CrystalFieldFunction.cpp.

References name(), and parameterIndex().

◆ hasPeaks()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::hasPeaks ( ) const

Check if there are peaks (there is at least one spectrum).

Definition at line 620 of file CrystalFieldFunction.cpp.

References Mantid::CurveFitting::Functions::CrystalFieldControl::hasPeaks(), and m_control.

◆ hasPhysProperties()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::hasPhysProperties ( ) const

Check if there are any phys. properties.

Definition at line 623 of file CrystalFieldFunction.cpp.

References Mantid::CurveFitting::Functions::CrystalFieldControl::hasPhysProperties(), and m_control.

◆ ignoreTie()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::ignoreTie ( const API::ParameterTie tie) const
overridevirtual

Checks if whether tie should be ignored.

Reimplemented from Mantid::API::IFunction.

Definition at line 580 of file CrystalFieldFunction.cpp.

References Mantid::API::IFunction::tie().

◆ isExplicitlySet()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::isExplicitlySet ( size_t  i) const
overridevirtual

◆ isMultiSite()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::isMultiSite ( ) const

Check if the function is set up for a multi-site calculations.

(Multiple ions defined)

Definition at line 605 of file CrystalFieldFunction.cpp.

References Mantid::CurveFitting::Functions::CrystalFieldControl::isMultiSite(), and m_control.

Referenced by buildTargetFunction(), makeMaps(), and updateTargetFunction().

◆ isMultiSpectrum()

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::isMultiSpectrum ( ) const

Check if the function is set up for a multi-spectrum calculations (Multiple temperatures defined)

Definition at line 609 of file CrystalFieldFunction.cpp.

References Mantid::CurveFitting::Functions::CrystalFieldControl::isMultiSpectrum(), and m_control.

Referenced by buildMultiSite(), buildSingleSite(), makeMaps(), updateMultiSite(), and updateSingleSite().

◆ makeMaps()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMaps ( ) const
private

◆ makeMapsForFunction()

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsForFunction ( const IFunction fun,
size_t  iFirst,
const std::string &  prefix 
) const
private

Make parameter names from names of a function and map them to indices.

Parameters
fun:: A function to get parameter names from.
iFirst:: An index that maps to the first parameter of fun.
prefix:: A prefix to add to all parameters

Definition at line 1192 of file CrystalFieldFunction.cpp.

References m_mapIndices2Names, m_mapNames2Indices, n, name(), Mantid::API::IFunction::nParams(), and Mantid::API::IFunction::parameterName().

Referenced by makeMapsMultiSiteMultiSpectrum(), makeMapsMultiSiteSingleSpectrum(), makeMapsSingleSiteMultiSpectrum(), and makeMapsSingleSiteSingleSpectrum().

◆ makeMapsMultiSiteMultiSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsMultiSiteMultiSpectrum ( ) const
private

◆ makeMapsMultiSiteSingleSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsMultiSiteSingleSpectrum ( ) const
private

Parameter-index map for multi-site single-spectrum.

Definition at line 1263 of file CrystalFieldFunction.cpp.

References compositeSource(), hasBackground(), m_target, makeMapsForFunction(), and std::to_string().

Referenced by makeMaps().

◆ makeMapsSingleSiteMultiSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsSingleSiteMultiSpectrum ( ) const
private

◆ makeMapsSingleSiteSingleSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsSingleSiteSingleSpectrum ( ) const
private

Parameter-index map for single-site single-spectrum.

Definition at line 1205 of file CrystalFieldFunction.cpp.

References hasBackground(), m_source, m_target, makeMapsForFunction(), and std::to_string().

Referenced by makeMaps().

◆ name()

std::string Mantid::CurveFitting::Functions::CrystalFieldFunction::name ( ) const
inlineoverridevirtual

◆ nAttributes()

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::nAttributes ( ) const
overridevirtual

Returns the number of attributes associated with the function.

Reimplemented from Mantid::API::IFunction.

Definition at line 474 of file CrystalFieldFunction.cpp.

References buildAttributeNames(), and m_attributeNames.

◆ nParams()

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::nParams ( ) const
overridevirtual

◆ nSpectra()

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::nSpectra ( ) const

◆ parameterDescription()

std::string Mantid::CurveFitting::Functions::CrystalFieldFunction::parameterDescription ( size_t  i) const
overridevirtual

◆ parameterIndex()

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::parameterIndex ( const std::string &  name) const
overridevirtual

Returns the index of parameter name.

Returns the index of a parameter with a given name.

Parameters
name:: Name of a parameter.

Implements Mantid::API::IFunction.

Definition at line 234 of file CrystalFieldFunction.cpp.

References checkSourceFunction(), checkTargetFunction(), m_mapIndices2Names, m_mapNames2Indices, makeMaps(), name(), and nParams().

Referenced by getError(), getParameter(), hasParameter(), setError(), setParameter(), and setParameterDescription().

◆ parameterName()

std::string Mantid::CurveFitting::Functions::CrystalFieldFunction::parameterName ( size_t  i) const
overridevirtual

Returns the name of parameter i.

Implements Mantid::API::IFunction.

Definition at line 248 of file CrystalFieldFunction.cpp.

References checkSourceFunction(), checkTargetFunction(), m_mapIndices2Names, makeMaps(), nParams(), and std::to_string().

◆ setAttribute()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setAttribute ( const std::string &  name,
const Attribute attr 
)
overridevirtual

Set a value to attribute attName.

Perform custom actions on setting certain attributes.

Reimplemented from Mantid::API::IFunction.

Definition at line 497 of file CrystalFieldFunction.cpp.

References cacheSourceParameters(), getAttributeReference(), m_control, m_dirtyTarget, m_source, and Mantid::API::IFunction::setAttribute().

◆ setError() [1/2]

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setError ( const std::string &  name,
double  err 
)
overridevirtual

Set the fitting error for a parameter by name.

Set the fitting error for a parameter.

Implements Mantid::API::IFunction.

Definition at line 328 of file CrystalFieldFunction.cpp.

References checkSourceFunction(), checkTargetFunction(), index, m_control, m_nControlParams, m_nControlSourceParams, m_source, m_target, name(), parameterIndex(), and Mantid::API::CompositeFunction::setError().

◆ setError() [2/2]

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setError ( size_t  i,
double  err 
)
overridevirtual

◆ setParameter() [1/2]

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameter ( const std::string &  name,
const double &  value,
bool  explicitlySet = true 
)
overridevirtual

Set parameter by name.

Implements Mantid::API::IFunction.

Definition at line 193 of file CrystalFieldFunction.cpp.

References index, name(), parameterIndex(), setParameter(), and value.

◆ setParameter() [2/2]

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameter ( size_t  i,
const double &  value,
bool  explicitlySet = true 
)
overridevirtual

◆ setParameterDescription() [1/2]

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameterDescription ( const std::string &  name,
const std::string &  description 
)
overridevirtual

Set description of parameter by name.

Implements Mantid::API::IFunction.

Definition at line 207 of file CrystalFieldFunction.cpp.

References index, name(), parameterIndex(), and setParameterDescription().

◆ setParameterDescription() [2/2]

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameterDescription ( size_t  i,
const std::string &  description 
)
overridevirtual

◆ setParameterStatus()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameterStatus ( size_t  i,
IFunction::ParameterStatus  status 
)
overrideprotectedvirtual

◆ setSource()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setSource ( API::IFunction_sptr  source) const
private

Set the source function.

Parameters
source:: New source function.

Definition at line 113 of file CrystalFieldFunction.cpp.

References m_source.

Referenced by buildSourceFunction().

◆ setUpForFit()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::setUpForFit ( )
overridevirtual

Set up the function for a fit.

Reimplemented from Mantid::API::IFunction.

Definition at line 386 of file CrystalFieldFunction.cpp.

References checkSourceFunction(), Mantid::API::IFunction::setUpForFit(), and updateTargetFunction().

◆ updateMultiSite()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSite ( ) const
private

Update the target function in a multi site case.

Definition at line 1028 of file CrystalFieldFunction.cpp.

References isMultiSpectrum(), updateMultiSiteMultiSpectrum(), and updateMultiSiteSingleSpectrum().

Referenced by updateTargetFunction().

◆ updateMultiSiteMultiSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteMultiSpectrum ( ) const
private

◆ updateMultiSiteSingleSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteSingleSpectrum ( ) const
private

◆ updatePhysprop()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updatePhysprop ( int  nre,
const DoubleFortranVector energies,
const ComplexFortranMatrix waveFunctions,
const ComplexFortranMatrix hamiltonian,
API::IFunction function 
) const
private

Update a physical property function.

Parameters
nre:: An id of the ion.
energies:: A vector with energies.
waveFunctions:: A matrix with wave functions.
hamiltonian:: A matrix with the hamiltonian.
function:: A function to update.

Definition at line 980 of file CrystalFieldFunction.cpp.

References function(), Mantid::CurveFitting::Functions::CrystalFieldSusceptibilityCalculation::setEigensystem(), Mantid::CurveFitting::Functions::CrystalFieldHeatCapacityCalculation::setEnergy(), Mantid::CurveFitting::Functions::CrystalFieldMagnetisationCalculation::setHamiltonian(), and Mantid::CurveFitting::Functions::CrystalFieldMomentCalculation::setHamiltonian().

Referenced by updateMultiSiteMultiSpectrum(), and updateSingleSiteMultiSpectrum().

◆ updateSingleSite()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSite ( ) const
private

Update the target function in a single site case.

Definition at line 1019 of file CrystalFieldFunction.cpp.

References isMultiSpectrum(), updateSingleSiteMultiSpectrum(), and updateSingleSiteSingleSpectrum().

Referenced by updateTargetFunction().

◆ updateSingleSiteMultiSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteMultiSpectrum ( ) const
private

◆ updateSingleSiteSingleSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteSingleSpectrum ( ) const
private

◆ updateSpectrum()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSpectrum ( API::IFunction spectrum,
int  nre,
const DoubleFortranVector energies,
const ComplexFortranMatrix waveFunctions,
double  temperature,
double  fwhm,
size_t  iSpec,
size_t  iFirst,
double  intensityScaling 
) const
private

Update a function for a single spectrum.

Parameters
spectrum:: A Spectrum function to update.
nre:: An id of the ion.
energies:: A vector with energies.
waveFunctions:: A matrix with wave functions.
temperature:: A temperature of the spectrum.
fwhm:: A full width at half maximum to set to each peak.
iSpec:: An index of the created spectrum in m_target composite function.
iFirst:: An index of the first peak in spectrum composite function.
intensityScaling:: A scaling factor for the intensities.

Definition at line 1153 of file CrystalFieldFunction.cpp.

References Mantid::API::IFunction::Attribute::asBool(), Mantid::API::IFunction::Attribute::asDouble(), Mantid::API::IFunction::Attribute::asString(), calcExcitations(), getAttribute(), Mantid::API::CompositeFunction::getFunction(), m_control, and Mantid::CurveFitting::Functions::CrystalFieldUtils::updateSpectrumFunction().

Referenced by updateMultiSiteMultiSpectrum(), and updateSingleSiteMultiSpectrum().

◆ updateTargetFunction()

void Mantid::CurveFitting::Functions::CrystalFieldFunction::updateTargetFunction ( ) const
protected

Update the target function.

Update m_spectrum function.

Definition at line 1004 of file CrystalFieldFunction.cpp.

References buildTargetFunction(), isMultiSite(), m_dirtyTarget, m_target, updateMultiSite(), and updateSingleSite().

Referenced by checkTargetFunction(), function(), and setUpForFit().

Member Data Documentation

◆ m_attributeNames

std::vector<std::string> Mantid::CurveFitting::Functions::CrystalFieldFunction::m_attributeNames
mutableprivate

Attribute names.

Definition at line 210 of file CrystalFieldFunction.h.

Referenced by buildAttributeNames(), buildTargetFunction(), getAttributeNames(), and nAttributes().

◆ m_control

CrystalFieldControl Mantid::CurveFitting::Functions::CrystalFieldFunction::m_control
mutableprivate

◆ m_dirtyTarget

bool Mantid::CurveFitting::Functions::CrystalFieldFunction::m_dirtyTarget
mutableprivate

Flag indicating that updateTargetFunction() is required.

Definition at line 204 of file CrystalFieldFunction.h.

Referenced by buildTargetFunction(), checkTargetFunction(), setAttribute(), setParameter(), and updateTargetFunction().

◆ m_fixResetCache

std::vector<bool> Mantid::CurveFitting::Functions::CrystalFieldFunction::m_fixResetCache
mutableprivate

Definition at line 215 of file CrystalFieldFunction.h.

Referenced by buildSourceFunction(), and cacheSourceParameters().

◆ m_mapIndices2Names

std::vector<std::string> Mantid::CurveFitting::Functions::CrystalFieldFunction::m_mapIndices2Names
mutableprivate

Map parameter indices to names.

Definition at line 208 of file CrystalFieldFunction.h.

Referenced by makeMaps(), makeMapsForFunction(), parameterIndex(), and parameterName().

◆ m_mapNames2Indices

std::unordered_map<std::string, size_t> Mantid::CurveFitting::Functions::CrystalFieldFunction::m_mapNames2Indices
mutableprivate

Map parameter names to indices.

Definition at line 206 of file CrystalFieldFunction.h.

Referenced by makeMaps(), makeMapsForFunction(), and parameterIndex().

◆ m_mapPrefixes2PhysProps

std::unordered_map<std::string, API::IFunction_sptr> Mantid::CurveFitting::Functions::CrystalFieldFunction::m_mapPrefixes2PhysProps
mutableprivate

Map parameter/attribute prefixes to pointers to phys prop functions.

Definition at line 212 of file CrystalFieldFunction.h.

Referenced by buildMultiSiteMultiSpectrum(), buildSingleSiteMultiSpectrum(), getAttributeReference(), updateMultiSiteMultiSpectrum(), and updateSingleSiteMultiSpectrum().

◆ m_nControlParams

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::m_nControlParams
mutableprivate

◆ m_nControlSourceParams

size_t Mantid::CurveFitting::Functions::CrystalFieldFunction::m_nControlSourceParams
mutableprivate

◆ m_parameterResetCache

std::vector<double> Mantid::CurveFitting::Functions::CrystalFieldFunction::m_parameterResetCache
mutableprivate

Temporary cache for parameter values during source function resetting.

Definition at line 214 of file CrystalFieldFunction.h.

Referenced by buildSourceFunction(), and cacheSourceParameters().

◆ m_source

API::IFunction_sptr Mantid::CurveFitting::Functions::CrystalFieldFunction::m_source
mutableprivate

◆ m_target

API::CompositeFunction_sptr Mantid::CurveFitting::Functions::CrystalFieldFunction::m_target
mutableprivate

The documentation for this class was generated from the following files: