Commit 77f2159b authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Add method for total number of atoms

parent 76370556
......@@ -93,6 +93,8 @@ public:
double numberDensityEffective() const;
/// Get the packing fraction
double packingFraction() const;
/// The total number of atoms in the formula
double totalAtoms() const;
/// Get the temperature
double temperature() const;
/// Get the pressure
......
......@@ -202,6 +202,13 @@ double Material::numberDensityEffective() const { return m_numberDensity * m_pac
*/
double Material::packingFraction() const { return m_packingFraction; }
/**
* The total number of atoms in the chemical formula. This is commonly
* used to convert multiplicity into relative values.
* @return The total number of atoms
*/
double Material::totalAtoms() const { return m_atomTotal; }
/**
* Get the temperature
* @returns The temperature of the material in Kelvin
......
......@@ -63,6 +63,7 @@ public:
TS_ASSERT_EQUALS(material.numberDensity(), numberDensity);
TS_ASSERT_EQUALS(material.numberDensityEffective(), numberDensity);
TS_ASSERT_EQUALS(material.packingFraction(), 1.);
TS_ASSERT_EQUALS(material.totalAtoms(), 1.)
TS_ASSERT_EQUALS(material.temperature(), 300);
TS_ASSERT_EQUALS(material.pressure(), Mantid::PhysicalConstants::StandardAtmosphere);
......@@ -86,6 +87,7 @@ public:
TS_ASSERT_EQUALS(material.numberDensity(), numberDensity);
TS_ASSERT_EQUALS(material.numberDensityEffective(), numberDensity);
TS_ASSERT_EQUALS(material.packingFraction(), 1.);
TS_ASSERT_EQUALS(material.totalAtoms(), 1.)
// check everything with (default) reference wavelength
checkMatching(material, atom);
......@@ -104,6 +106,7 @@ public:
TS_ASSERT_EQUALS(TiZr.numberDensity(), numberDensity);
TS_ASSERT_EQUALS(TiZr.numberDensityEffective(), numberDensity * packingFraction);
TS_ASSERT_EQUALS(TiZr.packingFraction(), packingFraction);
TS_ASSERT_DELTA(TiZr.totalAtoms(), 3.082605, 1.e-5); // string to double changes value
TS_ASSERT_EQUALS(TiZr.cohScatterLengthImg(), 0.);
TS_ASSERT_DELTA(TiZr.cohScatterLengthReal(), 0., 1.e-5);
......
......@@ -73,6 +73,7 @@ void export_Material() {
"Packing fraction as a number, ideally, 0 to 1")
.add_property("temperature", make_function(&Material::temperature), "Temperature")
.add_property("pressure", make_function(&Material::pressure), "Pressure")
.add_property("totalAtoms", make_function(&Material::totalAtoms), "Total number of atoms")
#if PY_MAJOR_VERSION >= 3
.def("__bool__", &toBool, "Returns True if any of the scattering values are non-zero")
#else
......
......@@ -28,6 +28,7 @@ New Features
Improvements
############
- :py:obj:`mantid.kernel.Material` has a new attribute ``totalAtoms`` to aid in converting atom multiplicity to concentration
- :ref:`LoadNexusLogs <algm-LoadNexusLogs>` has additional parameters to allow or block specific logs from being loaded.
- :ref:`LoadEventNexus <algm-LoadEventNexus>` now utilizes the log filter provided by `LoadNexusLogs <algm-LoadNexusLogs>`.
- :ref:`CompareWorkspaces <algm-CompareWorkspaces>` now compares the positions of both source and sample (if extant) when property `checkInstrument` is set.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment