11#include <boost/python/class.hpp>
12#include <boost/python/copy_const_reference.hpp>
13#include <boost/python/list.hpp>
14#include <boost/python/make_function.hpp>
15#include <boost/python/register_ptr_to_python.hpp>
16#include <boost/python/tuple.hpp>
31tuple chemicalFormula(
const Material &self) {
32 list atoms, numberAtoms;
34 atoms.append(formulaUnit.atom);
35 numberAtoms.append(formulaUnit.multiplicity);
37 return make_tuple(atoms, numberAtoms);
55double relativeMolecularMass(
const Material &self) {
57 return std::accumulate(formula.cbegin(), formula.cend(), 0., [](
double sum,
const auto &formulaUnit) {
58 return sum + formulaUnit.atom->mass * formulaUnit.multiplicity;
64 register_ptr_to_python<Material *>();
65 register_ptr_to_python<std::shared_ptr<Material>>();
67 class_<Material>(
"Material", no_init)
68 .def(
"name", &
Material::name, arg(
"self"), return_value_policy<copy_const_reference>(),
"Name of the material")
71 "Effective number density in atoms per A^-3")
73 "Packing fraction as a number, ideally, 0 to 1")
77 .def(
"__bool__", &toBool,
"Returns True if any of the scattering values are non-zero")
79 "Coherent Scattering Cross-Section for the given wavelength in "
82 "Incoherent Scattering Cross-Section for the given wavelength in "
85 "Total Scattering Cross-Section for the given wavelength in barns")
88 "Absorption Cross-Section for the given wavelength in barns")
91 "Coherent Scattering Length for the given wavelength in fm")
94 "Incoherent Scattering Length for the given wavelength in fm")
97 "Total Scattering Length for the given wavelength in fm")
100 "Real part of Coherent Scattering Length for the given wavelength "
104 "Imaginary part of Coherent Scattering Length for the given "
109 "Real part of Incoherent Scattering Length for the given wavelength "
113 "Imaginary part of Incoherent Scattering Length for the given "
119 "Coherent Scattering Length Squared <b>^2 for the given wavelength "
123 "Incoherent Scattering Length Squared <b>^2 for the given "
124 "wavelength in fm^2")
127 "Total Scattering Length Squared <b^2> for the given wavelength in "
129 .def(
"chemicalFormula", &chemicalFormula, arg(
"self"),
130 "Chemical formula as a tuple of two lists: the first one contains "
131 "the Atom object the second their multiplicities within the "
133 .def(
"relativeMolecularMass", &relativeMolecularMass, arg(
"self"),
"Relative Molecular Mass");
#define GET_POINTER_SPECIALIZATION(TYPE)
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
const Material::ChemicalFormula & chemicalFormula() const
double packingFraction() const
Get the packing fraction.
double cohScatterLengthReal(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the coherent scattering length for a given wavelength in fm.
double incohScatterLengthSqrd(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the incoherent length squared, , for a given wavelength in .
double incohScatterLength(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the incoherent length for a given wavelength in fm.
double temperature() const
Get the temperature.
double cohScatterLength(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the coherent scattering length for a given wavelength in fm.
double cohScatterLengthSqrd(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the coherent scattering length squared, , for a given wavelength in .
double cohScatterLengthImg(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the coherent scattering length for a given wavelength in fm.
double numberDensity() const
Get the number density.
double incohScatterLengthReal(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the incoherent length for a given wavelength in fm.
double totalAtoms() const
The total number of atoms in the formula.
double cohScatterXSection() const
Get the coherent scattering cross section for a given wavelength in barns.
double totalScatterLength(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Return the total scattering length for a given wavelength in fm.
double absorbXSection(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the absorption cross section at a given wavelength in barns.
const std::string & name() const
Returns the name of the material.
double numberDensityEffective() const
Get the effective number density.
double incohScatterXSection() const
Get the incoherent cross section for a given wavelength in barns.
double pressure() const
Get the pressure.
double incohScatterLengthImg(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the incoherent length for a given wavelength in fm.
double totalScatterXSection() const
Return the total scattering cross section for a given wavelength in barns.
double totalScatterLengthSqrd(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Return the total scattering length squared, , for a given wavelength in .
Structure to store neutronic scattering information for the various elements.
static const double ReferenceLambda
The reference wavelength value for absorption cross sections.