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
#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);
o2scl_hdf::ame_load(ame,"12");
o2scl_hdf::mnmsk_load(mn);
o2scl_hdf::hfb_load(hfb,14);
o2scl_hdf::ame_load(ame03,"03");
size_t n_tables=6;
nucmass *massp[7]={&sm,&mn,&hfb,&ame03,&dz,&ktuy};
vector<nucleus> ame_dist;
vector<nucleus> fit_dist;
size_t n_fits=1;
double res;
for(size_t i=0;i<n_fits;i++) {
}
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);
}
}
}
return 0;
}
Typical output:
0 tests performed.
All tests passed.
Nuclear mass fit example
#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
double res;
o2scl_hdf::ame_load(ame,"12");
cout << sem.
B <<
" " << sem.
Sv <<
" " << sem.
Ss <<
" "
<< sem.
Ec <<
" " << sem.
Epair << endl;
cout << res << endl;
#else
cout << "No fitting was performed because O2scl appears not to have been "
<< "compiled with HDF support." << endl;
#endif
return 0;
}