All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Nuclei and nuclear masses

A basic data structure for nuclei, class o2scl::nucleus, is implemented as a child of of o2scl::part.

Nuclear masses are given as children of o2scl::nucmass and are generally of two types: tables of masses (children of o2scl::nucmass_table) or formulas which generate masses from a set of parameters and can be fit to data (o2scl::nucmass_fit).

There are five mass table types currently included.

The mass formulas which can be fit to data are

In order to create a set of nuclei stored in a std::vector object, one can use o2scl_part::nucdist_set().

Nuclear mass example

/* Example: ex_nucmass.cpp
-------------------------------------------------------------------
Demonstrate nuclear mass formulas by comparing them with
the Audi et al. (2003) atomic mass evaluation. This example
computes the RMS deviation in the mass excess.
*/
#include <iostream>
#include <o2scl/test_mgr.h>
#include <o2scl/table_units.h>
#include <o2scl/hdf_file.h>
#include <o2scl/hdf_io.h>
#include <o2scl/hdf_nucmass_io.h>
#include <o2scl/nucmass.h>
#include <o2scl/nucdist.h>
#include <o2scl/nucmass_fit.h>
#include <o2scl/nucmass_dz.h>
#include <o2scl/nucmass_ktuy.h>
using namespace std;
using namespace o2scl;
using namespace o2scl_const;
using namespace o2scl_hdf;
int main(void) {
cout.setf(ios::scientific);
// The most recent experimental masses as a baseline
o2scl_hdf::ame_load(ame,"12");
// Instantiate and load all of the nuclear mass objects
o2scl_hdf::mnmsk_load(mn);
o2scl_hdf::hfb_load(hfb,14);
o2scl_hdf::ame_load(ame03,"03");
// List of pointers to all masses
size_t n_tables=6;
nucmass *massp[7]={&sm,&mn,&hfb,&ame03,&dz,&ktuy};
// Create a distribution with all of the experimental masses
vector<nucleus> ame_dist;
nucdist_set(ame_dist,ame);
// Create a smaller distribution to fit to
vector<nucleus> fit_dist;
nucdist_set(ame_dist,ame,"N>7 & Z>7");
// Fit to the experimental masses
size_t n_fits=1;
nucdist_set(mf.dist,ame);
double res;
nucmass_fit_base *fitp[2]={&sm};
for(size_t i=0;i<n_fits;i++) {
mf.fit(*(fitp[i]),res);
}
// Create a table to store the data
tu.line_of_names("Z N ame sm mn hfb ame03 dz ktuy");
// Create the table
for(size_t i=0;i<ame_dist.size();i++) {
vector<double> line;
line.push_back(ame_dist[i].Z);
line.push_back(ame_dist[i].N);
double ame_mass=ame.mass_excess(ame_dist[i].Z,ame_dist[i].N);
line.push_back(ame_mass);
for(size_t j=0;j<n_tables;j++) {
if (massp[j]->is_included(ame_dist[i].Z,ame_dist[i].N)) {
line.push_back
(ame_mass-massp[j]->mass_excess(ame_dist[i].Z,ame_dist[i].N));
} else {
line.push_back(0.0);
}
}
tu.line_of_data(line.size(),line);
}
// Output the table to a file
hf.open_or_create("ex_nucmass_table.o2");
hdf_output(hf,tu,"nuclear_masses");
hf.close();
t.report();
return 0;
}
// End of example

Typical output:

0 tests performed.
All tests passed.
ex_nucmass_mn.png
ex_nucmass_ame13.png
ex_nucmass_dz.png
ex_nucmass_hfb.png
ex_nucmass_ktuy.png
ex_nucmass_sm.png

Nuclear mass fit example

/* Example: ex_nucmass_fit.cpp
-------------------------------------------------------------------
*/
#include <iostream>
#include <o2scl/test_mgr.h>
#include <o2scl/nucmass_fit.h>
#ifdef O2SCL_HDF
#include <o2scl/hdf_file.h>
#include <o2scl/hdf_nucmass_io.h>
#endif
using namespace std;
using namespace o2scl;
using namespace o2scl_const;
int main(void) {
cout.setf(ios::scientific);
#ifdef O2SCL_HDF
// The RMS deviation of the fit
double res;
// The mass formula to be fitted
// The fitting class
// Load the experimental data
o2scl_hdf::ame_load(ame,"12");
nucdist_set(mf.dist,ame);
// Perform the fit
mf.fit(sem,res);
// Output the results
cout << sem.B << " " << sem.Sv << " " << sem.Ss << " "
<< sem.Ec << " " << sem.Epair << endl;
cout << res << endl;
t.test_gen(res<4.0,"Successful fit.");
#else
cout << "No fitting was performed because O2scl appears not to have been "
<< "compiled with HDF support." << endl;
#endif
t.report();
return 0;
}
// End of example

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..