Solvers and settings

Material-expression solvers, settings, and exceptions.

enum class snt::mat::IonizationMethod

NIST ASD’s classification of an ionization energy.

Values:

enumerator EVALUATED
enumerator THEORETICAL
enumerator SEMIEMPIRICAL
enumerator UNKNOWN
enum class snt::mat::Norm : std::uint8_t

Interpretation of material component amounts.

Values:

enumerator NUMBER

Raw number amounts.

enumerator NUMBER_FRACTION

Number fractions or raw number amounts, normalized by the total.

enumerator MASS_FRACTION

Mass fractions or raw mass amounts, normalized by the total.

using snt::mat::ElementMap = std::map<std::string, int>

Map of elements in a substance and their proportions.

using snt::mat::SubstanceMap = std::map<std::string, double>

Map of substances in a material and their proportions.

std::string_view snt::mat::MAT_SYMBOL_PLUS
std::string_view snt::mat::MAT_SYMBOL_MULTIPLY
std::string_view snt::mat::MAT_UNIT_ATOMIC_MASS
std::string_view snt::mat::MAT_UNIT_MATERIAL_MASS
std::string_view snt::mat::MAT_UNIT_NUMBER_DENSITY
std::string_view snt::mat::MAT_UNIT_MASS_DENSITY
std::string_view snt::mat::MAT_UNIT_VOLUME
double snt::mat::MAT_MATTER_CONSISTENCY_RELATIVE_TOLERANCE

Relative tolerance used when supplied matter quantities are checked against values derived from the remaining inputs.

The tolerance allows round-tripping values at MAT’s display precision without accepting physically inconsistent inputs.

double snt::mat::MAT_PROTON_MASS_U

Particle rest masses in atomic mass units (CODATA 2022, NIST).

double snt::mat::MAT_NEUTRON_MASS_U
double snt::mat::MAT_ELECTRON_MASS_U
double snt::mat::MAT_ATOMIC_MASS_ENERGY_EV

Atomic mass unit energy equivalent, CODATA 2022 (eV per u). https://physics.nist.gov/cgi-bin/cuu/Value?uev Standard uncertainty: 0.29 eV; not propagated by MAT’s nominal mass model.

const IonizationEnergy *snt::mat::find_ionization_energy(unsigned int protons, unsigned int initial_charge)

Find a compiled NIST stage; nullptr means no stage is present.

std::optional<double> snt::mat::cumulative_ionization_energy(unsigned int protons, unsigned int charge)

Sum energies for neutral -> charge; nullopt if any required stage is missing or unknown.

std::string_view snt::mat::ionization_data_version()

Return the NIST ASD release used for the compiled table.

Norm snt::mat::norm_from_string(const std::string &value)

Parse a normalization name accepted by the C++ API and DIPL adapter.

std::string_view snt::mat::to_string(Norm norm)

Return the canonical API name of a normalization mode.

double snt::mat::quantity_estimate(const puq::Quantity &quantity)

Return the estimate of a single-valued quantity; reject arrays with multiple values.

double snt::mat::quantity_value(const puq::Quantity &quantity, std::string_view unit)

Convert a quantity to unit and return its scalar estimate.

bool snt::mat::Config::debug_substance_solver

Show debugging printouts in substance solver.

bool snt::mat::Config::debug_material_solver

Show debugging printouts in material solver.

class Exception : public snt::core::Exception

Subclassed by snt::mat::MatterException, snt::mat::MissingException, snt::mat::ParserException, snt::mat::SyntaxException

Public Functions

inline explicit Exception(core::ExceptionInfo info)
inline explicit Exception(std::string message, std::string details, std::string suggestion, std::string origin_file, size_t origin_line)
struct IonizationEnergy

Ground-state energy to remove one electron from the given initial ion. Missing energies and uncertainties are unknown, not zero. Values refer to NIST’s reference element/isotope; isotope shifts are not supplied.

Public Members

unsigned int protons
unsigned int initial_charge
std::optional<double> energy_eV
std::optional<double> uncertainty_eV
IonizationMethod method
std::string_view references

NIST ASD bibliography identifiers.

std::string_view reported_energy

Original eV digits; significant when uncertainty is unknown.

std::string_view reported_uncertainty

Original uncertainty digits, or empty if unknown.

class MaterialAtom : public snt::exs::AtomBase<MaterialAtom, SubstanceMap>

Material expression solver atom.

Public Functions

MaterialAtom(const MaterialAtom &a) = default
inline MaterialAtom(SubstanceMap v)
virtual std::string to_string() override

Return a compact string representation.

void math_add(MaterialAtom *other) override

Merge substance maps.

void math_multiply(MaterialAtom *other) override

Multiply a substance map by a scalar amount.

Public Static Functions

static SubstanceMap from_string(const std::string &s, exs::BaseSettings *set = nullptr)

Create a scalar or substance component from a string.

class MaterialSolver

This class solves material expressions

Public Functions

MaterialSolver() = default

Constructor of this class

std::string preprocess(const std::string &expr)

Convert a material expression to the EXS operator syntax.

SubstanceMap eval(const std::string &expr)

Evaluate a material expression into substance amounts.

Public Static Attributes

static exs::Solver<MaterialAtom> solver

EXS solver for material expressions.

class MatterException : public snt::mat::Exception

Matter exceptions are triggered by invalid or insufficient physical quantities

Public Functions

inline explicit Exception(core::ExceptionInfo info)
inline explicit Exception(std::string message, std::string details, std::string suggestion, std::string origin_file, size_t origin_line)
class MissingException : public snt::mat::Exception

Missing exception is triggered when functionality is not implemented yet

Public Functions

inline MissingException(std::string message, std::string file, std::size_t line)
class ParserException : public snt::mat::Exception

Parser exceptions occurs when internal MAT parsers fails

Public Functions

inline explicit Exception(core::ExceptionInfo info)
inline explicit Exception(std::string message, std::string details, std::string suggestion, std::string origin_file, size_t origin_line)
class SubstanceAtom : public snt::exs::AtomBase<SubstanceAtom, ElementMap>

Substance expression solver

Public Functions

SubstanceAtom(const SubstanceAtom &a) = default

Copy constructor

Parameters:

a – Reference of an SubstanceAtom object

inline SubstanceAtom(ElementMap v)

Create atom from a value

Parameters:

v – ElementMap object

virtual std::string to_string() override

Get a string representation of this atom

Returns:

String representation of this atom

void math_add(SubstanceAtom *other) override

Add another value.

Parameters:

other – Other value used in the operation.

void math_multiply(SubstanceAtom *other) override

Public Static Functions

static ElementMap from_string(const std::string &s, exs::BaseSettings *set = nullptr)

Create atom value from a string

Parameters:
  • s – String representation of a value

  • set – Pointer to solver settings

Returns:

ElementMap object

class SubstanceSolver

This class solves substance expressions

Public Functions

SubstanceSolver() = default

Constructor of this class

std::string preprocess(const std::string &expr)

Preprocess expression for the solver

Parameters:

expr – Substance expression

ElementMap eval(const std::string &expr)

Solve expression using expression solver

Parameters:

expr – Substance expression

Returns:

Map of elements and their proportions

Public Static Attributes

static exs::Solver<SubstanceAtom> solver

Pointer to the EXS solver object.

class SyntaxException : public snt::mat::Exception

Syntax exceptions are triggered by incorrect syntax

Public Functions

inline explicit Exception(core::ExceptionInfo info)
inline explicit Exception(std::string message, std::string details, std::string suggestion, std::string origin_file, size_t origin_line)