Class Scine::Utils::Constants::ElementDataSingleton¶
-
class
ElementDataSingleton
¶ Provides a mapping of ElementType to ElementData and accessing Elements by a symbol string.
This class is a singleton to avoid multiple instances of the same hardcoded data in memory.
Features:
Fast lookup for subscript operator [ElementType]. Throws std::out_of_range.
Slow lookup for subscript operator [std::string]. Throws ElementData::DataNotAvailable.
Public Functions
-
const ElementData &
operator[]
(const std::string &symbol) const¶ Access element information based on element symbol.
- Return
const ElementData& Returns the data associated with this element.
- Parameters
symbol
: The symbol of the element (1st character upper case, 2nd lower case).
- Exceptions
-
const ElementData &
operator[]
(const ElementType &type) const¶ Access element information based on type.
Fastest lookup.
- Return
const ElementData& Returns the data associated with this element.
- Parameters
type
: The ElementType.
- Exceptions
std::out_of_range
:
Public Static Functions
-
static const ElementDataSingleton &
instance
()¶ Access singleton instance.
Creates one if necessary.
- Return
const ElementDataSingleton& A reference to the one instance allowed.
-
class
ElementData
¶ Data type for each element of the periodic table, Data includes: Mass (a.u.), Z,.
Public Functions
-
ElementData
()¶ Constructor for default (empty) element.
-
ElementData
(std::string symbol, int Z, double mass, double vdWRadiusInPicometers = -1, int valElectrons = -1, int sElectrons = -1, int pElectrons = -1, int dElectrons = -1)¶ Construct a new ElementData object.
- Parameters
symbol
: The element symbol.Z
: The nuclear charge.mass
: The mass (isotope average, precision: 3 digits).vdWRadiusInPicometers
: The van der Waals radius in pm.valElectrons
: The number of electrons in the valence shell.sElectrons
: The number of s-electrons in the valence shell.pElectrons
: The number of p-electrons in the valence shell.dElectrons
: The number of d-electrons in the valence shell.
-
std::string
symbol
() const¶ Getter for the element symbol.
- Return
std::string Returns the element symbol as string.
-
int
Z
() const¶ Getter for the atomic number.
- Return
int Returns the atomic number.
-
double
mass
() const¶ Getter for the mass in atomic mass units (u).
- Return
double Returns the atomic mass (isotope average, precision: 3 digits)
-
double
vdWRadius
() const¶ Getter for the Van-der-Waals Radius.
- Return
double Returns the Van-der-Waals Radius in atomic units.
-
int
valElectrons
() const¶ Getter for the number of valence electrons.
- Return
int Returns the number of valence electrons.
-
int
sElectrons
() const¶ Getter for the number of valence s-electrons.
- Return
int Returns the number of valence s-electrons.
-
int
pElectrons
() const¶ Getter for the number of valence p-electrons.
- Return
int Returns the number of valence p-electrons.
-
int
dElectrons
() const¶ Getter for the number of valence d-electrons.
- Return
int Returns the number of valence d-electrons.
-
class
DataNotAvailable
¶ An exception if the data does not exist.
-