56vector<int> tknucleus::fmagic_number_list{2,8,20,28,50,82,126};
65 tkstring symbol = gmanager->get_element_symbol(_Z);
74 if(!gmanager->known_nucleus(symbol)){
75 glog <<
warning <<
"Unknown nucleus. No properties loaded (" << symbol <<
")" <<
do_endl;
78 const tknucleus & nuc = *gmanager->get_nucleus(symbol).get();
89 if(!gmanager->known_element(_Z)) glog <<
warning <<
"Unknown element. No properties loaded" <<
do_endl;
91 shared_ptr<tknucleus> bestnuc;
92 for(
const auto &nuc: gmanager->get_nuclei_for_z(_Z)) {
93 if(bestnuc==
nullptr) bestnuc = nuc;
94 else if(isnan(bestnuc->get_lifetime()) || (nuc->get_lifetime()>bestnuc->get_lifetime())) bestnuc = nuc;
95 else if(nuc->get_lifetime() == bestnuc->get_lifetime() && nuc->get_abundance()>bestnuc->get_abundance()) bestnuc = nuc;
109 if(!gmanager->known_nucleus(
tkstring(_symbol))) {
111 if(gmanager->known_element(
tkstring(_symbol),z)) {
113 glog <<
warning <<
"Unknown nucleus. TkN will choose one for you ;)" <<
do_endl;
120 const tknucleus & nuc = *gmanager->get_nucleus(_symbol).get();
124void tknucleus::set_name(
const char *_name)
132 if(std::find(fmagic_number_list.begin(), fmagic_number_list.end(), fZ) != fmagic_number_list.end())
return true;
137 if(std::find(fmagic_number_list.begin(), fmagic_number_list.end(), fN) != fmagic_number_list.end())
return true;
156 return get(
"radius")->get_value();
169 return get(
"magnetic_dipole")->get_value();
182 return get(
"electric_quadrupole")->get_value();
195 return get(
"abundance")->get_value();
208 if(gunits->get_type(_unit)!=tkunit_manager::units_type::kEnergy){
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(
"mass_excess")->get_value(_unit);
224 if(!
has_property(
"binding_energy_overA"))
return std::nan(
"1");
225 if(gunits->get_type(_unit)!=tkunit_manager::units_type::kEnergy){
226 glog <<
error << gunits->get_name(_unit) <<
" is not of 'energy' type (returns nan(1))" <<
do_endl;
227 return std::nan(
"1");
229 return get(
"binding_energy_overA")->get_value(_unit);
242 if(gunits->get_type(_unit)!=tkunit_manager::units_type::kTime&&gunits->get_type(_unit)!=tkunit_manager::units_type::kEnergy){
243 glog <<
error << gunits->get_name(_unit) <<
" is not of 'time' or 'energy' type (returns nan(1))" <<
do_endl;
244 return std::nan(
"1");
246 return get(
"lifetime")->get_value(_unit);
266 if(_cumulative) _parent.
prepend(
"c");
268 return get(_parent)->get_value();
281 lifetime_str =
"STABLE";
288 for(
auto &unit: units) {
310 return get(
"binding_energy_overA")->get_value()>0;
320 vector<pair<tkstring, double>> decay_list;
322 auto tokkens = decays.replace_all(
"[",
"]").tokenize(
"]");
323 for(
auto &dec: tokkens) {
324 auto tokk = dec.tokenize(
";");
325 decay_list.push_back({tokk.front(),tokk.back().atof()});
332 glog <<
info << fSymbol <<
" (Z=" << fZ <<
", N=" << fN <<
") properties:" <<
do_endl;
333 glog <<
info <<
"Ground state configuration: ";
A nucleus made of Z protons and N neutrons.
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....
tkstring extract_alpha()
Returns a tkstring composed only of the alphabetic letters of the original tkstring.
static const char * form(const char *_format,...)
static tkstring Form(const char *_format,...)
int atoi() const
Converts a string to integer value.
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)