86 const std::string_view
name,
87 const std::string_view
el,
95 const double halfLife_s,
98 const double atomicMass,
99 const double atomicMassUnc
146 [[nodiscard]]
double mass()
const {
210 [[nodiscard]] std::string_view
name()
const {
218 [[nodiscard]] std::string_view
el()
const {
226 [[nodiscard]]
int nz()
const {
234 [[nodiscard]]
int n()
const {
242 [[nodiscard]]
int z()
const {
250 [[nodiscard]]
int a()
const {
258 [[nodiscard]]
double spin()
const {
346 std::string s = jpi_string;
349 return std::numeric_limits<double>::quiet_NaN();
352 std::erase_if(s, [](
const char c) {
353 return c ==
'(' || c ==
')' || c ==
'*' || c ==
'#';
356 if (s ==
"+" || s ==
"-") {
360 if (
const size_t comma_pos = s.find(
','); comma_pos != std::string::npos) {
361 s = s.substr(0, comma_pos);
364 if (!s.empty() && (s.back() ==
'+' || s.back() ==
'-')) {
369 return std::numeric_limits<double>::quiet_NaN();
373 if (
size_t slash_pos = s.find(
'/'); slash_pos != std::string::npos) {
374 if (slash_pos == 0) {
378 const std::string numerator_str = s.substr(0, slash_pos);
379 const std::string denominator_str = s.substr(slash_pos + 1);
380 if (denominator_str.empty()) {
381 return std::numeric_limits<double>::quiet_NaN();
383 const double numerator = std::stod(numerator_str);
384 const double denominator = std::stod(denominator_str);
385 if (denominator == 0.0) {
386 return std::numeric_limits<double>::quiet_NaN();
388 return numerator / denominator;
392 }
catch (
const std::invalid_argument&) {
393 return std::numeric_limits<double>::quiet_NaN();
394 }
catch (
const std::out_of_range&) {
395 return std::numeric_limits<double>::quiet_NaN();
432 return std::hash<std::string>()(s.m_name);
Contains classes and functions related to atomic data, such as properties of atomic species.
bool operator==(const Species &lhs, const Species &rhs)
Equality operator for Species. Compares based on name.
bool operator>(const Species &lhs, const Species &rhs)
Greater-than operator for Species. Compares based on atomic mass.
bool operator!=(const Species &lhs, const Species &rhs)
Inequality operator for Species. Compares based on name.
bool operator<(const Species &lhs, const Species &rhs)
Less-than operator for Species. Compares based on atomic mass.
static const std::unordered_map< std::string, const Species & > species
double convert_jpi_to_double(const std::string &jpi_string)
Converts a spin-parity string (JPI string) to a double-precision floating-point number.
Represents an atomic species (isotope) with its fundamental physical properties.
double spin() const
Gets the nuclear spin as a numeric value.
double m_betaDecayEnergy
Beta decay energy in keV.
int z() const
Gets the atomic number (number of protons).
std::string_view name() const
Gets the name of the species.
std::string_view el() const
Gets the element symbol of the species.
double halfLife() const
Gets the half-life of the species.
Species(const std::string_view name, const std::string_view el, const int nz, const int n, const int z, const int a, const double bindingEnergy, const std::string_view betaCode, const double betaDecayEnergy, const double halfLife_s, const std::string_view spinParity, const std::string_view decayModes, const double atomicMass, const double atomicMassUnc)
Constructs a Species object with detailed properties.
double m_atomicMassUnc
Uncertainty in the atomic mass.
std::string m_name
Name of the species (e.g., "Fe56").
int m_nz
NZ identifier, typically 1000*Z + A.
std::string m_decayModes
Decay modes as a string.
std::string_view betaCode() const
Gets the beta decay code.
int m_a
Mass number (N + Z).
std::string m_el
Element symbol (e.g., "Fe").
friend bool operator==(const Species &lhs, const Species &rhs)
Equality operator for Species. Compares based on name.
double betaDecayEnergy() const
Gets the beta decay energy of the species.
Species(const Species &species)
Copy constructor for Species.
std::string m_spinParity
Spin and parity as a string (e.g., "1/2-").
int m_n
Number of neutrons.
int n() const
Gets the number of neutrons.
int nz() const
Gets the NZ identifier of the species.
std::string_view decayModes() const
Gets the decay modes as a string.
int m_z
Atomic number (number of protons).
double m_atomicMass
Atomic mass in atomic mass units (u).
friend bool operator>(const Species &lhs, const Species &rhs)
Greater-than operator for Species. Compares based on atomic mass.
std::string m_betaCode
Beta decay code.
double bindingEnergy() const
Gets the binding energy of the species.
double massUnc() const
Gets the uncertainty in the atomic mass.
double m_bindingEnergy
Binding energy in keV.
friend std::ostream & operator<<(std::ostream &os, const Species &species)
Overloads the stream insertion operator for easy printing of a Species object.
int a() const
Gets the mass number.
friend bool operator!=(const Species &lhs, const Species &rhs)
Inequality operator for Species. Compares based on name.
double m_spin
Nuclear spin as a double, derived from m_spinParity.
double mass() const
Gets the atomic mass of the species.
double m_halfLife_s
Half-life in seconds. A value of -1.0 typically indicates stability.
friend bool operator<(const Species &lhs, const Species &rhs)
Less-than operator for Species. Compares based on atomic mass.
std::string_view spinParity() const
Gets the spin and parity as a string.
size_t operator()(const fourdst::atomic::Species &s) const noexcept
Computes the hash for a Species object.