feat(species-lookup): added function to get species from a and z
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <string_view>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
|
||||
/**
|
||||
* @namespace fourdst::atomic
|
||||
* @brief Contains classes and functions related to atomic data, such as properties of atomic species.
|
||||
|
||||
248
src/composition/include/fourdst/composition/elements.h
Normal file
248
src/composition/include/fourdst/composition/elements.h
Normal file
@@ -0,0 +1,248 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace fourdst::atomic {
|
||||
static const std::unordered_map<uint8_t, std::string> element_symbol_map = {
|
||||
{1u, "H"},
|
||||
{2u, "He"},
|
||||
{3u, "Li"},
|
||||
{4u, "Be"},
|
||||
{5u, "B"},
|
||||
{6u, "C"},
|
||||
{7u, "N"},
|
||||
{8u, "O"},
|
||||
{9u, "F"},
|
||||
{10u, "Ne"},
|
||||
{11u, "Na"},
|
||||
{12u, "Mg"},
|
||||
{13u, "Al"},
|
||||
{14u, "Si"},
|
||||
{15u, "P"},
|
||||
{16u, "S"},
|
||||
{17u, "Cl"},
|
||||
{18u, "Ar"},
|
||||
{19u, "K"},
|
||||
{20u, "Ca"},
|
||||
{21u, "Sc"},
|
||||
{22u, "Ti"},
|
||||
{23u, "V"},
|
||||
{24u, "Cr"},
|
||||
{25u, "Mn"},
|
||||
{26u, "Fe"},
|
||||
{27u, "Co"},
|
||||
{28u, "Ni"},
|
||||
{29u, "Cu"},
|
||||
{30u, "Zn"},
|
||||
{31u, "Ga"},
|
||||
{32u, "Ge"},
|
||||
{33u, "As"},
|
||||
{34u, "Se"},
|
||||
{35u, "Br"},
|
||||
{36u, "Kr"},
|
||||
{37u, "Rb"},
|
||||
{38u, "Sr"},
|
||||
{39u, "Y"},
|
||||
{40u, "Zr"},
|
||||
{41u, "Nb"},
|
||||
{42u, "Mo"},
|
||||
{43u, "Tc"},
|
||||
{44u, "Ru"},
|
||||
{45u, "Rh"},
|
||||
{46u, "Pd"},
|
||||
{47u, "Ag"},
|
||||
{48u, "Cd"},
|
||||
{49u, "In"},
|
||||
{50u, "Sn"},
|
||||
{51u, "Sb"},
|
||||
{52u, "Te"},
|
||||
{53u, "I"},
|
||||
{54u, "Xe"},
|
||||
{55u, "Cs"},
|
||||
{56u, "Ba"},
|
||||
{57u, "La"},
|
||||
{58u, "Ce"},
|
||||
{59u, "Pr"},
|
||||
{60u, "Nd"},
|
||||
{61u, "Pm"},
|
||||
{62u, "Sm"},
|
||||
{63u, "Eu"},
|
||||
{64u, "Gd"},
|
||||
{65u, "Tb"},
|
||||
{66u, "Dy"},
|
||||
{67u, "Ho"},
|
||||
{68u, "Er"},
|
||||
{69u, "Tm"},
|
||||
{70u, "Yb"},
|
||||
{71u, "Lu"},
|
||||
{72u, "Hf"},
|
||||
{73u, "Ta"},
|
||||
{74u, "W"},
|
||||
{75u, "Re"},
|
||||
{76u, "Os"},
|
||||
{77u, "Ir"},
|
||||
{78u, "Pt"},
|
||||
{79u, "Au"},
|
||||
{80u, "Hg"},
|
||||
{81u, "Tl"},
|
||||
{82u, "Pb"},
|
||||
{83u, "Bi"},
|
||||
{84u, "Po"},
|
||||
{85u, "At"},
|
||||
{86u, "Rn"},
|
||||
{87u, "Fr"},
|
||||
{88u, "Ra"},
|
||||
{89u, "Ac"},
|
||||
{90u, "Th"},
|
||||
{91u, "Pa"},
|
||||
{92u, "U"},
|
||||
{93u, "Np"},
|
||||
{94u, "Pu"},
|
||||
{95u, "Am"},
|
||||
{96u, "Cm"},
|
||||
{97u, "Bk"},
|
||||
{98u, "Cf"},
|
||||
{99u, "Es"},
|
||||
{100u, "Fm"},
|
||||
{101u, "Md"},
|
||||
{102u, "No"},
|
||||
{103u, "Lr"},
|
||||
{104u, "Rf"},
|
||||
{105u, "Db"},
|
||||
{106u, "Sg"},
|
||||
{107u, "Bh"},
|
||||
{108u, "Hs"},
|
||||
{109u, "Mt"},
|
||||
{110u, "Ds"},
|
||||
{111u, "Rg"},
|
||||
{112u, "Cn"},
|
||||
{113u, "Nh"},
|
||||
{114u, "Fl"},
|
||||
{115u, "Mc"},
|
||||
{116u, "Lv"},
|
||||
{117u, "Ts"},
|
||||
{118u, "Og"}
|
||||
};
|
||||
static const std::unordered_map<std::string, uint8_t> symbol_element_map = {
|
||||
{"H", 1u},
|
||||
{"He", 2u},
|
||||
{"Li", 3u},
|
||||
{"Be", 4u},
|
||||
{"B", 5u},
|
||||
{"C", 6u},
|
||||
{"N", 7u},
|
||||
{"O", 8u},
|
||||
{"F", 9u},
|
||||
{"Ne", 10u},
|
||||
{"Na", 11u},
|
||||
{"Mg", 12u},
|
||||
{"Al", 13u},
|
||||
{"Si", 14u},
|
||||
{"P", 15u},
|
||||
{"S", 16u},
|
||||
{"Cl", 17u},
|
||||
{"Ar", 18u},
|
||||
{"K", 19u},
|
||||
{"Ca", 20u},
|
||||
{"Sc", 21u},
|
||||
{"Ti", 22u},
|
||||
{"V", 23u},
|
||||
{"Cr", 24u},
|
||||
{"Mn", 25u},
|
||||
{"Fe", 26u},
|
||||
{"Co", 27u},
|
||||
{"Ni", 28u},
|
||||
{"Cu", 29u},
|
||||
{"Zn", 30u},
|
||||
{"Ga", 31u},
|
||||
{"Ge", 32u},
|
||||
{"As", 33u},
|
||||
{"Se", 34u},
|
||||
{"Br", 35u},
|
||||
{"Kr", 36u},
|
||||
{"Rb", 37u},
|
||||
{"Sr", 38u},
|
||||
{"Y", 39u},
|
||||
{"Zr", 40u},
|
||||
{"Nb", 41u},
|
||||
{"Mo", 42u},
|
||||
{"Tc", 43u},
|
||||
{"Ru", 44u},
|
||||
{"Rh", 45u},
|
||||
{"Pd", 46u},
|
||||
{"Ag", 47u},
|
||||
{"Cd", 48u},
|
||||
{"In", 49u},
|
||||
{"Sn", 50u},
|
||||
{"Sb", 51u},
|
||||
{"Te", 52u},
|
||||
{"I", 53u},
|
||||
{"Xe", 54u},
|
||||
{"Cs", 55u},
|
||||
{"Ba", 56u},
|
||||
{"La", 57u},
|
||||
{"Ce", 58u},
|
||||
{"Pr", 59u},
|
||||
{"Nd", 60u},
|
||||
{"Pm", 61u},
|
||||
{"Sm", 62u},
|
||||
{"Eu", 63u},
|
||||
{"Gd", 64u},
|
||||
{"Tb", 65u},
|
||||
{"Dy", 66u},
|
||||
{"Ho", 67u},
|
||||
{"Er", 68u},
|
||||
{"Tm", 69u},
|
||||
{"Yb", 70u},
|
||||
{"Lu", 71u},
|
||||
{"Hf", 72u},
|
||||
{"Ta", 73u},
|
||||
{"W", 74u},
|
||||
{"Re", 75u},
|
||||
{"Os", 76u},
|
||||
{"Ir", 77u},
|
||||
{"Pt", 78u},
|
||||
{"Au", 79u},
|
||||
{"Hg", 80u},
|
||||
{"Tl", 81u},
|
||||
{"Pb", 82u},
|
||||
{"Bi", 83u},
|
||||
{"Po", 84u},
|
||||
{"At", 85u},
|
||||
{"Rn", 86u},
|
||||
{"Fr", 87u},
|
||||
{"Ra", 88u},
|
||||
{"Ac", 89u},
|
||||
{"Th", 90u},
|
||||
{"Pa", 91u},
|
||||
{"U", 92u},
|
||||
{"Np", 93u},
|
||||
{"Pu", 94u},
|
||||
{"Am", 95u},
|
||||
{"Cm", 96u},
|
||||
{"Bk", 97u},
|
||||
{"Cf", 98u},
|
||||
{"Es", 99u},
|
||||
{"Fm", 100u},
|
||||
{"Md", 101u},
|
||||
{"No", 102u},
|
||||
{"Lr", 103u},
|
||||
{"Rf", 104u},
|
||||
{"Db", 105u},
|
||||
{"Sg", 106u},
|
||||
{"Bh", 107u},
|
||||
{"Hs", 108u},
|
||||
{"Mt", 109u},
|
||||
{"Ds", 110u},
|
||||
{"Rg", 111u},
|
||||
{"Cn", 112u},
|
||||
{"Nh", 113u},
|
||||
{"Fl", 114u},
|
||||
{"Mc", 115u},
|
||||
{"Lv", 116u},
|
||||
{"Ts", 117u},
|
||||
{"Og", 118u}
|
||||
};
|
||||
};
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <limits> // Required for std::numeric_limits
|
||||
#include "fourdst/composition/atomicSpecies.h"
|
||||
#include "fourdst/composition/elements.h"
|
||||
|
||||
namespace fourdst::atomic {
|
||||
static const Species n_1("n-1", "n", 1, 1, 0, 1, 0.0, "B-", 782.347, 609.8, "/2+*", "-=100", 1.0086649159, 0.00047);
|
||||
@@ -7137,6 +7138,12 @@ namespace fourdst::atomic {
|
||||
{"Og-294", Og_294},
|
||||
{"Og-295", Og_295},
|
||||
};
|
||||
|
||||
inline Species az_to_species(const int a, const int z) {
|
||||
const std::string element_symbol = element_symbol_map.at(static_cast<uint8_t>(z));
|
||||
const std::string species_symbol = element_symbol + "-" + std::to_string(a);
|
||||
return species.at(species_symbol);
|
||||
};
|
||||
}; // namespace fourdst::atomic
|
||||
#ifndef SERIF_SPECIES_N_1
|
||||
#define SERIF_SPECIES_N_1
|
||||
|
||||
@@ -45,6 +45,12 @@ composition_dep = declare_dependency(
|
||||
composition_headers = files(
|
||||
'include/fourdst/composition/composition.h',
|
||||
'include/fourdst/composition/atomicSpecies.h',
|
||||
'include/fourdst/composition/species.h'
|
||||
'include/fourdst/composition/species.h',
|
||||
'include/fourdst/composition/elements.h'
|
||||
)
|
||||
install_headers(composition_headers, subdir : 'fourdst/fourdst/composition')
|
||||
|
||||
composition_exception_headers = files(
|
||||
'include/fourdst/composition/exceptions/exceptions_composition.h',
|
||||
)
|
||||
install_headers(composition_exception_headers, subdir : 'fourdst/fourdst/composition/exceptions')
|
||||
|
||||
Reference in New Issue
Block a user