Mantid
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
Mantid::Kernel::Material Class Referencefinal

A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAtom, with the following properties: More...

#include <Material.h>

Classes

struct  FormulaUnit
 Structure to hold the information for a parsed chemical formula. More...
 

Public Types

using ChemicalFormula = std::vector< FormulaUnit >
 

Public Member Functions

const Material::ChemicalFormulachemicalFormula () const
 
 Material ()
 Default constructor. More...
 
 Material (std::string name, const ChemicalFormula &formula, const double numberDensity, const double packingFraction=1, const double temperature=300, const double pressure=PhysicalConstants::StandardAtmosphere)
 Construct a material from a known element, with optional temperature and pressure. More...
 
 Material (std::string name, const PhysicalConstants::NeutronAtom &atom, const double numberDensity, const double packingFraction=1, const double temperature=300, const double pressure=PhysicalConstants::StandardAtmosphere)
 Construct a material object. More...
 
const std::string & name () const
 Returns the name of the material. More...
 
void setAttenuationProfile (AttenuationProfile attenuationOverride)
 Allow an explicit attenuation profile to be loaded onto the material that overrides the standard linear absorption coefficient. More...
 
void setXRayAttenuationProfile (AttenuationProfile attenuationProfile)
 
virtual ~Material ()=default
 Virtual destructor. More...
 

Static Public Member Functions

static ChemicalFormula parseChemicalFormula (const std::string &chemicalSymbol)
 

Material properties

std::string m_name
 Material name. More...
 
ChemicalFormula m_chemicalFormula
 The normalized chemical formula. More...
 
double m_atomTotal
 Total number of atoms. More...
 
double m_numberDensity
 Number density in atoms per A^-3. More...
 
double m_packingFraction
 Packing fraction should be between 0 and 2. More...
 
double m_temperature
 Temperature. More...
 
double m_pressure
 Pressure. More...
 
double m_linearAbsorpXSectionByWL
 
double m_totalScatterXSection
 
boost::optional< AttenuationProfilem_attenuationOverride
 
boost::optional< AttenuationProfilem_xRayAttenuationProfile
 
double numberDensity () const
 Get the number density. More...
 
double numberDensityEffective () const
 Get the effective number density. More...
 
double packingFraction () const
 Get the packing fraction. More...
 
double totalAtoms () const
 The total number of atoms in the formula. More...
 
double temperature () const
 Get the temperature. More...
 
double pressure () const
 Get the pressure. More...
 
double cohScatterXSection () const
 Get the coherent scattering cross section for a given wavelength in barns. More...
 
double incohScatterXSection () const
 Get the incoherent cross section for a given wavelength in barns. More...
 
double totalScatterXSection () const
 Return the total scattering cross section for a given wavelength in barns. More...
 
double absorbXSection (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the absorption cross section at a given wavelength in barns. More...
 
double attenuationCoefficient (const double lambda) const
 
double attenuation (const double distance, const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Compute the attenuation at a given wavelength over the given distance. More...
 
double xRayAttenuation (const double distance, const double energy) const
 Compute the x-ray attenuation at a given energy over the given distance. More...
 
double linearAbsorpCoef (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Returns the linear coefficient of absorption for the material in units of cm^-1 this should match the implementation of the iterator version. More...
 
std::vector< double > linearAbsorpCoef (std::vector< double >::const_iterator lambdaBegin, std::vector< double >::const_iterator lambdaEnd) const
 Returns the linear coefficient of absorption for the material in units of cm^-1 this should match the implementation of the scalar version. More...
 
double cohScatterLength (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the coherent scattering length for a given wavelength in fm. More...
 
double incohScatterLength (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the incoherent length for a given wavelength in fm. More...
 
double totalScatterLength (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Return the total scattering length for a given wavelength in fm. More...
 
double cohScatterLengthReal (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the coherent scattering length for a given wavelength in fm. More...
 
double cohScatterLengthImg (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the coherent scattering length for a given wavelength in fm. More...
 
double incohScatterLengthReal (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the incoherent length for a given wavelength in fm. More...
 
double incohScatterLengthImg (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the incoherent length for a given wavelength in fm. More...
 
double cohScatterLengthSqrd (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the coherent scattering length squared, \(<b>^2\), for a given wavelength in \(fm^2\). More...
 
double incohScatterLengthSqrd (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Get the incoherent length squared, \(<b>^2\), for a given wavelength in \(fm^2\). More...
 
double totalScatterLengthSqrd (const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
 Return the total scattering length squared, \(<b^2>\), for a given wavelength in \(fm^2\). More...
 
void saveNexus (::NeXus::File *file, const std::string &group) const
 Save the object to an open NeXus file. More...
 
void loadNexus (::NeXus::File *file, const std::string &group)
 Load the object from an open NeXus file. More...
 
bool hasValidXRayAttenuationProfile ()
 
void countAtoms ()
 Update the total atom count. More...
 
void calculateLinearAbsorpXSectionByWL ()
 Update the linear absorption x section (by wavelength) More...
 
void calculateTotalScatterXSection ()
 Update the total scatter x section. More...
 

Detailed Description

A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAtom, with the following properties:

To understand how the effective scattering information is calculated, see Sears, Varley F. "Neutron scattering lengths and cross sections." Neutron news 3.3 (1992): 26-37. To highlight a point that may be missed, the absorption is the only quantity that is wavelength dependent.

Definition at line 50 of file Material.h.

Member Typedef Documentation

◆ ChemicalFormula

Definition at line 60 of file Material.h.

Constructor & Destructor Documentation

◆ Material() [1/3]

Mantid::Kernel::Material::Material ( )

Default constructor.

Construct an "empty" material.

Required for other parts of the code to function correctly. The material is considered "empty"

Everything returns zero

Definition at line 66 of file Material.cpp.

◆ Material() [2/3]

Mantid::Kernel::Material::Material ( std::string  name,
const ChemicalFormula formula,
const double  numberDensity,
const double  packingFraction = 1,
const double  temperature = 300,
const double  pressure = PhysicalConstants::StandardAtmosphere 
)
explicit

Construct a material from a known element, with optional temperature and pressure.

Construct a material object.

Parameters
name:: The name of the material
formula:: The chemical formula
numberDensity:: Density in atoms / Angstrom^3
packingFraction:: Packing fraction of material
temperature:: The temperature in Kelvin (Default = 300K)
pressure:: Pressure in kPa (Default: 101.325 kPa)

Definition at line 79 of file Material.cpp.

References calculateLinearAbsorpXSectionByWL(), calculateTotalScatterXSection(), countAtoms(), and m_chemicalFormula.

◆ Material() [3/3]

Mantid::Kernel::Material::Material ( std::string  name,
const PhysicalConstants::NeutronAtom atom,
const double  numberDensity,
const double  packingFraction = 1,
const double  temperature = 300,
const double  pressure = PhysicalConstants::StandardAtmosphere 
)
explicit

Construct a material object.

Parameters
name:: The name of the material
atom:: The neutron atom to take scattering infrmation from
numberDensity:: Density in atoms / Angstrom^3
packingFraction:: Packing fraction of material
temperature:: The temperature in Kelvin (Default = 300K)
pressure:: Pressure in kPa (Default: 101.325 kPa)

Definition at line 98 of file Material.cpp.

References Mantid::PhysicalConstants::NeutronAtom::a_number, calculateLinearAbsorpXSectionByWL(), calculateTotalScatterXSection(), m_chemicalFormula, and Mantid::PhysicalConstants::NeutronAtom::z_number.

◆ ~Material()

virtual Mantid::Kernel::Material::~Material ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ absorbXSection()

double Mantid::Kernel::Material::absorbXSection ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

◆ attenuation()

double Mantid::Kernel::Material::attenuation ( const double  distance,
const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda 
) const

Compute the attenuation at a given wavelength over the given distance.

Parameters
distanceDistance (m) travelled
lambdaWavelength (Angstroms) to compute the attenuation (default = reference lambda)
Returns
The dimensionless attenuation factor

Definition at line 281 of file Material.cpp.

References attenuationCoefficient(), and lambda.

◆ attenuationCoefficient()

double Mantid::Kernel::Material::attenuationCoefficient ( const double  lambda) const
Parameters
lambdaWavelength (Angstroms) to compute the attenuation (default = reference lambda)
Returns
The attenuation coefficient in m-1

Definition at line 267 of file Material.cpp.

References absorbXSection(), lambda, m_attenuationOverride, numberDensityEffective(), and totalScatterXSection().

Referenced by attenuation(), and Mantid::Kernel::AttenuationProfile::AttenuationProfile().

◆ calculateLinearAbsorpXSectionByWL()

void Mantid::Kernel::Material::calculateLinearAbsorpXSectionByWL ( )
private

Update the linear absorption x section (by wavelength)

Calculate the absorption cross section for a given wavelength according to Sears eqn 14.

Store result as a cross section per wavelength to enable the result to be reused to calculate the cross section for specific wavelengths (assuming linear dependence on the wavelength) with the reference wavelength = NeutronAtom::ReferenceLambda angstroms.

Definition at line 128 of file Material.cpp.

References m_atomTotal, m_chemicalFormula, m_linearAbsorpXSectionByWL, Mantid::PhysicalConstants::NeutronAtom::ReferenceLambda, and right.

Referenced by loadNexus(), and Material().

◆ calculateTotalScatterXSection()

void Mantid::Kernel::Material::calculateTotalScatterXSection ( )
private

Update the total scatter x section.

Definition at line 150 of file Material.cpp.

References m_atomTotal, m_chemicalFormula, m_totalScatterXSection, and right.

Referenced by loadNexus(), and Material().

◆ chemicalFormula()

const Material::ChemicalFormula & Mantid::Kernel::Material::chemicalFormula ( ) const

Definition at line 183 of file Material.cpp.

References m_chemicalFormula.

◆ cohScatterLength()

double Mantid::Kernel::Material::cohScatterLength ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the coherent scattering length for a given wavelength in fm.

According to Sears eqn 12.

Definition at line 328 of file Material.cpp.

References cohScatterLengthImg(), cohScatterLengthReal(), lambda, m_chemicalFormula, and UNUSED_ARG.

Referenced by Mantid::Algorithms::PDFFourierTransform2::exec(), and export_Material().

◆ cohScatterLengthImg()

double Mantid::Kernel::Material::cohScatterLengthImg ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the coherent scattering length for a given wavelength in fm.

Sears eqn 12.

Definition at line 369 of file Material.cpp.

References lambda, m_atomTotal, m_chemicalFormula, right, and UNUSED_ARG.

Referenced by cohScatterLength(), cohScatterLengthSqrd(), cohScatterXSection(), and export_Material().

◆ cohScatterLengthReal()

double Mantid::Kernel::Material::cohScatterLengthReal ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the coherent scattering length for a given wavelength in fm.

Sears eqn 12.

Definition at line 349 of file Material.cpp.

References lambda, m_atomTotal, m_chemicalFormula, right, and UNUSED_ARG.

Referenced by cohScatterLength(), cohScatterLengthSqrd(), cohScatterXSection(), and export_Material().

◆ cohScatterLengthSqrd()

double Mantid::Kernel::Material::cohScatterLengthSqrd ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the coherent scattering length squared, \(<b>^2\), for a given wavelength in \(fm^2\).

Definition at line 442 of file Material.cpp.

References cohScatterLengthImg(), cohScatterLengthReal(), lambda, and UNUSED_ARG.

Referenced by export_Material().

◆ cohScatterXSection()

double Mantid::Kernel::Material::cohScatterXSection ( ) const

Get the coherent scattering cross section for a given wavelength in barns.

Get the coherent scattering cross section according to Sears eqn 7.

Returns
The value of the coherent scattering cross section.

Definition at line 228 of file Material.cpp.

References cohScatterLengthImg(), cohScatterLengthReal(), and m_chemicalFormula.

Referenced by export_Material(), and incohScatterXSection().

◆ countAtoms()

void Mantid::Kernel::Material::countAtoms ( )
private

Update the total atom count.

Definition at line 114 of file Material.cpp.

References m_atomTotal, m_chemicalFormula, and right.

Referenced by loadNexus(), and Material().

◆ hasValidXRayAttenuationProfile()

bool Mantid::Kernel::Material::hasValidXRayAttenuationProfile ( )

Definition at line 300 of file Material.cpp.

References m_xRayAttenuationProfile.

◆ incohScatterLength()

double Mantid::Kernel::Material::incohScatterLength ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the incoherent length for a given wavelength in fm.

According to Sears eqn 7.

Definition at line 339 of file Material.cpp.

References incohScatterLengthImg(), incohScatterLengthReal(), lambda, m_chemicalFormula, and UNUSED_ARG.

Referenced by export_Material().

◆ incohScatterLengthImg()

double Mantid::Kernel::Material::incohScatterLengthImg ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the incoherent length for a given wavelength in fm.

Not explicitly in Sears, but following eqn 12.

Definition at line 411 of file Material.cpp.

References lambda, m_atomTotal, m_chemicalFormula, right, and UNUSED_ARG.

Referenced by export_Material(), and incohScatterLength().

◆ incohScatterLengthReal()

double Mantid::Kernel::Material::incohScatterLengthReal ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the incoherent length for a given wavelength in fm.

Not explicitly in Sears, but following eqn 12.

Definition at line 390 of file Material.cpp.

References lambda, m_atomTotal, m_chemicalFormula, right, and UNUSED_ARG.

Referenced by export_Material(), and incohScatterLength().

◆ incohScatterLengthSqrd()

double Mantid::Kernel::Material::incohScatterLengthSqrd ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Get the incoherent length squared, \(<b>^2\), for a given wavelength in \(fm^2\).

Definition at line 465 of file Material.cpp.

References incohScatterXSection(), lambda, and UNUSED_ARG.

Referenced by export_Material().

◆ incohScatterXSection()

double Mantid::Kernel::Material::incohScatterXSection ( ) const

Get the incoherent cross section for a given wavelength in barns.

Get the incoherent scattering cross section according to Sears eqn 16.

Returns
The value of the coherent scattering cross section.

Definition at line 240 of file Material.cpp.

References cohScatterXSection(), m_chemicalFormula, and totalScatterXSection().

Referenced by export_Material(), and incohScatterLengthSqrd().

◆ linearAbsorpCoef() [1/2]

double Mantid::Kernel::Material::linearAbsorpCoef ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Returns the linear coefficient of absorption for the material in units of cm^-1 this should match the implementation of the iterator version.

Definition at line 309 of file Material.cpp.

References absorbXSection(), lambda, and numberDensityEffective().

Referenced by Mantid::Algorithms::AbsorptionCorrection::exec(), and Mantid::Algorithms::PaalmanPingsAbsorptionCorrection::exec().

◆ linearAbsorpCoef() [2/2]

std::vector< double > Mantid::Kernel::Material::linearAbsorpCoef ( std::vector< double >::const_iterator  lambdaBegin,
std::vector< double >::const_iterator  lambdaEnd 
) const

Returns the linear coefficient of absorption for the material in units of cm^-1 this should match the implementation of the scalar version.

Definition at line 314 of file Material.cpp.

References lambda, and numberDensityEffective().

◆ loadNexus()

void Mantid::Kernel::Material::loadNexus ( ::NeXus::File *  file,
const std::string &  group 
)

◆ name()

const std::string & Mantid::Kernel::Material::name ( ) const

◆ numberDensity()

double Mantid::Kernel::Material::numberDensity ( ) const

◆ numberDensityEffective()

double Mantid::Kernel::Material::numberDensityEffective ( ) const

Get the effective number density.

Returns
The number density of the material in atoms / Angstrom^3

Definition at line 195 of file Material.cpp.

References m_numberDensity, and m_packingFraction.

Referenced by attenuationCoefficient(), export_Material(), linearAbsorpCoef(), Mantid::Algorithms::AbsorptionCorrection::retrieveBaseProperties(), and Mantid::Algorithms::PaalmanPingsAbsorptionCorrection::retrieveBaseProperties().

◆ packingFraction()

double Mantid::Kernel::Material::packingFraction ( ) const

Get the packing fraction.

This should be a number 0<f<=1. However, this is sometimes used as a fudge factor and is allowed to vary 0<f<2.

Returns
The packing fraction

Definition at line 202 of file Material.cpp.

References m_packingFraction.

Referenced by export_Material().

◆ parseChemicalFormula()

Material::ChemicalFormula Mantid::Kernel::Material::parseChemicalFormula ( const std::string &  chemicalSymbol)
static

◆ pressure()

double Mantid::Kernel::Material::pressure ( ) const

Get the pressure.

Returns
The pressure of the material, in kPa (Default: 101.325 kPa)

Definition at line 221 of file Material.cpp.

References m_pressure.

Referenced by export_Material().

◆ saveNexus()

void Mantid::Kernel::Material::saveNexus ( ::NeXus::File *  file,
const std::string &  group 
) const

Save the object to an open NeXus file.

Parameters
file:: open NeXus file
group:: name of the group to create

Definition at line 489 of file Material.cpp.

References m_chemicalFormula, m_name, m_numberDensity, m_packingFraction, m_pressure, and m_temperature.

◆ setAttenuationProfile()

void Mantid::Kernel::Material::setAttenuationProfile ( AttenuationProfile  attenuationOverride)

Allow an explicit attenuation profile to be loaded onto the material that overrides the standard linear absorption coefficient.

Definition at line 169 of file Material.cpp.

References m_attenuationOverride.

◆ setXRayAttenuationProfile()

void Mantid::Kernel::Material::setXRayAttenuationProfile ( AttenuationProfile  attenuationProfile)

Definition at line 173 of file Material.cpp.

References m_xRayAttenuationProfile.

◆ temperature()

double Mantid::Kernel::Material::temperature ( ) const

Get the temperature.

Returns
The temperature of the material in Kelvin

Definition at line 215 of file Material.cpp.

References m_temperature.

Referenced by export_Material().

◆ totalAtoms()

double Mantid::Kernel::Material::totalAtoms ( ) const

The total number of atoms in the formula.

The total number of atoms in the chemical formula.

This is commonly used to convert multiplicity into relative values.

Returns
The total number of atoms

Definition at line 209 of file Material.cpp.

References m_atomTotal.

Referenced by export_Material().

◆ totalScatterLength()

double Mantid::Kernel::Material::totalScatterLength ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Return the total scattering length for a given wavelength in fm.

Sears eqn 13.

Definition at line 432 of file Material.cpp.

References lambda, m_chemicalFormula, totalScatterXSection(), and UNUSED_ARG.

Referenced by export_Material().

◆ totalScatterLengthSqrd()

double Mantid::Kernel::Material::totalScatterLengthSqrd ( const double  lambda = PhysicalConstants::NeutronAtom::ReferenceLambda) const

Return the total scattering length squared, \(<b^2>\), for a given wavelength in \(fm^2\).

Definition at line 475 of file Material.cpp.

References lambda, totalScatterXSection(), and UNUSED_ARG.

Referenced by export_Material().

◆ totalScatterXSection()

double Mantid::Kernel::Material::totalScatterXSection ( ) const

◆ xRayAttenuation()

double Mantid::Kernel::Material::xRayAttenuation ( const double  distance,
const double  energy 
) const

Compute the x-ray attenuation at a given energy over the given distance.

Parameters
distanceDistance (m) travelled
energyKeV to compute the attenuation
Returns
The dimensionless attenuation factor

Definition at line 290 of file Material.cpp.

References energy, and m_xRayAttenuationProfile.

Member Data Documentation

◆ m_atomTotal

double Mantid::Kernel::Material::m_atomTotal
private

◆ m_attenuationOverride

boost::optional<AttenuationProfile> Mantid::Kernel::Material::m_attenuationOverride
private

Definition at line 199 of file Material.h.

Referenced by attenuationCoefficient(), and setAttenuationProfile().

◆ m_chemicalFormula

ChemicalFormula Mantid::Kernel::Material::m_chemicalFormula
private

◆ m_linearAbsorpXSectionByWL

double Mantid::Kernel::Material::m_linearAbsorpXSectionByWL
private

Definition at line 196 of file Material.h.

Referenced by absorbXSection(), and calculateLinearAbsorpXSectionByWL().

◆ m_name

std::string Mantid::Kernel::Material::m_name
private

Material name.

Definition at line 183 of file Material.h.

Referenced by loadNexus(), name(), and saveNexus().

◆ m_numberDensity

double Mantid::Kernel::Material::m_numberDensity
private

Number density in atoms per A^-3.

Definition at line 189 of file Material.h.

Referenced by loadNexus(), numberDensity(), numberDensityEffective(), and saveNexus().

◆ m_packingFraction

double Mantid::Kernel::Material::m_packingFraction
private

Packing fraction should be between 0 and 2.

Definition at line 191 of file Material.h.

Referenced by loadNexus(), numberDensityEffective(), packingFraction(), and saveNexus().

◆ m_pressure

double Mantid::Kernel::Material::m_pressure
private

Pressure.

Definition at line 195 of file Material.h.

Referenced by loadNexus(), pressure(), and saveNexus().

◆ m_temperature

double Mantid::Kernel::Material::m_temperature
private

Temperature.

Definition at line 193 of file Material.h.

Referenced by loadNexus(), saveNexus(), and temperature().

◆ m_totalScatterXSection

double Mantid::Kernel::Material::m_totalScatterXSection
private

Definition at line 197 of file Material.h.

Referenced by calculateTotalScatterXSection(), and totalScatterXSection().

◆ m_xRayAttenuationProfile

boost::optional<AttenuationProfile> Mantid::Kernel::Material::m_xRayAttenuationProfile
private

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