/* 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 Converted to true singleton to simplify usage -- Aug. 2021 GWM */ #ifndef MASS_LOOKUP_H #define MASS_LOOKUP_H #include #include #include namespace Mask { class MassLookup { public: ~MassLookup(); double FindMass(int Z, int A); double FindMassU(int Z, int A) { return FindMass(Z, A)/u_to_mev; } std::string FindSymbol(int Z, int A); static MassLookup& GetInstance() { static MassLookup s_instance; return s_instance; } private: MassLookup(); std::unordered_map massTable; std::unordered_map elementTable; //constants static constexpr double u_to_mev = 931.4940954; static constexpr double electron_mass = 0.000548579909; }; } #endif