29 auto it = params->find(param);
30 if (it != params->end()) {
92 std::transform(destUnitName.begin(), destUnitName.end(), destUnitName.begin(), toupper);
93 auto iter = it->second.find(destUnitName);
95 if (iter == it->second.end())
99 factor = iter->second.first;
100 power = iter->second.second;
115 std::transform(to.begin(), to.end(), to.begin(), toupper);
148void Unit::toTOF(std::vector<double> &xdata, std::vector<double>
const &ydata,
const double &_l1,
const int &_emode,
149 std::initializer_list<std::pair<const UnitParams, double>> params) {
151 toTOF(xdata, ydata, _l1, _emode, paramsMap);
154void Unit::toTOF(std::vector<double> &xdata, std::vector<double>
const &ydata,
const double &_l1,
const int &_emode,
158 size_t numX = xdata.size();
159 for (
size_t i = 0; i < numX; i++)
178void Unit::fromTOF(std::vector<double> &xdata, std::vector<double>
const &ydata,
const double &_l1,
const int &_emode,
179 std::initializer_list<std::pair<const UnitParams, double>> params) {
181 fromTOF(xdata, ydata, _l1, _emode, paramsMap);
184void Unit::fromTOF(std::vector<double> &xdata, std::vector<double>
const &ydata,
const double &_l1,
const int &_emode,
188 size_t numX = xdata.size();
189 for (
size_t i = 0; i < numX; i++)
209 return std::pair<double, double>(std::min(u1, u2), std::max(u1, u2));
309 :
Unit(),
efixed(0.), sfpTo(DBL_MIN), factorTo(DBL_MIN), sfpFrom(DBL_MIN), factorFrom(DBL_MIN), do_sfpFrom(false) {
310 const double AngstromsSquared = 1e20;
313 addConversion(
"Energy", factor, -2.0);
315 addConversion(
"Momentum", 2 * M_PI, -1.0);
322 throw std::runtime_error(
"An l2 value must be supplied in the extra "
323 "parameters when initialising " +
324 this->
unitID() +
" for conversion via TOF");
327 throw std::runtime_error(
"An efixed value must be supplied in the extra "
328 "parameters when initialising " +
329 this->
unitID() +
" for conversion via TOF");
337 double TOFisinMicroseconds = 1e6;
338 double toAngstroms = 1e10;
348 }
else if (
emode == 2) {
357 factorTo *= TOFisinMicroseconds / toAngstroms;
368 }
else if (
emode == 2)
384 factorFrom *= toAngstroms / TOFisinMicroseconds;
436 const double toAngstroms = 1e10;
437 const double factor =
445 throw std::runtime_error(
"An l2 value must be supplied in the extra "
446 "parameters when initialising " +
447 this->
unitID() +
" for conversion via TOF");
455 const double TOFinMicroseconds = 1e6;
459 const double TOFisinMicroseconds = 1e-12;
460 const double ltot =
l1 +
l2;
498 const double toAngstroms = 1e10;
499 const double factor =
509 throw std::runtime_error(
"An l2 value must be supplied in the extra "
510 "parameters when initialising " +
511 this->
unitID() +
" for conversion via TOF");
519 const double TOFinMicroseconds = 1e6;
522 (
l1 +
l2) * TOFinMicroseconds;
525 const double TOFisinMicroseconds = 1e-12;
526 const double ltot =
l1 +
l2;
566 const double binWidth) {
567 const double sinTheta = std::sin(twotheta / 2.0);
592 std::stringstream msg;
593 msg <<
"Encountered offset of " << offset <<
" which converts data to negative d-spacing\n";
594 throw std::logic_error(msg.str());
597 auto sinTheta = std::sin(
twoTheta / 2);
599 const double numerator = (1.0 + offset);
600 sinTheta *= (l1 +
l2);
608 const double factor = 2.0 * M_PI;
609 addConversion(
"MomentumTransfer", factor, -1.0);
610 addConversion(
"QSquared", (factor * factor), -2.0);
618 double difc_set = 0.;
622 double difa_set = 0.;
624 if ((difa_set == 0) && (difc_set == 0)) {
625 toDSpacingError =
"Cannot convert to d spacing with DIFA=0 and DIFC=0";
629 toDSpacingError =
"A positive difc value must be supplied in the extra parameters when "
631 this->
unitID() +
" for conversion via TOF";
635 throw std::runtime_error(
"A difc value or L2/two theta must be supplied "
636 "in the extra parameters when initialising " +
637 this->
unitID() +
" for conversion via TOF");
672 throw std::runtime_error(
"dSpacingBase::singleToTOF called before object "
673 "has been initialized.");
699 throw std::runtime_error(
"dSpacingBase::singleFromTOF called before object "
700 "has been initialized.");
706 const double negativeConstantTerm = tof -
tzero;
712 return negativeConstantTerm /
difc;
717 throw std::runtime_error(
"Cannot convert to d spacing because tzero > time-of-flight and difa is positive. "
718 "Quadratic doesn't have a positive root");
732 const double sqrtTerm = 1 + 4 *
difa * negativeConstantTerm / (
difc *
difc);
734 throw std::runtime_error(
"Cannot convert to d spacing. Quadratic doesn't have real roots");
738 if (negativeConstantTerm < 0)
740 return negativeConstantTerm / (0.5 *
difc * (1 - sqrt(sqrtTerm)));
743 return negativeConstantTerm / (0.5 *
difc * (1 + sqrt(sqrtTerm)));
754 if (TOFmin < std::numeric_limits<double>::min()) {
768 if (std::isinf(TOFmax)) {
803 throw std::runtime_error(
"A l2 value must be supplied in the extra parameters when "
805 this->
unitID() +
" for conversion via TOF");
808 throw std::runtime_error(
"A two theta value must be supplied in the extra parameters when "
810 this->
unitID() +
" for conversion via TOF");
821 const double TOFisinMicroseconds = 1e6;
822 const double toAngstroms = 1e10;
823 factorTo *= TOFisinMicroseconds / toAngstroms;
827 double cos_theta = cos(
twoTheta / 2.0);
830 sfpTo = 2.0 * log(cos_theta);
835 double sqrtarg =
x *
x +
sfpTo;
837 if (sqrtarg < 1.0e-17)
843 return sqrt(temp * temp -
sfpFrom);
862 const double factor = 2.0 * M_PI;
867 double difc_set = 0.;
870 throw std::runtime_error(
"A difc value or L2/two theta must be supplied "
871 "in the extra parameters when initialising " +
872 this->
unitID() +
" for conversion via TOF");
911 const double factor = 2.0 * M_PI;
920 double tofmax = 2 * M_PI *
difc / sqrt(DBL_MIN);
921 if (std::isinf(tofmax))
937 :
Unit(), factorTo(DBL_MIN), factorFrom(DBL_MIN), t_other(DBL_MIN), t_otherFrom(DBL_MIN), unitScaling(DBL_MIN) {
944 throw std::invalid_argument(
"emode must be equal to 1 or 2 for energy transfer calculation");
950 throw std::invalid_argument(
"efixed must be set for energy transfer calculation");
952 throw std::runtime_error(
"efixed must be set for energy transfer calculation");
955 if (efixed_set <= 0) {
956 throw std::runtime_error(
"efixed must be greater than zero");
959 throw std::runtime_error(
"A l2 value must be supplied in the extra parameters when "
961 this->
unitID() +
" for conversion via TOF");
969 const double TOFinMicroseconds = 1e6;
975 }
else if (
emode == 2) {
988 }
else if (
emode == 2) {
1005 const double this_t =
factorTo / sqrt(e2);
1008 }
else if (
emode == 2) {
1014 const double this_t =
factorTo / sqrt(e1);
1029 const double e2 =
factorFrom / (this_t * this_t);
1032 }
else if (
emode == 2) {
1038 const double e1 =
factorFrom / (this_t * this_t);
1046 double time(DBL_MAX);
1118 :
Unit(),
efixed(0.), sfpTo(DBL_MIN), factorTo(DBL_MIN), sfpFrom(DBL_MIN), factorFrom(DBL_MIN), do_sfpFrom(false) {
1120 const double AngstromsSquared = 1e20;
1132 throw std::runtime_error(
"An l2 value must be supplied in the extra parameters when "
1133 "initialising momentum for conversion via TOF");
1136 throw std::runtime_error(
"An efixed value must be supplied in the extra parameters when "
1137 "initialising momentum for conversion via TOF");
1145 double TOFisinMicroseconds = 1e6;
1146 double toAngstroms = 1e10;
1156 }
else if (
emode == 2) {
1165 factorTo *= TOFisinMicroseconds / toAngstroms;
1176 }
else if (
emode == 2)
1191 factorFrom *= toAngstroms / TOFisinMicroseconds;
1244 throw std::invalid_argument(
"efixed must be set for spin echo length calculation");
1246 throw std::invalid_argument(
"emode must be equal to 0 for spin echo length calculation");
1252 double wavelength = sqrt(
x /
efixed);
1262 double sel = sqrt(DBL_MAX);
1272 double x =
efixed * wavelength * wavelength;
1294 throw std::invalid_argument(
"efixed must be set for spin echo time calculation");
1296 throw std::invalid_argument(
"emode must be equal to 0 for spin echo time calculation");
1302 double wavelength = pow(
x /
efixed, 1.0 / 3.0);
1308 double tm = std::pow(DBL_MAX, 1. / 3.);
1316 double x =
efixed * wavelength * wavelength * wavelength;
1338 throw std::runtime_error(
"Time is not allowed to be convert to TOF. ");
1343 throw std::runtime_error(
"Time is not allowed to be converted from TOF. ");
1366 throw std::runtime_error(
"Degrees is not allowed to be converted to TOF. ");
1371 throw std::runtime_error(
"Degrees is not allowed to be converted from TOF. ");
1394 throw std::runtime_error(
"Temperature is not allowed to be converted to TOF. ");
1399 throw std::runtime_error(
"Temperature is not allowed to be converted from TOF. ");
1420 throw std::runtime_error(
"Atomic Distance is not allowed to be converted to TOF. ");
1425 throw std::runtime_error(
"Atomic Distance is not allowed to be converted from TOF. ");
1431 std::map<std::string, double> timesList;
1432 double seconds = 1.0e9;
1433 double milliseconds = 1.0e-3 * seconds;
1434 double microseconds = 1.0e-3 * milliseconds;
1435 double nanoseconds = 1.0e-3 * microseconds;
1437 timesList[
"seconds"] = seconds;
1438 timesList[
"second"] = seconds;
1439 timesList[
"s"] = seconds;
1440 timesList[
"milliseconds"] = milliseconds;
1441 timesList[
"millisecond"] = milliseconds;
1442 timesList[
"ms"] = milliseconds;
1443 timesList[
"microseconds"] = microseconds;
1444 timesList[
"microsecond"] = microseconds;
1445 timesList[
"us"] = microseconds;
1446 timesList[
"nanoseconds"] = nanoseconds;
1447 timesList[
"nanosecond"] = nanoseconds;
1448 timesList[
"ns"] = nanoseconds;
1450 double input_float = timesList[input_unit];
1451 double output_float = timesList[output_unit];
1452 if (input_float == 0)
1453 throw std::runtime_error(
"timeConversionValue: input unit " + input_unit +
" not known.");
1454 if (output_float == 0)
1455 throw std::runtime_error(
"timeConversionValue: output unit " + input_unit +
" not known.");
1456 return input_float / output_float;
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
#define DECLARE_UNIT(classname)
Marks code as not implemented yet.
void warning(const std::string &msg)
Logs at warning level.
A base-class for the a class that is able to return unit labels in different representations.
The base units (abstract) class.
const UnitParametersMap * m_params
additional parameters l2 :: distance from sample to detector (in metres) twoTheta :: scattering angle...
bool operator!=(const Unit &u) const
virtual void init()=0
Finalize the initialization.
virtual std::pair< double, double > conversionRange() const
The range where conversion to TOF from given units is monotonic and reversible.
virtual double conversionTOFMin() const =0
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
virtual double conversionTOFMax() const =0
This function returns maximal TOF value still reversibly convertible into the unit.
virtual double singleToTOF(const double x) const =0
Convert a single X value to TOF.
void fromTOF(std::vector< double > &xdata, std::vector< double > const &ydata, const double &_l1, const int &_emode, std::initializer_list< std::pair< const UnitParams, double > > params)
Convert from time-of-flight to the concrete unit.
bool initialized
The unit values have been initialized.
void initialize(const double &_l1, const int &_emode, const UnitParametersMap ¶ms)
Initialize the unit to perform conversion using singleToTof() and singleFromTof()
void toTOF(std::vector< double > &xdata, std::vector< double > const &ydata, const double &_l1, const int &_emode, std::initializer_list< std::pair< const UnitParams, double > > params)
Convert from the concrete unit to time-of-flight.
Unit()
(Empty) Constructor
tbb::concurrent_unordered_map< std::string, UnitConversions > ConversionsMap
The possible 'quick conversions' are held in a map with the starting unit as the key.
double convertSingleToTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap ¶ms)
Convert from the concrete unit to time-of-flight. TOF is in microseconds.
virtual const std::string unitID() const =0
The name of the unit.
double convertSingleFromTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap ¶ms)
Convert from the time-of-flight to the concrete unit. TOF is in microseconds.
virtual double singleFromTOF(const double tof) const =0
Convert a single tof value to this unit.
bool quickConversion(const Unit &destination, double &factor, double &power) const
Is conversion by constant multiplication possible?
double l1
l1 :: The source-sample distance (in metres)
bool operator==(const Unit &u) const
static ConversionsMap s_conversionFactors
The table of possible 'quick conversions'.
int emode
emode :: The energy mode (0=elastic, 1=direct geometry, 2=indirect geometry)
bool isInitialized() const
void addConversion(std::string to, const double &factor, const double &power=1.0) const
Add a 'quick conversion' from the unit class on which this method is called.
virtual void validateUnitParams(const int emode, const UnitParametersMap ¶ms)
Atomic Distance in Angstroms.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
const UnitLabel label() const override
A label for the unit to be printed on axes,.
Unit * clone() const override
Degrees that has degrees as unit and "Scattering angle" as title.
Unit * clone() const override
const UnitLabel label() const override
A label for the unit to be printed on axes,.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
Energy transfer in units of frequency (MHz)
DeltaE_inFrequency()
Constructor.
void init() override
Finalize the initialization.
Unit * clone() const override
Energy transfer in units of wavenumber (cm^-1)
Unit * clone() const override
DeltaE_inWavenumber()
Constructor.
void init() override
Finalize the initialization.
Energy transfer in milli-electronvolts.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
const std::string unitID() const override
"DeltaE"
Unit * clone() const override
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
void init() override
Finalize the initialization.
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
double factorFrom
Constant factor for from conversion.
double factorTo
Constant factor for to conversion.
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
double t_otherFrom
Energy mode dependent factor in from conversion.
double unitScaling
Apply unit scaling to energy value.
double t_other
Energy mode dependent factor in to conversion.
double conversionTOFMin() const override
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
void init() override
Finalize the initialization.
Unit * clone() const override
double conversionTOFMax() const override
const std::string unitID() const override
"Empty"
Absolute energy in units of wavenumber (cm^-1)
const std::string unitID() const override
"Energy_inWavenumber"
double factorFrom
Constant factor for from conversion.
Unit * clone() const override
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
double factorTo
Constant factor for to conversion.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
void init() override
Finalize the initialization.
Energy_inWavenumber()
Constructor.
double conversionTOFMin() const override
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
Energy in milli-electronvolts.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
const std::string unitID() const override
"Energy"
void init() override
Finalize the initialization.
double conversionTOFMin() const override
Unit * clone() const override
double factorTo
Constant factor for to conversion.
double factorFrom
Constant factor for from conversion.
const std::string caption() const override
The full name of the unit.
std::string m_caption
Caption.
const UnitLabel label() const override
A label for the unit to be printed on axes,.
Unit * clone() const override
void setLabel(const std::string &cpt, const UnitLabel &lbl=UnitLabel(""))
Set a caption and a label.
Momentum Transfer in Angstrom^-1.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
Unit * clone() const override
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
const std::string unitID() const override
"MomentumTransfer"
MomentumTransfer()
Constructor.
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
void init() override
Finalize the initialization.
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double sfpTo
Extra correction factor in to conversion.
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
double sfpFrom
Extra correction factor in from conversion.
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
void init() override
Finalize the initialization.
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
bool do_sfpFrom
Apply the sfpFrom value.
double singleToTOF(const double ki) const override
Convert a single X value to TOF.
Unit * clone() const override
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double factorTo
Constant factor for to conversion.
double factorFrom
Constant factor for from conversion.
Phi that has degrees as unit and "Phi" as title.
Momentum transfer squared in Angstrom^-2.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
Unit * clone() const override
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
SpinEchoLength()
Constructor.
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
Unit * clone() const override
void init() override
Finalize the initialization.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
SpinEchoTime()
Constructor.
void init() override
Finalize the initialization.
Unit * clone() const override
A simple class containing common symbol types.
static const UnitLabel InverseAngstrom
InverseAngstrom.
static const UnitLabel InverseAngstromSq
InverseAngstromSq.
static const UnitLabel Microsecond
Microsecond.
static const UnitLabel Angstrom
Angstrom.
static const UnitLabel Second
Second.
static const UnitLabel Nanometre
Nanometre.
static const UnitLabel MilliElectronVolts
MilliElectronVolts.
static const UnitLabel Nanosecond
Nanosecond.
static const UnitLabel GHz
GHz.
static const UnitLabel InverseCM
Inverse centimeters.
static const UnitLabel EmptyLabel
Empty label.
Time of flight in microseconds.
void init() override
Finalize the initialization.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
Unit * clone() const override
double conversionTOFMax() const override
double singleToTOF(const double x) const override
Convert a single X value to TOF.
double conversionTOFMin() const override
const UnitLabel label() const override
A label for the unit to be printed on axes,.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
Unit * clone() const override
double singleToTOF(const double x) const override
Convert a single X value to TOF.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
void init() override
Finalize the initialization.
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
Unit * clone() const override
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
const UnitLabel label() const override
A label for the unit to be printed on axes,.
const std::string unitID() const override
"Wavelength"
bool do_sfpFrom
Apply the sfpFrom value.
double sfpFrom
Extra correction factor in from conversion.
void init() override
Finalize the initialization.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
double factorTo
Constant factor for to conversion.
double sfpTo
Extra correction factor in to conversion.
double conversionTOFMin() const override
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
double conversionTOFMax() const override
double factorFrom
Constant factor for from conversion.
Unit * clone() const override
d-SpacingPerpendicular in Angstrom
Unit * clone() const override
dSpacingPerpendicular()
Constructor.
double sfpFrom
Extra correction factor in to conversion.
double factorFrom
Constant factor for from conversion.
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
double factorTo
Constant factor for to conversion.
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
const std::string unitID() const override
"dSpacingPerpendicular"
void init() override
Finalize the initialization.
double sfpTo
Extra correction factor in to conversion.
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
std::string toDSpacingError
double conversionTOFMax() const override
This function returns maximal TOF value still reversibly convertible into the unit.
const UnitLabel label() const override
A label for the unit to be printed on axes,.
const std::string unitID() const override
"dSpacing"
void validateUnitParams(const int emode, const UnitParametersMap ¶ms) override
double conversionTOFMin() const override
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
Unit * clone() const override
double calcTofMax(const double difc, const double difa, const double tzero, const double tofmax=0.)
void init() override
Finalize the initialization.
double calcTofMin(const double difc, const double difa, const double tzero, const double tofmin=0.)
double singleFromTOF(const double tof) const override
DIFA * d^2 + DIFC * d + T0 - TOF = 0.
double singleToTOF(const double x) const override
Convert a single X value to TOF.
Logger g_log("DateAndTime")
MANTID_KERNEL_DLL double calculateDIFCCorrection(const double l1, const double l2, const double twotheta, const double offset, const double binWidth)
Calculate DIFC in case of logarithmic binning, used in CalculateDIFC with Signed mode.
MANTID_KERNEL_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta, const double offset)
Calculate and return conversion factor from tof to d-spacing.
const double H_OVER_NEUTRON_MASS
MANTID_KERNEL_DLL double timeConversionValue(const std::string &input_unit, const std::string &output_unit)
const double NEUTRON_MASS_OVER_H
std::unordered_map< UnitParams, double > UnitParametersMap
static constexpr double meVtoFrequency
1 meV in frequency (GHz).
static constexpr double NeutronMass
Mass of the neutron in kg.
static constexpr double h
Planck constant in J*s.
static constexpr double meVtoWavenumber
1 meV in wavenumber (cm-1).
static constexpr double meV
1 meV in Joules.