2020-11-16 13:38:39 -05:00
|
|
|
/*
|
|
|
|
|
|
|
|
MassLookup.h
|
|
|
|
Generates a map for isotopic masses using AMDC data; subtracts away
|
|
|
|
electron mass from the atomic mass by default. Creates a static global instance
|
|
|
|
of this map (MASS) for use throughout code it is included into.
|
|
|
|
|
|
|
|
Written by G.W. McCann Aug. 2020
|
|
|
|
|
2021-09-03 17:03:41 -04:00
|
|
|
Converted to true singleton to simplify usage -- Aug. 2021 GWM
|
2020-11-16 13:38:39 -05:00
|
|
|
*/
|
|
|
|
#ifndef MASS_LOOKUP_H
|
|
|
|
#define MASS_LOOKUP_H
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
2021-09-06 16:18:49 -04:00
|
|
|
|
|
|
|
namespace Mask {
|
|
|
|
|
|
|
|
class MassLookup {
|
|
|
|
public:
|
|
|
|
~MassLookup();
|
|
|
|
double FindMass(int Z, int A);
|
2022-06-09 11:29:02 -04:00
|
|
|
double FindMassU(int Z, int A) { return FindMass(Z, A)/u_to_mev; }
|
2021-09-06 16:18:49 -04:00
|
|
|
std::string FindSymbol(int Z, int A);
|
|
|
|
|
2021-09-06 17:06:02 -04:00
|
|
|
static MassLookup& GetInstance() {
|
|
|
|
static MassLookup s_instance;
|
2021-09-06 16:18:49 -04:00
|
|
|
return s_instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
MassLookup();
|
|
|
|
std::unordered_map<std::string, double> massTable;
|
|
|
|
std::unordered_map<int, std::string> elementTable;
|
|
|
|
|
|
|
|
//constants
|
|
|
|
static constexpr double u_to_mev = 931.4940954;
|
|
|
|
static constexpr double electron_mass = 0.000548579909;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2020-11-16 13:38:39 -05:00
|
|
|
|
|
|
|
#endif
|