33vector<int> tknucleus::fmagic_number_list{2, 8, 20, 28, 50, 82, 126};
42 tkstring symbol = gmanager->get_element_symbol(_Z);
44 glog << warning <<
"Unknown nucleus. No properties loaded " << tkstring::form(
"(%d,%d)", _Z, _A) << do_endl;
51 if (!gmanager->known_nucleus(symbol)) {
52 glog << warning <<
"Unknown nucleus. No properties loaded (" << symbol <<
")" << do_endl;
55 const tknucleus &nuc = *gmanager->get_nucleus(symbol).
get();
66 if (!gmanager->known_element(_Z))
67 glog <<
warning <<
"Unknown element. No properties loaded" <<
do_endl;
69 shared_ptr<tknucleus> bestnuc;
70 for (const auto &nuc : gmanager->get_nuclei_for_z(_Z)) {
71 if (bestnuc == nullptr)
73 else if (isnan(bestnuc->get_lifetime()) || (nuc->get_lifetime() > bestnuc->get_lifetime()))
75 else if (nuc->get_lifetime() == bestnuc->get_lifetime() && nuc->get_abundance() > bestnuc->get_abundance())
90 if (!gmanager->known_nucleus(
tkstring(_symbol))) {
92 if (gmanager->known_element(
tkstring(_symbol), z)) {
94 glog <<
warning <<
"Unknown nucleus. TkN will choose one for you ;)" <<
do_endl;
101 const tknucleus &nuc = *gmanager->get_nucleus(_symbol).get();
105void tknucleus::set_name(
const char *_name)
108 felement_symbol = fSymbol.extract_alpha();
114 if (std::find(fmagic_number_list.begin(), fmagic_number_list.end(), fZ) != fmagic_number_list.end())
return true;
120 if (std::find(fmagic_number_list.begin(), fmagic_number_list.end(), fN) != fmagic_number_list.end())
return true;
139 return get(
"radius")->get_value();
152 return get(
"magnetic_dipole")->get_value();
165 return get(
"electric_quadrupole")->get_value();
178 return get(
"abundance")->get_value();
192 glog <<
error << gunits->get_name(_unit) <<
" is not of 'energy' type (returns nan(1))" <<
do_endl;
193 return std::nan(
"1");
195 return get(
"mass_excess")->get_value(_unit);
207 if (!
has_property(
"binding_energy_overA"))
return std::nan(
"1");
209 glog <<
error << gunits->get_name(_unit) <<
" is not of 'energy' type (returns nan(1))" <<
do_endl;
210 return std::nan(
"1");
212 return get(
"binding_energy_overA")->get_value(_unit);
226 glog <<
error << gunits->get_name(_unit) <<
" is not of 'time' or 'energy' type (returns nan(1))" <<
do_endl;
227 return std::nan(
"1");
229 return get(
"lifetime")->get_value(_unit);
248 if (_cumulative) _parent.
prepend(
"c");
250 return get(_parent)->get_value();
260 tkstring lifetime_str;
263 lifetime_str =
"STABLE";
270 for (
auto &unit : units) {
302 if (!
has_property(
"binding_energy_overA"))
return false;
303 return get(
"binding_energy_overA")->get_value() > 0;
313 vector<pair<tkstring, double>> decay_list;
315 auto tokkens = decays.replace_all(
"[",
"]").tokenize(
"]");
316 for (
auto &dec : tokkens) {
317 auto tokk = dec.tokenize(
";");
318 decay_list.push_back({tokk.front(), tokk.back().atof()});
340 glog <<
info << fSymbol <<
" (Z=" << fZ <<
", N=" << fN <<
") properties:" <<
do_endl;
341 glog <<
info <<
"Ground state configuration: ";
Represents a nucleus and provides access to its properties.
double get_mass_excess(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::keV)
return the mass excess in keV by default
const tkstring & get_jpi() const
return the ground state spin and parity as a string
int get_a()
return the mass number
vector< pair< tkstring, double > > get_decay_modes()
return the decay modes as a vector of decay
double get_radius() const
returns the radius in fm
bool is_n_magic()
return true in case of n is a magic number
double get_lifetime(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::s)
returns the lifetime in second
bool is_stable() const
test if the nucleus is stable
double get_abundance() const
returns the natural abundance in percent
tknucleus()
default constructor
double get_fission_yield(tkstring _parent, bool _cumulative=false)
returns the fission yield of the current nucleus
tkstring get_lifetime_str()
returns the lifetime in string (using the best adapted unit)
shared_ptr< tklevel > get_ground_state()
return the ground state level (nullptr if no GS known)
bool is_z_magic()
return true in case of z is a magic number
int get_z()
return the proton number
shared_ptr< tklevel_scheme > get_level_scheme()
return a tklevel_scheme shared pointer to the nucleus level scheme
double get_electric_quadrupole()
return the electric quadrupole moment in barn by default
shared_ptr< tkmeasure > get_lifetime_measure() const
returns the lifetime tkmeasure object
void print() const
print the main nucleus properties
const tkstring & get_symbol()
return the nucleus symbol
double get_magnetic_dipole()
return the magnetic dipole moment in mun by default
tkstring get_decay_mode_str()
return the decay modes as a string
double get_binding_energy_over_a(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::MeV)
returns the binding energy per mass unit in MeV
bool is_bound() const
test if the nucleus is bound (positive binding energy)
Contains list of properties.
bool has_property(const tkstring &_property) const
to check if the property is available
shared_ptr< tkmeasure > get(const tkstring &_property) const
get the property as tkmeasure
tkstring get_property(const tkstring &_property) const
get the property value as a string
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
static const char * form(const char *_format,...)
static tkstring Form(const char *_format,...)
tkstring & prepend(const tkstring &_st)
bool begins_with(const char *_s, ECaseCompare _cmp=kExact) const
units_keys
units identifiers
static std::vector< std::tuple< tkstring, units_type, double > > funits_properties
tklog & error(tklog &log)
tklog & do_endl(tklog &log)
tklog & warning(tklog &log)