nucmass_ame.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2020, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_AME_MASS_H
24 #define O2SCL_AME_MASS_H
25 
26 /** \file nucmass_ame.h
27  \brief File defining \ref o2scl::nucmass_ame
28 */
29 
30 #include <cmath>
31 #include <string>
32 #include <map>
33 #include <o2scl/nucleus.h>
34 #include <o2scl/constants.h>
35 #include <o2scl/table.h>
36 #include <o2scl/nucmass.h>
37 
38 // Forward definition of the nucmass_ame class for HDF I/O
39 namespace o2scl {
40  class nucmass_ame;
41 }
42 
43 // Forward definition of HDF I/O to extend friendship
44 namespace o2scl_hdf {
45  class hdf_file;
46  void ame_load_ext(o2scl::nucmass_ame &ame, std::string file_name,
47  std::string table_name, bool exp_only);
48  void ame_load(o2scl::nucmass_ame &ame, std::string name,
49  bool exp_only);
50 }
51 
52 #ifndef DOXYGEN_NO_O2NS
53 namespace o2scl {
54 #endif
55 
56  /** \brief Masses from the Atomic Mass Evaluation
57 
58  \note This class requires data stored in an HDF file and
59  thus requires HDF support for normal usage.
60 
61  This class provides an interface to the atomic mass table using
62  data from \ref Audi95, \ref Audi03, \ref Audi12, and \ref
63  Wang12. To load data from the \o2 HDF5 data files, use
64  <tt>o2scl_hdf::ame_load()</tt> .
65 
66  The 1995 data provided the binding energy (stored in
67  nucmass_ame::entry::be and nucmass_ame::entry::dbe), while the 2003
68  data provided the binding energy divided by the mass number
69  (stored in nucmass_ame::entry::beoa and nucmass_ame::entry::dbeoa).
70  When the 1995 data is used, nucmass_ame::entry::beoa and
71  nucmass_ame::entry::dbeoa are calculated automatically, and when
72  the 2003 data is used nucmass_ame::entry::be and
73  nucmass_ame::entry::dbe are calculated automatically. To indicate
74  that \o2 has automatically calculated a value in this way, the
75  associated accuracy field is set to \ref
76  o2scl::nucmass_ame::intl_computed.
77 
78  Note that all uncertainties are 1 sigma uncertainties.
79 
80  The functions \ref mass_excess() and \ref
81  o2scl::nucmass::mass_excess_d() directly return the value from the
82  data. For consistency, the functions \ref
83  o2scl::nucmass::binding_energy(), \ref
84  o2scl::nucmass::binding_energy_d(), \ref
85  o2scl::nucmass::total_mass(), and \ref
86  o2scl::nucmass::total_mass_d() return values which are
87  automatically computed from the mass excess with the neutron and
88  proton mass in \ref m_neut and \ref m_prot. In order to obtain
89  the value of the binding energy as reported in the original data
90  instead of the value computed from the mass excess, you can use
91  the function \ref get_ZN(), and access the corresponding entry
92  from the data directly.
93 
94  In cases where the decimal point in the original table was
95  replaced with a <tt>#</tt>, the associated accuracy field is set
96  to \ref o2scl::nucmass_ame::estimated. In cases where the original
97  table contained a asterisk to indicate a value was not
98  calculable, the accuracy field is set to \ref
99  o2scl::nucmass_ame::not_calculable and the value is set to zero. If
100  \o2 internally computed the value because it was not present in
101  the original table, the accuracy field is set to \ref
102  o2scl::nucmass_ame::intl_computed. In cases where either \ref
103  o2scl::nucmass_ame::entry::orig or \ref
104  o2scl::nucmass_ame::entry::bdmode in the original table was blank,
105  the string is set to <tt>"blank"</tt>.
106 
107  In the original table, binding energies are defined with a
108  positive sign, so that lead has a binding energy of +8 MeV and
109  this is what is stored in \ref o2scl::nucmass_ame::entry::be.
110  However, for consistency with the other mass formulas, \ref
111  o2scl::nucmass_ame::binding_energy() gives -8 MeV for lead. See
112  also the documentation for the class structure for each table
113  entry in \ref o2scl::nucmass_ame::entry.
114 
115  \future Create a caching and more intelligent search system for
116  the table. The table is sorted by A and then N, so we could
117  probably just copy the search routine from mnmsk_mass, which is
118  sorted by Z and then N (some code written for this, but
119  it doesn't work yet).
120  \future Should m_neut and m_prot be set to the neutron and
121  proton masses from the table by default?
122  */
123  class nucmass_ame : public nucmass_table {
124 
125  public:
126 
127  friend void o2scl_hdf::ame_load_ext(nucmass_ame &ame,
128  std::string file_name,
129  std::string table_name,
130  bool exp_only);
131 
132  friend void o2scl_hdf::ame_load(nucmass_ame &ame, std::string name,
133  bool exp_only);
134 
135  /// Create an AME mass object
136  nucmass_ame();
137 
138  ~nucmass_ame();
139 
140  /// \name Accuracy modes
141  //@{
142  /// Measured value from source data
143  static const int measured=0;
144  /// Value estimated in source data
145  static const int estimated=1;
146  /// Value listed in data as not calculable
147  static const int not_calculable=2;
148  /// Value computed by \o2
149  static const int intl_computed=3;
150  //@}
151 
152  /** \brief Atomic mass entry structure
153 
154  Atomic mass entry data object for \ref o2scl::nucmass_ame.
155 
156  This has to be a struct, not a class, so that it can
157  be processed by the HDF5 make table functions.
158  */
159  struct entry {
160 
161  public:
162 
163  /// N-Z
164  int NMZ;
165 
166  /// Neutron number
167  int N;
168 
169  /// Proton number
170  int Z;
171 
172  /// Mass number
173  int A;
174 
175  /// Element name
176  char el[4];
177 
178  /// Data origin
179  char orig[5];
180 
181  /// Mass excess (in keV)
182  double mass;
183 
184  /// Mass excess uncertainty (in keV)
185  double dmass;
186 
187  /// Mass accuracy flag
188  int mass_acc;
189 
190  /// Binding energy (in keV, given in the '95 data)
191  double be;
192 
193  /// Binding energy uncertainty (in keV, given in the '95 data)
194  double dbe;
195 
196  /// Binding energy accuracy flag
197  int be_acc;
198 
199  /// Binding energy / A (in keV, given in the '03 data)
200  double beoa;
201 
202  /// Binding energy / A uncertainty (in keV, given in the '03 data)
203  double dbeoa;
204 
205  /// Binding energy / A accuracy flag
206  int beoa_acc;
207 
208  /// Beta decay mode
209  char bdmode[3];
210 
211  /// Beta-decay energy (in keV)
212  double bde;
213 
214  /// Beta-decay energy uncertainty (in keV)
215  double dbde;
216 
217  /// Beta-decay energy accuracy flag
218  int bde_acc;
219 
220  /// Mass number (reported twice in original table)
221  int A2;
222 
223  /// Atomic mass (in keV)
224  double amass;
225 
226  /// Atomic mass uncertainty (in keV)
227  double damass;
228 
229  /// Atomic mass accuracy flag
231 
232  };
233 
234  /// Return the type, \c "nucmass_ame".
235  virtual const char *type() { return "nucmass_ame"; }
236 
237  /** \brief Return false if the mass formula does not include
238  specified nucleus
239  */
240  virtual bool is_included(int Z, int N);
241 
242  /// Given \c Z and \c N, return the mass excess in MeV
243  virtual double mass_excess(int Z, int N);
244 
245  /// Get element with Z=l_Z and N=l_N (e.g. 82,126).
246  entry get_ZN(int l_Z, int l_N);
247 
248  /// Get element with Z=l_Z and A=l_A (e.g. 82,208).
249  entry get_ZA(int l_Z, int l_A);
250 
251  /// Get element with name l_el and A=l_A (e.g. "Pb",208).
252  entry get_elA(std::string l_el, int l_A);
253 
254  /// Get element with string (e.g. "Pb208")
255  entry get(std::string nucleus);
256 
257  /// Returns true if data has been loaded
258  bool is_loaded() { return (n>0); }
259 
260  /// Return number of entries
261  size_t get_nentries() { return n; }
262 
263  /// Return the reference
264  std::string get_reference() { return reference; }
265 
266 #ifndef DOXYGEN_INTERNAL
267 
268  protected:
269 
270  /** \brief The array containing the mass data of length ame::n
271 
272  \comment
273  Ideally I'd prefer to store a vector<entry> rather than
274  a pointer, but the pointer is required to read the
275  HDF5 table.
276  \endcomment
277  */
279 
280  /// The last table index for caching
281  int last;
282 
283 #endif
284 
285  };
286 
287 #ifndef DOXYGEN_NO_O2NS
288 }
289 #endif
290 
291 #endif
o2scl_hdf::ame_load_ext
void ame_load_ext(o2scl::nucmass_ame &ame, std::string file_name, std::string table_name, bool exp_only=false)
Read data for o2scl::nucmass_ame from an HDF table specified in a file.
o2scl::nucmass_table::n
size_t n
The number of entries.
Definition: nucmass.h:341
o2scl::nucmass_ame::entry::N
int N
Neutron number.
Definition: nucmass_ame.h:167
o2scl::nucmass_ame::entry::dmass
double dmass
Mass excess uncertainty (in keV)
Definition: nucmass_ame.h:185
o2scl::nucmass_ame::entry::mass_acc
int mass_acc
Mass accuracy flag.
Definition: nucmass_ame.h:188
o2scl::nucmass_ame::mass
entry * mass
The array containing the mass data of length ame::n.
Definition: nucmass_ame.h:278
o2scl::nucmass_ame::get_elA
entry get_elA(std::string l_el, int l_A)
Get element with name l_el and A=l_A (e.g. "Pb",208).
o2scl::nucmass_ame::entry::beoa_acc
int beoa_acc
Binding energy / A accuracy flag.
Definition: nucmass_ame.h:206
o2scl::nucmass_ame::entry::A2
int A2
Mass number (reported twice in original table)
Definition: nucmass_ame.h:221
o2scl::nucmass_ame::measured
static const int measured
Measured value from source data.
Definition: nucmass_ame.h:143
o2scl::nucmass_ame::entry::orig
char orig[5]
Data origin.
Definition: nucmass_ame.h:179
o2scl::nucmass_ame::get_reference
std::string get_reference()
Return the reference.
Definition: nucmass_ame.h:264
o2scl::nucmass_ame::entry::NMZ
int NMZ
N-Z.
Definition: nucmass_ame.h:164
o2scl::nucmass_ame::entry::A
int A
Mass number.
Definition: nucmass_ame.h:173
o2scl::nucmass_ame::get_ZN
entry get_ZN(int l_Z, int l_N)
Get element with Z=l_Z and N=l_N (e.g. 82,126).
o2scl::nucmass_ame::get
entry get(std::string nucleus)
Get element with string (e.g. "Pb208")
o2scl::nucmass_ame::type
virtual const char * type()
Return the type, "nucmass_ame".
Definition: nucmass_ame.h:235
o2scl::nucmass_ame::mass_excess
virtual double mass_excess(int Z, int N)
Given Z and N, return the mass excess in MeV.
o2scl::nucmass_ame::entry::mass
double mass
Mass excess (in keV)
Definition: nucmass_ame.h:182
o2scl::nucmass_ame::entry::amass_acc
int amass_acc
Atomic mass accuracy flag.
Definition: nucmass_ame.h:230
o2scl::nucmass_ame::entry::be
double be
Binding energy (in keV, given in the '95 data)
Definition: nucmass_ame.h:191
o2scl::nucleus
A simple nucleus class.
Definition: nucleus.h:55
o2scl::nucmass_ame::entry::damass
double damass
Atomic mass uncertainty (in keV)
Definition: nucmass_ame.h:227
o2scl::nucmass_ame::intl_computed
static const int intl_computed
Value computed by <a href='../../html/index.html'>O<span style='position: relative; top: 0....
Definition: nucmass_ame.h:149
o2scl::nucmass_ame::entry::el
char el[4]
Element name.
Definition: nucmass_ame.h:176
o2scl::nucmass_ame::entry::beoa
double beoa
Binding energy / A (in keV, given in the '03 data)
Definition: nucmass_ame.h:200
o2scl::nucmass_ame::get_ZA
entry get_ZA(int l_Z, int l_A)
Get element with Z=l_Z and A=l_A (e.g. 82,208).
o2scl::nucmass_ame::entry::dbeoa
double dbeoa
Binding energy / A uncertainty (in keV, given in the '03 data)
Definition: nucmass_ame.h:203
o2scl::nucmass_ame::not_calculable
static const int not_calculable
Value listed in data as not calculable.
Definition: nucmass_ame.h:147
o2scl::nucmass_ame::entry::bdmode
char bdmode[3]
Beta decay mode.
Definition: nucmass_ame.h:209
o2scl::nucmass_ame::entry::be_acc
int be_acc
Binding energy accuracy flag.
Definition: nucmass_ame.h:197
o2scl::nucmass_ame::entry::dbe
double dbe
Binding energy uncertainty (in keV, given in the '95 data)
Definition: nucmass_ame.h:194
o2scl::nucmass_ame::entry::bde_acc
int bde_acc
Beta-decay energy accuracy flag.
Definition: nucmass_ame.h:218
o2scl::nucmass_ame::is_loaded
bool is_loaded()
Returns true if data has been loaded.
Definition: nucmass_ame.h:258
o2scl_hdf::ame_load
void ame_load(o2scl::nucmass_ame &ame, std::string name="16", bool exp_only=false)
Read an AME mass table from the <a href='../../html/index.html'>O<span style='position: relative; top...
o2scl::nucmass_ame::entry::amass
double amass
Atomic mass (in keV)
Definition: nucmass_ame.h:224
o2scl::nucmass_ame::entry::bde
double bde
Beta-decay energy (in keV)
Definition: nucmass_ame.h:212
o2scl::nucmass_ame
Masses from the Atomic Mass Evaluation.
Definition: nucmass_ame.h:123
o2scl::nucmass_table::reference
std::string reference
The reference for the original data.
Definition: nucmass.h:344
o2scl::nucmass_ame::entry::Z
int Z
Proton number.
Definition: nucmass_ame.h:170
o2scl::nucmass_ame::get_nentries
size_t get_nentries()
Return number of entries.
Definition: nucmass_ame.h:261
o2scl::nucmass_table
Tabulated nuclear masses [abstract base].
Definition: nucmass.h:330
o2scl::nucmass_ame::estimated
static const int estimated
Value estimated in source data.
Definition: nucmass_ame.h:145
o2scl::nucmass_ame::is_included
virtual bool is_included(int Z, int N)
Return false if the mass formula does not include specified nucleus.
o2scl::nucmass_ame::entry::dbde
double dbde
Beta-decay energy uncertainty (in keV)
Definition: nucmass_ame.h:215
o2scl::nucmass_ame::last
int last
The last table index for caching.
Definition: nucmass_ame.h:281
o2scl::nucmass_ame::nucmass_ame
nucmass_ame()
Create an AME mass object.
o2scl::nucmass_ame::entry
Atomic mass entry structure.
Definition: nucmass_ame.h:159

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).