nucmass_ame.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2017, 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 and
28  \ref o2scl::nucmass_ame_exp
29 */
30 
31 #include <cmath>
32 #include <string>
33 #include <map>
34 #include <o2scl/nucleus.h>
35 #include <o2scl/constants.h>
36 #include <o2scl/table.h>
37 #include <o2scl/nucmass.h>
38 
39 // Forward definition of the nucmass_ame class for HDF I/O
40 namespace o2scl {
41  class nucmass_ame;
42 }
43 
44 // Forward definition of HDF I/O to extend friendship
45 namespace o2scl_hdf {
46  class hdf_file;
47  void ame_load(o2scl::nucmass_ame &ame, std::string file_name,
48  std::string table_name);
49  void ame_load(o2scl::nucmass_ame &ame, std::string name);
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(nucmass_ame &ame, std::string file_name,
128  std::string table_name);
129  friend void o2scl_hdf::ame_load(nucmass_ame &ame, std::string name);
130 
131  /// Create an AME mass object
132  nucmass_ame();
133 
134  ~nucmass_ame();
135 
136  /// \name Accuracy modes
137  //@{
138  /// Measured value from source data
139  static const int measured=0;
140  /// Value estimated in source data
141  static const int estimated=1;
142  /// Value listed in data as not calculable
143  static const int not_calculable=2;
144  /// Value computed by \o2
145  static const int intl_computed=3;
146  //@}
147 
148  /** \brief Atomic mass entry structure
149 
150  Atomic mass entry data object for \ref o2scl::nucmass_ame.
151 
152  This has to be a struct, not a class, so that it can
153  be processed by the HDF5 make table functions.
154  */
155  struct entry {
156 
157  public:
158 
159  /// N-Z
160  int NMZ;
161 
162  /// Neutron number
163  int N;
164 
165  /// Proton number
166  int Z;
167 
168  /// Mass number
169  int A;
170 
171  /// Element name
172  char el[4];
173 
174  /// Data origin
175  char orig[5];
176 
177  /// Mass excess (in keV)
178  double mass;
179 
180  /// Mass excess uncertainty (in keV)
181  double dmass;
182 
183  /// Mass accuracy flag
184  int mass_acc;
185 
186  /// Binding energy (in keV, given in the '95 data)
187  double be;
188 
189  /// Binding energy uncertainty (in keV, given in the '95 data)
190  double dbe;
191 
192  /// Binding energy accuracy flag
193  int be_acc;
194 
195  /// Binding energy / A (in keV, given in the '03 data)
196  double beoa;
197 
198  /// Binding energy / A uncertainty (in keV, given in the '03 data)
199  double dbeoa;
200 
201  /// Binding energy / A accuracy flag
202  int beoa_acc;
203 
204  /// Beta decay mode
205  char bdmode[3];
206 
207  /// Beta-decay energy (in keV)
208  double bde;
209 
210  /// Beta-decay energy uncertainty (in keV)
211  double dbde;
212 
213  /// Beta-decay energy accuracy flag
214  int bde_acc;
215 
216  /// Mass number (reported twice in original table)
217  int A2;
218 
219  /// Atomic mass (in keV)
220  double amass;
221 
222  /// Atomic mass uncertainty (in keV)
223  double damass;
224 
225  /// Atomic mass accuracy flag
227 
228  };
229 
230  /// Return the type, \c "nucmass_ame".
231  virtual const char *type() { return "nucmass_ame"; }
232 
233  /** \brief Return false if the mass formula does not include
234  specified nucleus
235  */
236  virtual bool is_included(int Z, int N);
237 
238  /// Given \c Z and \c N, return the mass excess in MeV
239  virtual double mass_excess(int Z, int N);
240 
241  /// Get element with Z=l_Z and N=l_N (e.g. 82,126).
242  entry get_ZN(int l_Z, int l_N);
243 
244  /// Get element with Z=l_Z and A=l_A (e.g. 82,208).
245  entry get_ZA(int l_Z, int l_A);
246 
247  /// Get element with name l_el and A=l_A (e.g. "Pb",208).
248  entry get_elA(std::string l_el, int l_A);
249 
250  /// Get element with string (e.g. "Pb208")
251  entry get(std::string nucleus);
252 
253  /// Returns true if data has been loaded
254  bool is_loaded() { return (n>0); }
255 
256  /// Return number of entries
257  int get_nentries() { return n; }
258 
259  /// Return the reference
260  std::string get_reference() { return reference; }
261 
262 #ifndef DOXYGEN_INTERNAL
263 
264  protected:
265 
266  /// The number of entries (about 3000).
267  int n;
268 
269  /// The reference for the original data
270  std::string reference;
271 
272  /** \brief The array containing the mass data of length ame::n
273 
274  \comment
275  Ideally I'd prefer to store a vector<entry> rather than
276  a pointer, but the pointer is required to read the
277  HDF5 table.
278  \endcomment
279  */
281 
282  /// The last table index for caching
283  int last;
284 
285 #endif
286 
287  };
288 
289  /** \brief Measured masses from the Atomic Mass Evaluation
290  (no estimated masses)
291 
292  \note This class requires data stored in an HDF file and
293  thus requires HDF support for normal usage.
294 
295  \todo The function nucmass_ame::get_nentries() doesn't work
296  for this child class.
297  */
298  class nucmass_ame_exp : public nucmass_ame {
299 
300  public:
301 
302  /** \brief Return false if the mass formula does not include
303  specified nucleus
304  */
305  virtual bool is_included(int Z, int N);
306 
307  };
308 
309 #ifndef DOXYGEN_NO_O2NS
310 }
311 #endif
312 
313 #endif
int be_acc
Binding energy accuracy flag.
Definition: nucmass_ame.h:193
Measured masses from the Atomic Mass Evaluation (no estimated masses)
Definition: nucmass_ame.h:298
int beoa_acc
Binding energy / A accuracy flag.
Definition: nucmass_ame.h:202
int amass_acc
Atomic mass accuracy flag.
Definition: nucmass_ame.h:226
double dbeoa
Binding energy / A uncertainty (in keV, given in the &#39;03 data)
Definition: nucmass_ame.h:199
double be
Binding energy (in keV, given in the &#39;95 data)
Definition: nucmass_ame.h:187
virtual const char * type()
Return the type, "nucmass_ame".
Definition: nucmass_ame.h:231
double beoa
Binding energy / A (in keV, given in the &#39;03 data)
Definition: nucmass_ame.h:196
int last
The last table index for caching.
Definition: nucmass_ame.h:283
int A2
Mass number (reported twice in original table)
Definition: nucmass_ame.h:217
int A
Mass number.
Definition: nucmass_ame.h:169
Masses from the Atomic Mass Evaluation.
Definition: nucmass_ame.h:123
double dmass
Mass excess uncertainty (in keV)
Definition: nucmass_ame.h:181
double mass
Mass excess (in keV)
Definition: nucmass_ame.h:178
double amass
Atomic mass (in keV)
Definition: nucmass_ame.h:220
Tabulated nuclear masses [abstract base].
Definition: nucmass.h:325
bool is_loaded()
Returns true if data has been loaded.
Definition: nucmass_ame.h:254
Atomic mass entry structure.
Definition: nucmass_ame.h:155
int bde_acc
Beta-decay energy accuracy flag.
Definition: nucmass_ame.h:214
double damass
Atomic mass uncertainty (in keV)
Definition: nucmass_ame.h:223
entry * mass
The array containing the mass data of length ame::n.
Definition: nucmass_ame.h:280
std::string reference
The reference for the original data.
Definition: nucmass_ame.h:270
int Z
Proton number.
Definition: nucmass_ame.h:166
void ame_load(o2scl::nucmass_ame &ame, std::string file_name, std::string table_name)
Read data for o2scl::nucmass_ame from an HDF table specified in a file.
int get_nentries()
Return number of entries.
Definition: nucmass_ame.h:257
std::string get_reference()
Return the reference.
Definition: nucmass_ame.h:260
A simple nucleus class.
Definition: nucleus.h:55
int mass_acc
Mass accuracy flag.
Definition: nucmass_ame.h:184
int N
Neutron number.
Definition: nucmass_ame.h:163
int n
The number of entries (about 3000).
Definition: nucmass_ame.h:267
double dbde
Beta-decay energy uncertainty (in keV)
Definition: nucmass_ame.h:211
double bde
Beta-decay energy (in keV)
Definition: nucmass_ame.h:208
double dbe
Binding energy uncertainty (in keV, given in the &#39;95 data)
Definition: nucmass_ame.h:190

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