Bayeux  3.4.1
Core Foundation library for SuperNEMO
isotope.h
Go to the documentation of this file.
1 /* Author(s) : Benoit Guillon <guillon@lpccaen.in2p3.fr>
3  * Creation date: 2010-03-06
4  * Last modified: 2014-06-11
5  *
6  * Description : A simple class to handle only isotopes (ZAI) and their basic properties (mass & decays).
7  *
8  */
9 
10 #ifndef MATERIALS_ISOTOPE_H
11 #define MATERIALS_ISOTOPE_H 1
12 
13 // Standard Library:
14 #include <string>
15 #include <map>
16 
17 // Third party:
18 // - Bayeux/datatools:
19 #include <datatools/properties.h>
20 #include <datatools/i_tree_dump.h>
21 #include <datatools/bit_mask.h>
22 
23 // This project:
25 
26 namespace materials {
27 
61  {
62  public:
63 
65  static int max_number_of_protons();
66 
68  static int undefined_number_of_nucleons();
69 
71  static int max_number_of_nucleons();
72 
74  class id : public datatools::i_tree_dumpable {
75  public:
76 
78  id();
79 
81  id(int z_, int a_);
82 
84  void reset();
85 
87  void set_z(int z_);
88 
90  int get_z() const;
91 
93  void set_a(int z_);
94 
96  int get_a() const;
97 
99  void set(int z_, int a_);
100 
102  std::string get_name() const;
103 
105  void to_string(std::string &) const;
106 
108  std::string to_string() const;
109 
111  bool from_string(const std::string &);
112 
114  bool is_valid() const;
115 
117  bool operator<(const id &) const;
118 
120  bool operator==(const id &) const;
121 
123  virtual void tree_dump(std::ostream & out_ = std::clog,
124  const std::string & title_ = "",
125  const std::string & indent_ = "",
126  bool inherit_ = false) const;
127 
128  private:
129 
130  int _z_;
131  int _a_;
132 
133  };
134 
140  };
141 
144  public:
146  int get_Z() const;
148  int get_A() const;
150  int get_N() const;
152  double get_nucleus_mass() const;
154  double get_mass_excess() const;
156  double get_binding_energy_per_nucleon() const;
158  double get_atomic_mass() const;
160  record_type();
162  virtual void tree_dump(std::ostream & out_ = std::clog,
163  const std::string & title_ = "",
164  const std::string & indent_ = "",
165  bool inherit_ = false) const;
166 
167  public:
168 
169  std::string symbol;
170  int Z;
171  int A;
172  double mx;
173  double mx_err;
174  double bea;
175  double bea_err;
176  double am;
177  double am_err;
178 
179  };
180 
182  typedef std::map<id, record_type> isotope_dict_type;
183 
185  static void print_table_of_isotopes(const isotope_dict_type &,
186  std::ostream & out_ = std::clog,
187  const std::string & title_ = "",
188  const std::string & indent_ = "",
189  bool inherit_ = false);
190 
192  static const isotope_dict_type & table_of_isotopes();
193 
195  static bool id_is_tabulated(const id &);
196 
200  };
201 
204 
206  static const record_type & table_record_from_id(const id &);
207 
222  };
223 
225  static std::string isomeric_to_label(isomeric_level_type);
226 
228  static isomeric_level_type label_to_isomeric(const std::string &);
229 
231  isotope();
232 
234 
237  explicit isotope(const std::string & name_);
238 
240 
243  explicit isotope(const char * name_);
244 
246 
255  explicit isotope(int z_ ,
256  int a_ ,
258  unsigned int build_flags_ = 0);
259 
261 
270  explicit isotope(const std::string & ch_symbol_,
271  int a_ ,
273  unsigned int build_flags_ = 0);
274 
276 
285  explicit isotope(const char * ch_symbol_,
286  int a_ ,
288  unsigned int build_flags_ = 0);
289 
291 
301  explicit isotope(const std::string & name_,
302  int z_ ,
303  int a_ ,
305  unsigned int build_flags_ = 0);
306 
308 
318  explicit isotope(const char * name_,
319  int z_ ,
320  int a_ ,
322  unsigned int build_flags_ = 0);
323 
324 
326 
336  explicit isotope(const std::string & name_,
337  const std::string & ch_symbol_,
338  int a_,
340  unsigned int build_flags_ = 0);
341 
343 
353  explicit isotope(const char * name_,
354  const char * ch_symbol_,
355  int a_,
357  unsigned int build_flags_ = 0);
358 
360  virtual ~isotope();
361 
363  bool is_valid() const;
364 
366  bool find_mass_data();
367 
369  bool find_decay_data();
370 
372  const std::string & get_name() const;
373 
375  const std::string & get_chemical_symbol() const;
376 
378  std::string get_zai_name() const;
379 
381  int get_z() const;
382 
384  int get_a() const;
385 
387  int get_n() const;
388 
390  id get_id() const;
391 
393  double get_mass() const;
394 
397 
399  bool is_ground_state() const;
400 
402  bool is_known() const;
403 
405  bool has_atomic_mass_data() const;
406 
408  bool has_mass_excess_data() const;
409 
411  double get_mass_excess() const;
412 
414  double get_err_mass_excess() const;
415 
417  double get_atomic_mass() const;
418 
420  double get_err_atomic_mass() const;
421 
423 
426  void set_z(int z_);
427 
429 
432  void set_a(int a_);
433 
435 
439 
441 
449  void set_zai(int z_, int a_, isomeric_level_type i_ = GROUND_STATE);
450 
452  bool has_mass() const;
453 
455 
458  void set_name(const std::string & name_);
459 
461 
464  void set_mass(double mass_);
465 
467 
471  void set_mass_excess(double mass_excess_, double err_mass_excess_ = 0.0);
472 
474 
478  void set_binding_energy_per_nucleon(double bea_, double err_bea_ = 0.0);
479 
481 
485  void set_atomic_mass(double mass_, double err_mass_ = 0.0);
486 
488 
492  void set_half_life(double half_life_, double err_half_life_ = 0.0);
493 
495  bool has_decay_data() const;
496 
498  bool is_stable() const;
499 
501  double get_half_life() const;
502 
504  double get_err_half_life() const;
505 
508 
510  const datatools::properties & get_properties() const;
511 
513  bool is_locked() const;
514 
516  void lock();
517 
519  void unlock();
520 
522  void build(unsigned int flags_ = 0);
523 
525  void set_default_data();
526 
528  void reset();
529 
531  virtual void tree_dump(std::ostream & out_ = std::clog,
532  const std::string & title_ = "",
533  const std::string & indent_ = "",
534  bool inherit_ = false) const;
535 
537  static double compute_electron_binding_energy(int z_);
538 
540  static double compute_nucleus_mass(int z_, int a_, double binding_energy_per_nucleon_);
541 
543  static double compute_nucleus_mass(int z_, double atomic_mass_);
544 
545  protected:
546 
548  void _set_defaults();
549 
550  private :
551 
552  bool _locked_;
553  int _z_;
554  int _a_;
555  isomeric_level_type _isomeric_;
556  std::string _name_;
557  double _mass_;
558  double _mass_excess_;
559  double _err_mass_excess_;
560  double _bea_;
561  double _err_bea_;
562  double _atomic_mass_;
563  double _err_atomic_mass_;
564  double _half_life_;
565  double _err_half_life_;
566  bool _is_known_;
567  datatools::properties _properties_;
568 
569  }; // end of class isotope
570 
571 } // end of namespace materials
572 
573 #endif // MATERIALS_ISOTOPE_H
574 
575 /*
576 ** Local Variables: --
577 ** mode: c++ --
578 ** c-file-style: "gnu" --
579 ** tab-width: 2 --
580 ** End: --
581 */
bool from_string(const std::string &)
Import from a string identifier.
double get_err_atomic_mass() const
Return the error on the atomic mass in unit of [u].
double get_nucleus_mass() const
Return nucleus mass.
double get_mass() const
Return the mass in unit of energy.
First fission/shape isomeric level.
Definition: isotope.h:218
int get_a() const
Return A (number of nucleons)
void set_isomeric(isomeric_level_type i_)
Set the isomeric state :
The identifier for an isotope based on its Z and A>=Z numbers.
Definition: isotope.h:74
double get_mass_excess() const
Return mass excess.
Unique isomeric level.
Definition: isotope.h:212
void set_default_data()
Set data to default values.
std::string symbol
Chemical symbol of the element.
Definition: isotope.h:169
double bea_err
Error on binding energy per nucleon.
Definition: isotope.h:175
void build(unsigned int flags_=0)
Load additional data in the isotope data structure.
bool operator<(const id &) const
Comparison operator.
bool is_valid() const
Check the validity of the isotope id.
int get_N() const
Return N.
void set_z(int z_)
Set the number of protons :
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
static const uint32_t bit01
Definition: bit_mask.h:28
int get_z() const
Return Z (number of protons)
Second fission/shape isomeric level.
Definition: isotope.h:219
static const uint32_t bit03
Definition: bit_mask.h:30
void lock()
Lock the isotope.
void set_a(int z_)
Set the number of nucleons.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
build_flag_type
Build flags.
Definition: isotope.h:136
Extract decay half-life from tabulated isotopes.
Definition: isotope.h:138
isomeric_level_type
Isomeric level.
Definition: isotope.h:209
record_type()
Default constructor.
static int undefined_number_of_nucleons()
Undefined number of nucleons for an isotope.
static std::string isomeric_to_label(isomeric_level_type)
Return the label associated to an isomeric level.
bool is_locked() const
Return true if isotope is locked (i.e. fully set), false either.
static const uint32_t bit04
Definition: bit_mask.h:31
bool find_decay_data()
Search & set the half-life from the tabulated isotopes.
Definition: isotope.h:198
const std::string & get_name() const
Return the name.
Lock after building.
Definition: isotope.h:139
std::string to_string() const
Return a string identifier.
static void print_table_of_isotopes(const isotope_dict_type &, std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false)
Print a table of isotopes.
double get_atomic_mass() const
Return atomic mass.
static const uint32_t bit31
Definition: bit_mask.h:58
void unlock()
Unlock the isotope.
Invalid isomeric level.
Definition: isotope.h:221
const datatools::properties & get_properties() const
Give access to properties.
bool has_decay_data() const
Return true if decay data have been set properly, false either.
bool is_ground_state() const
Check ground state.
int get_a() const
Return the number of nucleons.
double get_err_half_life() const
Return the error on half-life in unit of time.
Third isomeric level.
Definition: isotope.h:215
int get_A() const
Return A.
std::string get_name() const
Return the name associated to the isotope Id.
id get_id() const
Return the isotope Id.
bool operator==(const id &) const
Comparison operator.
void set_zai(int z_, int a_, isomeric_level_type i_=GROUND_STATE)
Set Z, A, I attributes.
int get_n() const
Return N (number of neutrons)
static isomeric_level_type label_to_isomeric(const std::string &)
Return the isomeric level associated to a label.
double mx_err
Error on mass excess.
Definition: isotope.h:173
static int max_number_of_nucleons()
Maximum number of nucleons for an isotope (element 'Ei')
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
datatools::properties & grab_properties()
Give access to properties.
id()
Default constructor.
std::map< id, record_type > isotope_dict_type
Dictionary of isotope records.
Definition: isotope.h:182
ame_release_type
Definition: isotope.h:197
double bea
Binding energy per nucleon.
Definition: isotope.h:174
bool is_known() const
Check if the isotope is known from tables.
double am_err
Error on atomic mass.
Definition: isotope.h:177
void set_half_life(double half_life_, double err_half_life_=0.0)
Set the decay data.
double get_atomic_mass() const
Return the atomic mass in unit of [u].
Extract mass excess and mass from tabulated isotopes.
Definition: isotope.h:137
static const uint32_t bit02
Definition: bit_mask.h:29
void set_atomic_mass(double mass_, double err_mass_=0.0)
Set the atomic mass and its error in implicit unit of [u].
bool is_stable() const
Return true if isotope is stable, false either.
void set_mass_excess(double mass_excess_, double err_mass_excess_=0.0)
Set the mass excess and its error in explicit unit of energy.
void _set_defaults()
Set default attributes.
static const isotope_dict_type & table_of_isotopes()
Return the isotope database singleton.
Isomeric level.
Definition: isotope.h:211
bool has_mass() const
Check if the mass of the nucleus is defined.
void set_name(const std::string &name_)
Set the name.
const std::string & get_chemical_symbol() const
Return the chemical symbol.
static double compute_nucleus_mass(int z_, int a_, double binding_energy_per_nucleon_)
Compute the mass of the nucleus from its Z, A and binding energy per nucleon (in unit of energy)
std::string get_zai_name() const
Return the zai name : 'ChA(I)'.
bool has_atomic_mass_data() const
Return true if atomic mass data have been set properly, false either.
bool is_valid() const
Return true if isotope is valid, false either.
Third fission/shape isomeric level.
Definition: isotope.h:220
A simple class to handle known isotopes (ZAI) and their basic properties (mass & decays).
Definition: isotope.h:60
void set(int z_, int a_)
Set the numbers of protons and nucleons.
Definition: isotope.h:199
Second isomeric level.
Definition: isotope.h:214
static int max_number_of_protons()
Maximum number of protons for an isotope (element 'Ei')
static double compute_electron_binding_energy(int z_)
Compute the atomic electron binding energy for ion with given Z.
Isotope record from AME table.
Definition: isotope.h:143
Fission/shape isomeric level.
Definition: isotope.h:216
isotope()
Default Constructor.
int get_z() const
Return the number of protons.
double mx
Mass excess.
Definition: isotope.h:172
bool has_mass_excess_data() const
Return true if mass excess have been set properly, false either.
int Z
The number of protons.
Definition: isotope.h:170
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
void set_z(int z_)
Set the number of protons.
int A
The number of nucleons.
Definition: isotope.h:171
double get_half_life() const
Return the half-life in unit of time.
int get_Z() const
Return Z.
Unique fission/shape isomeric level.
Definition: isotope.h:217
static bool id_is_tabulated(const id &)
Check if the database knows a given isotope id.
static const uint32_t bit00
Definition: bit_mask.h:27
bool find_mass_data()
Search & set the mass excess and mass from the tabulated isotopes.
double am
Atomic mass.
Definition: isotope.h:176
void reset()
Reset.
double get_err_mass_excess() const
Return the error on mass excess in unit of energy.
static const record_type & table_record_from_id(const id &)
Return the isotope record from the table.
void set_binding_energy_per_nucleon(double bea_, double err_bea_=0.0)
Set the binding energy per nucleon and its error in explicit unit of energy.
virtual ~isotope()
Destructor.
static void load_ame_table(isotope::isotope_dict_type &, ame_release_type ame_release_=AME_RELEASE_2012)
Load a dictionary of isotope records from the AME (2003/2012) data file.
First isomeric level.
Definition: isotope.h:213
Ground state (default)
Definition: isotope.h:210
void set_mass(double mass_)
Set the mass.
double get_binding_energy_per_nucleon() const
Return binding energy per nucleon.
double get_mass_excess() const
Return the mass excess in unit of energy.
isomeric_level_type get_isomeric() const
Return the isomeric state.
void set_a(int a_)
Set the number of nucleons :
Top-level namespace of the Bayeux/materials module library.
Definition: geom_manager_utils.h:14
A dictionary of arbitrary properties.
Definition: properties.h:125