Mantid
|
Create a material from a set of user defined options. More...
#include <MaterialBuilder.h>
Classes | |
struct | density_packing |
Public Types | |
enum class | NumberDensityUnit { Atoms , FormulaUnits } |
Public Member Functions | |
Material | build () const |
Build the new Material object from the current set of options. More... | |
MaterialBuilder () | |
Constructor. More... | |
MaterialBuilder & | setAbsorptionXSection (double xsec) |
Set a value for the absorption cross section. More... | |
MaterialBuilder & | setAtomicNumber (int atomicNumber) |
Set the type of atom by its atomic number. More... | |
MaterialBuilder & | setAttenuationProfileFilename (std::string filename) |
Set a value for the attenuation profile filename. More... | |
void | setAttenuationSearchPath (std::string path) |
Set a value for the attenuation profile search path. More... | |
MaterialBuilder & | setCoherentXSection (double xsec) |
Set a value for the coherent scattering cross section. More... | |
MaterialBuilder & | setEffectiveNumberDensity (double rho_eff) |
Set the effective number density of the sample in atoms or formula units / Angstrom^3. More... | |
MaterialBuilder & | setFormula (const std::string &formula) |
Set the chemical formula of the material. More... | |
MaterialBuilder & | setIncoherentXSection (double xsec) |
Set a value for the incoherent scattering cross section. More... | |
MaterialBuilder & | setMassDensity (double massDensity) |
Set the mass density of the sample in g / cc. More... | |
MaterialBuilder & | setMassNumber (int massNumber) |
Set the isotope by mass number. More... | |
MaterialBuilder & | setName (const std::string &name) |
Set the string name given to the material. More... | |
MaterialBuilder & | setNumberDensity (double rho) |
Set the number density of the sample in atoms or formula units / Angstrom^3. More... | |
MaterialBuilder & | setNumberDensityUnit (NumberDensityUnit unit) |
Set the unit for number density. More... | |
MaterialBuilder & | setPackingFraction (double fraction) |
Set the packing fraction of the material (default is 1). More... | |
MaterialBuilder & | setTotalScatterXSection (double xsec) |
Set a value for the total scattering cross section. More... | |
MaterialBuilder & | setUnitCellVolume (double cellVolume) |
Set the volume of unit cell. More... | |
MaterialBuilder & | setXRayAttenuationProfileFilename (std::string filename) |
Set a value for the attenuation profile filename. More... | |
MaterialBuilder & | setZParameter (double zparam) |
Set the number of formula units in the unit cell. More... | |
Private Types | |
using | Composition = std::tuple< PhysicalConstants::NeutronAtom, double > |
Private Member Functions | |
Material::ChemicalFormula | createCompositionFromAtomicNumber () const |
Create the NeutronAtom object from the atomic number. More... | |
PhysicalConstants::NeutronAtom | generateCustomNeutron () const |
density_packing | getOrCalculateRhoAndPacking (const Material::ChemicalFormula &formula) const |
Return the manually set density or calculate it from other parameters. More... | |
bool | hasOverrideNeutronProperties () const |
void | overrideNeutronProperties (PhysicalConstants::NeutronAtom &neutron) const |
Override default neutron properties with those supplied. More... | |
Private Attributes | |
boost::optional< double > | m_absSection |
boost::optional< int > | m_atomicNo |
std::string | m_attenuationFileSearchPath |
boost::optional< std::string > | m_attenuationProfileFileName |
boost::optional< double > | m_cellVol |
boost::optional< double > | m_cohXSection |
Material::ChemicalFormula | m_formula |
boost::optional< double > | m_incXSection |
boost::optional< double > | m_massDensity |
int | m_massNo |
std::string | m_name |
boost::optional< double > | m_numberDensity |
boost::optional< double > | m_numberDensityEff |
NumberDensityUnit | m_numberDensityUnit |
boost::optional< double > | m_packingFraction |
boost::optional< double > | m_totalXSection |
boost::optional< std::string > | m_xRayAttenuationProfileFileName |
boost::optional< double > | m_zParam |
Create a material from a set of user defined options.
Definition at line 24 of file MaterialBuilder.h.
|
private |
Definition at line 55 of file MaterialBuilder.h.
|
strong |
Enumerator | |
---|---|
Atoms | |
FormulaUnits |
Definition at line 26 of file MaterialBuilder.h.
Mantid::Kernel::MaterialBuilder::MaterialBuilder | ( | ) |
Constructor.
Definition at line 30 of file MaterialBuilder.cpp.
Material Mantid::Kernel::MaterialBuilder::build | ( | ) | const |
Build the new Material object from the current set of options.
Definition at line 248 of file MaterialBuilder.cpp.
References createCompositionFromAtomicNumber(), generateCustomNeutron(), getOrCalculateRhoAndPacking(), hasOverrideNeutronProperties(), m_absSection, m_atomicNo, m_attenuationFileSearchPath, m_attenuationProfileFileName, m_cohXSection, m_formula, m_incXSection, m_name, m_numberDensity, m_totalXSection, and m_xRayAttenuationProfileFileName.
Referenced by Mantid::DataHandling::ReadMaterial::buildMaterial(), export_MaterialBuilder(), and Mantid::Kernel::MaterialXMLParser::parse().
|
private |
Create the NeutronAtom object from the atomic number.
Definition at line 291 of file MaterialBuilder.cpp.
References m_atomicNo, and m_massNo.
Referenced by build().
|
private |
Definition at line 391 of file MaterialBuilder.cpp.
References Mantid::PhysicalConstants::NeutronAtom::a_number, Mantid::PhysicalConstants::NeutronAtom::abs_scatt_xs, Mantid::PhysicalConstants::NeutronAtom::coh_scatt_xs, Mantid::PhysicalConstants::NeutronAtom::inc_scatt_xs, m_absSection, m_atomicNo, m_cohXSection, m_formula, m_incXSection, m_massNo, m_totalXSection, overrideNeutronProperties(), Mantid::PhysicalConstants::NeutronAtom::tot_scatt_xs, and Mantid::PhysicalConstants::NeutronAtom::z_number.
Referenced by build().
|
private |
Return the manually set density or calculate it from other parameters.
formula | The chemical formula to calculate the number density from |
Definition at line 307 of file MaterialBuilder.cpp.
References count, FormulaUnits, m_cellVol, m_massDensity, m_numberDensity, m_numberDensityEff, m_numberDensityUnit, m_packingFraction, m_zParam, n, Mantid::PhysicalConstants::N_A, and Mantid::Kernel::MaterialBuilder::density_packing::packing_fraction.
Referenced by build().
|
private |
Definition at line 387 of file MaterialBuilder.cpp.
References m_absSection, m_cohXSection, m_incXSection, and m_totalXSection.
Referenced by build().
|
private |
Override default neutron properties with those supplied.
neutron | A reference to a NeutronAtom object |
Definition at line 424 of file MaterialBuilder.cpp.
References Mantid::PhysicalConstants::NeutronAtom::abs_scatt_xs, Mantid::PhysicalConstants::NeutronAtom::coh_scatt_xs, Mantid::PhysicalConstants::NeutronAtom::inc_scatt_xs, m_absSection, m_cohXSection, m_incXSection, m_totalXSection, and Mantid::PhysicalConstants::NeutronAtom::tot_scatt_xs.
Referenced by generateCustomNeutron().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setAbsorptionXSection | ( | double | xsec | ) |
Set a value for the absorption cross section.
xsec | Value of the cross section |
Definition at line 209 of file MaterialBuilder.cpp.
References m_absSection.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setScatteringInfo().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setAtomicNumber | ( | int | atomicNumber | ) |
Set the type of atom by its atomic number.
atomicNumber | Z-number of the atom |
Definition at line 80 of file MaterialBuilder.cpp.
References m_atomicNo, and m_formula.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setMaterial().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setAttenuationProfileFilename | ( | std::string | filename | ) |
Set a value for the attenuation profile filename.
filename | Name of the file containing the attenuation profile |
Definition at line 219 of file MaterialBuilder.cpp.
References m_attenuationProfileFileName.
Referenced by Mantid::DataHandling::ReadMaterial::setScatteringInfo().
void Mantid::Kernel::MaterialBuilder::setAttenuationSearchPath | ( | std::string | path | ) |
Set a value for the attenuation profile search path.
path | Path to search |
Definition at line 242 of file MaterialBuilder.cpp.
References m_attenuationFileSearchPath.
Referenced by Mantid::Kernel::MaterialXMLParser::parse().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setCoherentXSection | ( | double | xsec | ) |
Set a value for the coherent scattering cross section.
xsec | Value of the cross section |
Definition at line 189 of file MaterialBuilder.cpp.
References m_cohXSection.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setScatteringInfo().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setEffectiveNumberDensity | ( | double | rho_eff | ) |
Set the effective number density of the sample in atoms or formula units / Angstrom^3.
rho_eff | effective density of the sample in atoms or formula units / Angstrom^3 |
Definition at line 127 of file MaterialBuilder.cpp.
References Mantid::EMPTY_DBL(), and m_numberDensityEff.
Referenced by Mantid::DataHandling::ReadMaterial::setNumberDensity().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setFormula | ( | const std::string & | formula | ) |
Set the chemical formula of the material.
formula | Human-readable name of the material |
Definition at line 53 of file MaterialBuilder.cpp.
References m_atomicNo, m_formula, m_name, and Mantid::Kernel::Material::parseChemicalFormula().
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setMaterial().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setIncoherentXSection | ( | double | xsec | ) |
Set a value for the incoherent scattering cross section.
xsec | Value of the cross section |
Definition at line 199 of file MaterialBuilder.cpp.
References m_incXSection.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setScatteringInfo().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setMassDensity | ( | double | massDensity | ) |
Set the mass density of the sample in g / cc.
massDensity | The mass density in g / cc |
Definition at line 168 of file MaterialBuilder.cpp.
References m_massDensity.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setNumberDensity().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setMassNumber | ( | int | massNumber | ) |
Set the isotope by mass number.
massNumber | Isotope number of the atom |
Definition at line 94 of file MaterialBuilder.cpp.
References m_massNo.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setMaterial().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setName | ( | const std::string & | name | ) |
Set the string name given to the material.
name | Human-readable name of the material. Empty string not allowed |
Definition at line 40 of file MaterialBuilder.cpp.
References m_name.
Referenced by export_MaterialBuilder(), and Mantid::Kernel::MaterialXMLParser::parse().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setNumberDensity | ( | double | rho | ) |
Set the number density of the sample in atoms or formula units / Angstrom^3.
rho | density of the sample in atoms or formula units / Angstrom^3 |
Definition at line 104 of file MaterialBuilder.cpp.
References Mantid::EMPTY_DBL(), m_numberDensity, and rho.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setNumberDensity().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setNumberDensityUnit | ( | NumberDensityUnit | unit | ) |
Set the unit for number density.
unit | atoms or formula units / Anstrom^3 |
Definition at line 115 of file MaterialBuilder.cpp.
References m_numberDensityUnit.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setNumberDensity().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setPackingFraction | ( | double | fraction | ) |
Set the packing fraction of the material (default is 1).
This is used to infer the effective number density
Definition at line 137 of file MaterialBuilder.cpp.
References Mantid::EMPTY_DBL(), and m_packingFraction.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setNumberDensity().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setTotalScatterXSection | ( | double | xsec | ) |
Set a value for the total scattering cross section.
xsec | Value of the cross section |
Definition at line 178 of file MaterialBuilder.cpp.
References Mantid::EMPTY_DBL(), and m_totalXSection.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setScatteringInfo().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setUnitCellVolume | ( | double | cellVolume | ) |
Set the volume of unit cell.
cellVolume | The volume of the unit cell |
Definition at line 158 of file MaterialBuilder.cpp.
References m_cellVol.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setNumberDensity().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setXRayAttenuationProfileFilename | ( | std::string | filename | ) |
Set a value for the attenuation profile filename.
filename | Name of the file containing the attenuation profile |
Definition at line 231 of file MaterialBuilder.cpp.
References m_xRayAttenuationProfileFileName.
Referenced by Mantid::DataHandling::ReadMaterial::setScatteringInfo().
MaterialBuilder & Mantid::Kernel::MaterialBuilder::setZParameter | ( | double | zparam | ) |
Set the number of formula units in the unit cell.
zparam | Number of formula units |
Definition at line 148 of file MaterialBuilder.cpp.
References m_zParam.
Referenced by export_MaterialBuilder(), and Mantid::DataHandling::ReadMaterial::setNumberDensity().
|
private |
Definition at line 78 of file MaterialBuilder.h.
Referenced by build(), generateCustomNeutron(), hasOverrideNeutronProperties(), overrideNeutronProperties(), and setAbsorptionXSection().
|
private |
Definition at line 73 of file MaterialBuilder.h.
Referenced by build(), createCompositionFromAtomicNumber(), generateCustomNeutron(), setAtomicNumber(), and setFormula().
|
private |
Definition at line 82 of file MaterialBuilder.h.
Referenced by build(), and setAttenuationSearchPath().
|
private |
Definition at line 80 of file MaterialBuilder.h.
Referenced by build(), and setAttenuationProfileFilename().
|
private |
Definition at line 77 of file MaterialBuilder.h.
Referenced by getOrCalculateRhoAndPacking(), and setUnitCellVolume().
|
private |
Definition at line 78 of file MaterialBuilder.h.
Referenced by build(), generateCustomNeutron(), hasOverrideNeutronProperties(), overrideNeutronProperties(), and setCoherentXSection().
|
private |
Definition at line 72 of file MaterialBuilder.h.
Referenced by build(), generateCustomNeutron(), setAtomicNumber(), and setFormula().
|
private |
Definition at line 78 of file MaterialBuilder.h.
Referenced by build(), generateCustomNeutron(), hasOverrideNeutronProperties(), overrideNeutronProperties(), and setIncoherentXSection().
|
private |
Definition at line 77 of file MaterialBuilder.h.
Referenced by getOrCalculateRhoAndPacking(), and setMassDensity().
|
private |
Definition at line 74 of file MaterialBuilder.h.
Referenced by createCompositionFromAtomicNumber(), generateCustomNeutron(), and setMassNumber().
|
private |
Definition at line 71 of file MaterialBuilder.h.
Referenced by build(), setFormula(), and setName().
|
private |
Definition at line 75 of file MaterialBuilder.h.
Referenced by build(), getOrCalculateRhoAndPacking(), and setNumberDensity().
|
private |
Definition at line 76 of file MaterialBuilder.h.
Referenced by getOrCalculateRhoAndPacking(), and setEffectiveNumberDensity().
|
private |
Definition at line 79 of file MaterialBuilder.h.
Referenced by getOrCalculateRhoAndPacking(), and setNumberDensityUnit().
|
private |
Definition at line 75 of file MaterialBuilder.h.
Referenced by getOrCalculateRhoAndPacking(), and setPackingFraction().
|
private |
Definition at line 78 of file MaterialBuilder.h.
Referenced by build(), generateCustomNeutron(), hasOverrideNeutronProperties(), overrideNeutronProperties(), and setTotalScatterXSection().
|
private |
Definition at line 81 of file MaterialBuilder.h.
Referenced by build(), and setXRayAttenuationProfileFilename().
|
private |
Definition at line 77 of file MaterialBuilder.h.
Referenced by getOrCalculateRhoAndPacking(), and setZParameter().