Skip to content
Snippets Groups Projects
MagneticIon.cpp 74.5 KiB
Newer Older
  static const MagneticIon Pd0("Pd", static_cast<uint16_t>(0), j_Pd0[0],
                               j_Pd0[1], j_Pd0[2], j_Pd0[3], 2.);
  ion_map["Pd0"] = Pd0;
  static const MagneticIon Pd1("Pd", static_cast<uint16_t>(1), j_Pd1[0],
                               j_Pd1[1], j_Pd1[2], j_Pd1[3], 2.);
  ion_map["Pd1"] = Pd1;
  static const MagneticIon Ce2("Ce", static_cast<uint16_t>(2), j_Ce2[0],
                               j_Ce2[1], j_Ce2[2], j_Ce2[3], 0.8);
  ion_map["Ce2"] = Ce2;
  static const MagneticIon Ce3("Ce", static_cast<uint16_t>(2), j_Ce2[0],
Duc Le's avatar
Duc Le committed
                               j_Ce2[1], j_Ce2[2], j_Ce2[3], 6. / 7);
  static const MagneticIon Nd2("Nd", static_cast<uint16_t>(2), j_Nd2[0],
                               j_Nd2[1], j_Nd2[2], j_Nd2[3], 0.6);
  ion_map["Nd2"] = Nd2;
  static const MagneticIon Nd3("Nd", static_cast<uint16_t>(3), j_Nd3[0],
Duc Le's avatar
Duc Le committed
                               j_Nd3[1], j_Nd3[2], j_Nd3[3], 8. / 11);
  ion_map["Nd3"] = Nd3;
  static const MagneticIon Sm2("Sm", static_cast<uint16_t>(2), j_Sm2[0],
                               j_Sm2[1], j_Sm2[2], j_Sm2[3], 0.);
  ion_map["Sm2"] = Sm2;
  static const MagneticIon Sm3("Sm", static_cast<uint16_t>(3), j_Sm3[0],
Duc Le's avatar
Duc Le committed
                               j_Sm3[1], j_Sm3[2], j_Sm3[3], 2. / 7);
  ion_map["Sm3"] = Sm3;
  static const MagneticIon Eu2("Eu", static_cast<uint16_t>(2), j_Eu2[0],
                               j_Eu2[1], j_Eu2[2], j_Eu2[3], 2.);
  ion_map["Eu2"] = Eu2;
  static const MagneticIon Eu3("Eu", static_cast<uint16_t>(3), j_Eu3[0],
                               j_Eu3[1], j_Eu3[2], j_Eu3[3], 0.);
  ion_map["Eu3"] = Eu3;
  static const MagneticIon Gd2("Gd", static_cast<uint16_t>(2), j_Gd2[0],
                               j_Gd2[1], j_Gd2[2], j_Gd2[3], 1.5);
  ion_map["Gd2"] = Gd2;
  static const MagneticIon Gd3("Gd", static_cast<uint16_t>(3), j_Gd3[0],
                               j_Gd3[1], j_Gd3[2], j_Gd3[3], 2.);
  ion_map["Gd3"] = Gd3;
  static const MagneticIon Tb2("Tb", static_cast<uint16_t>(2), j_Tb2[0],
Duc Le's avatar
Duc Le committed
                               j_Tb2[1], j_Tb2[2], j_Tb2[3], 4. / 3);
  ion_map["Tb2"] = Tb2;
  static const MagneticIon Tb3("Tb", static_cast<uint16_t>(3), j_Tb3[0],
                               j_Tb3[1], j_Tb3[2], j_Tb3[3], 1.5);
  ion_map["Tb3"] = Tb3;
  static const MagneticIon Dy2("Dy", static_cast<uint16_t>(2), j_Dy2[0],
                               j_Dy2[1], j_Dy2[2], j_Dy2[3], 1.25);
  ion_map["Dy2"] = Dy2;
  static const MagneticIon Dy3("Dy", static_cast<uint16_t>(3), j_Dy3[0],
Duc Le's avatar
Duc Le committed
                               j_Dy3[1], j_Dy3[2], j_Dy3[3], 4. / 3);
  ion_map["Dy3"] = Dy3;
  static const MagneticIon Ho2("Ho", static_cast<uint16_t>(2), j_Ho2[0],
                               j_Ho2[1], j_Ho2[2], j_Ho2[3], 1.2);
  ion_map["Ho2"] = Ho2;
  static const MagneticIon Ho3("Ho", static_cast<uint16_t>(3), j_Ho3[0],
                               j_Ho3[1], j_Ho3[2], j_Ho3[3], 1.25);
  ion_map["Ho3"] = Ho3;
  static const MagneticIon Er2("Er", static_cast<uint16_t>(2), j_Er2[0],
Duc Le's avatar
Duc Le committed
                               j_Er2[1], j_Er2[2], j_Er2[3], 7. / 6);
  ion_map["Er2"] = Er2;
  static const MagneticIon Er3("Er", static_cast<uint16_t>(3), j_Er3[0],
                               j_Er3[1], j_Er3[2], j_Er3[3], 1.2);
  ion_map["Er3"] = Er3;
  static const MagneticIon Tm2("Tm", static_cast<uint16_t>(2), j_Tm2[0],
Duc Le's avatar
Duc Le committed
                               j_Tm2[1], j_Tm2[2], j_Tm2[3], 8. / 7);
  ion_map["Tm2"] = Tm2;
  static const MagneticIon Tm3("Tm", static_cast<uint16_t>(3), j_Tm3[0],
Duc Le's avatar
Duc Le committed
                               j_Tm3[1], j_Tm3[2], j_Tm3[3], 7. / 6);
  ion_map["Tm3"] = Tm3;
  static const MagneticIon Yb2("Yb", static_cast<uint16_t>(2), j_Yb2[0],
                               j_Yb2[1], j_Yb2[2], j_Yb2[3], 2.);
  ion_map["Yb2"] = Yb2;
  static const MagneticIon Yb3("Yb", static_cast<uint16_t>(3), j_Yb3[0],
Duc Le's avatar
Duc Le committed
                               j_Yb3[1], j_Yb3[2], j_Yb3[3], 8. / 7);
  ion_map["Yb3"] = Yb3;
  static const MagneticIon Pr3("Pr", static_cast<uint16_t>(3), j_Pr3[0],
                               j_Pr3[1], j_Pr3[2], j_Pr3[3], 0.8);
  ion_map["Pr3"] = Pr3;
  static const MagneticIon U3("U", static_cast<uint16_t>(3), j_U3[0], j_U3[1],
Duc Le's avatar
Duc Le committed
                              j_U3[2], j_U3[3], 8. / 11);
  ion_map["U3"] = U3;
  static const MagneticIon U4("U", static_cast<uint16_t>(4), j_U4[0], j_U4[1],
  ion_map["U4"] = U4;
  static const MagneticIon U5("U", static_cast<uint16_t>(5), j_U5[0], j_U5[1],
Duc Le's avatar
Duc Le committed
                              j_U5[2], j_U5[3], 6. / 7);
  ion_map["U5"] = U5;
  static const MagneticIon Np3("Np", static_cast<uint16_t>(3), j_Np3[0],
                               j_Np3[1], j_Np3[2], j_Np3[3], 0.6);
  ion_map["Np3"] = Np3;
  static const MagneticIon Np4("Np", static_cast<uint16_t>(4), j_Np4[0],
Duc Le's avatar
Duc Le committed
                               j_Np4[1], j_Np4[2], j_Np4[3], 8. / 11);
  ion_map["Np4"] = Np4;
  static const MagneticIon Np5("Np", static_cast<uint16_t>(5), j_Np5[0],
                               j_Np5[1], j_Np5[2], j_Np5[3], 0.8);
  ion_map["Np5"] = Np5;
  static const MagneticIon Np6("Np", static_cast<uint16_t>(6), j_Np6[0],
Duc Le's avatar
Duc Le committed
                               j_Np6[1], j_Np6[2], j_Np6[3], 6. / 7);
  ion_map["Np6"] = Np6;
  static const MagneticIon Pu3("Pu", static_cast<uint16_t>(3), j_Pu3[0],
Duc Le's avatar
Duc Le committed
                               j_Pu3[1], j_Pu3[2], j_Pu3[3], 2. / 7);
  ion_map["Pu3"] = Pu3;
  static const MagneticIon Pu4("Pu", static_cast<uint16_t>(4), j_Pu4[0],
                               j_Pu4[1], j_Pu4[2], j_Pu4[3], 0.6);
  ion_map["Pu4"] = Pu4;
  static const MagneticIon Pu5("Pu", static_cast<uint16_t>(5), j_Pu5[0],
Duc Le's avatar
Duc Le committed
                               j_Pu5[1], j_Pu5[2], j_Pu5[3], 8. / 11);
  ion_map["Pu5"] = Pu5;
  static const MagneticIon Pu6("Pu", static_cast<uint16_t>(6), j_Pu6[0],
                               j_Pu6[1], j_Pu6[2], j_Pu6[3], 0.8);
  ion_map["Pu6"] = Pu6;
  static const MagneticIon Am2("Am", static_cast<uint16_t>(2), j_Am2[0],
                               j_Am2[1], j_Am2[2], j_Am2[3], 2.);
  ion_map["Am2"] = Am2;
  static const MagneticIon Am3("Am", static_cast<uint16_t>(3), j_Am3[0],
                               j_Am3[1], j_Am3[2], j_Am3[3], 0.);
  ion_map["Am3"] = Am3;
  static const MagneticIon Am4("Am", static_cast<uint16_t>(4), j_Am4[0],
Duc Le's avatar
Duc Le committed
                               j_Am4[1], j_Am4[2], j_Am4[3], 2. / 7);
  ion_map["Am4"] = Am4;
  static const MagneticIon Am5("Am", static_cast<uint16_t>(5), j_Am5[0],
                               j_Am5[1], j_Am5[2], j_Am5[3], 0.6);
  ion_map["Am5"] = Am5;
  static const MagneticIon Am6("Am", static_cast<uint16_t>(6), j_Am6[0],
Duc Le's avatar
Duc Le committed
                               j_Am6[1], j_Am6[2], j_Am6[3], 8. / 11);
  ion_map["Am6"] = Am6;
  static const MagneticIon Am7("Am", static_cast<uint16_t>(7), j_Am7[0],
                               j_Am7[1], j_Am7[2], j_Am7[3], 0.8);
  ion_map["Am7"] = Am7;
  // 5d ions
  static const MagneticIon Hf2("Hf", static_cast<uint16_t>(2), j_Hf2[0],
                               j_Hf2[1], j_Hf2[2], 2.);
  ion_map["Hf2"] = Hf2;
  static const MagneticIon Hf3("Hf", static_cast<uint16_t>(3), j_Hf3[0],
                               j_Hf3[1], j_Hf3[2], 2.);
  ion_map["Hf3"] = Hf3;
  static const MagneticIon Ta2("Ta", static_cast<uint16_t>(2), j_Ta2[0],
                               j_Ta2[1], j_Ta2[2], 2.);
  ion_map["Ta2"] = Ta2;
  static const MagneticIon Ta3("Ta", static_cast<uint16_t>(3), j_Ta3[0],
                               j_Ta3[1], j_Ta3[2], 2.);
  ion_map["Ta3"] = Ta3;
  static const MagneticIon Ta4("Ta", static_cast<uint16_t>(4), j_Ta4[0],
                               j_Ta4[1], j_Ta4[2], 2.);
  ion_map["Ta4"] = Ta4;
Duc Le's avatar
Duc Le committed
  static const MagneticIon W0("W", static_cast<uint16_t>(0), j_W0[0], j_W0[1],
                              j_W0[2], 2.);
Duc Le's avatar
Duc Le committed
  static const MagneticIon W1("W", static_cast<uint16_t>(1), j_W1[0], j_W1[1],
                              j_W1[2], 2.);
Duc Le's avatar
Duc Le committed
  static const MagneticIon W2("W", static_cast<uint16_t>(2), j_W2[0], j_W2[1],
                              j_W2[2], 2.);
Duc Le's avatar
Duc Le committed
  static const MagneticIon W3("W", static_cast<uint16_t>(3), j_W3[0], j_W3[1],
                              j_W3[2], 2.);
Duc Le's avatar
Duc Le committed
  static const MagneticIon W4("W", static_cast<uint16_t>(4), j_W4[0], j_W4[1],
                              j_W4[2], 2.);
Duc Le's avatar
Duc Le committed
  static const MagneticIon W5("W", static_cast<uint16_t>(5), j_W5[0], j_W5[1],
                              j_W5[2], 2.);
  ion_map["W5"] = W5;
  static const MagneticIon Re0("Re", static_cast<uint16_t>(0), j_Re0[0],
                               j_Re0[1], j_Re0[2], 2.);
  ion_map["Re0"] = Re0;
  static const MagneticIon Re1("Re", static_cast<uint16_t>(1), j_Re1[0],
                               j_Re1[1], j_Re1[2], 2.);
  ion_map["Re1"] = Re1;
  static const MagneticIon Re2("Re", static_cast<uint16_t>(2), j_Re2[0],
                               j_Re2[1], j_Re2[2], 2.);
  ion_map["Re2"] = Re2;
  static const MagneticIon Re3("Re", static_cast<uint16_t>(3), j_Re3[0],
                               j_Re3[1], j_Re3[2], 2.);
  ion_map["Re3"] = Re3;
  static const MagneticIon Re4("Re", static_cast<uint16_t>(4), j_Re4[0],
                               j_Re4[1], j_Re4[2], 2.);
  ion_map["Re4"] = Re4;
  static const MagneticIon Re5("Re", static_cast<uint16_t>(5), j_Re5[0],
                               j_Re5[1], j_Re5[2], 2.);
  ion_map["Re5"] = Re5;
  static const MagneticIon Re6("Re", static_cast<uint16_t>(6), j_Re6[0],
                               j_Re6[1], j_Re6[2], 2.);
  ion_map["Re6"] = Re6;
  static const MagneticIon Os0("Os", static_cast<uint16_t>(0), j_Os0[0],
                               j_Os0[1], j_Os0[2], 2.);
  ion_map["Os0"] = Os0;
  static const MagneticIon Os1("Os", static_cast<uint16_t>(1), j_Os1[0],
                               j_Os1[1], j_Os1[2], 2.);
  ion_map["Os1"] = Os1;
  static const MagneticIon Os2("Os", static_cast<uint16_t>(2), j_Os2[0],
                               j_Os2[1], j_Os2[2], 2.);
  ion_map["Os2"] = Os2;
  static const MagneticIon Os3("Os", static_cast<uint16_t>(3), j_Os3[0],
                               j_Os3[1], j_Os3[2], 2.);
  ion_map["Os3"] = Os3;
  static const MagneticIon Os4("Os", static_cast<uint16_t>(4), j_Os4[0],
                               j_Os4[1], j_Os4[2], 2.);
  ion_map["Os4"] = Os4;
  static const MagneticIon Os5("Os", static_cast<uint16_t>(5), j_Os5[0],
                               j_Os5[1], j_Os5[2], 2.);
  ion_map["Os5"] = Os5;
  static const MagneticIon Os6("Os", static_cast<uint16_t>(6), j_Os6[0],
                               j_Os6[1], j_Os6[2], 2.);
  ion_map["Os6"] = Os6;
  static const MagneticIon Os7("Os", static_cast<uint16_t>(7), j_Os7[0],
                               j_Os7[1], j_Os7[2], 2.);
  ion_map["Os7"] = Os7;
  static const MagneticIon Ir0("Ir", static_cast<uint16_t>(0), j_Ir0[0],
                               j_Ir0[1], j_Ir0[2], 2.);
  ion_map["Ir0"] = Ir0;
  static const MagneticIon Ir1("Ir", static_cast<uint16_t>(1), j_Ir1[0],
                               j_Ir1[1], j_Ir1[2], 2.);
  ion_map["Ir1"] = Ir1;
  static const MagneticIon Ir2("Ir", static_cast<uint16_t>(2), j_Ir2[0],
                               j_Ir2[1], j_Ir2[2], 2.);
  ion_map["Ir2"] = Ir2;
  static const MagneticIon Ir3("Ir", static_cast<uint16_t>(3), j_Ir3[0],
                               j_Ir3[1], j_Ir3[2], 2.);
  ion_map["Ir3"] = Ir3;
  static const MagneticIon Ir4("Ir", static_cast<uint16_t>(4), j_Ir4[0],
                               j_Ir4[1], j_Ir4[2], 2.);
  ion_map["Ir4"] = Ir4;
  static const MagneticIon Ir5("Ir", static_cast<uint16_t>(5), j_Ir5[0],
                               j_Ir5[1], j_Ir5[2], 2.);
  ion_map["Ir5"] = Ir5;
  static const MagneticIon Ir6("Ir", static_cast<uint16_t>(6), j_Ir6[0],
                               j_Ir6[1], j_Ir6[2], 2.);
  ion_map["Ir6"] = Ir6;
  static const MagneticIon Pt1("Pt", static_cast<uint16_t>(1), j_Pt1[0],
                               j_Pt1[1], j_Pt1[2], 2.);
  ion_map["Pt1"] = Pt1;
  static const MagneticIon Pt2("Pt", static_cast<uint16_t>(2), j_Pt2[0],
                               j_Pt2[1], j_Pt2[2], 2.);
  ion_map["Pt2"] = Pt2;
  static const MagneticIon Pt3("Pt", static_cast<uint16_t>(3), j_Pt3[0],
                               j_Pt3[1], j_Pt3[2], 2.);
  ion_map["Pt3"] = Pt3;
  static const MagneticIon Pt4("Pt", static_cast<uint16_t>(4), j_Pt4[0],
                               j_Pt4[1], j_Pt4[2], 2.);
  ion_map["Pt4"] = Pt4;
  static const MagneticIon Pt5("Pt", static_cast<uint16_t>(5), j_Pt5[0],
                               j_Pt5[1], j_Pt5[2], 2.);
  ion_map["Pt5"] = Pt5;
  static const MagneticIon Pt6("Pt", static_cast<uint16_t>(6), j_Pt6[0],
                               j_Pt6[1], j_Pt6[2], 2.);
  ion_map["Pt6"] = Pt6;
  static const MagneticIon Au1("Au", static_cast<uint16_t>(1), j_Au1[0],
                               j_Au1[1], j_Au1[2], 2.);
  ion_map["Au1"] = Au1;
  static const MagneticIon Au2("Au", static_cast<uint16_t>(2), j_Au2[0],
                               j_Au2[1], j_Au2[2], 2.);
  ion_map["Au2"] = Au2;
  static const MagneticIon Au3("Au", static_cast<uint16_t>(3), j_Au3[0],
                               j_Au3[1], j_Au3[2], 2.);
  ion_map["Au3"] = Au3;
  static const MagneticIon Au4("Au", static_cast<uint16_t>(4), j_Au4[0],
                               j_Au4[1], j_Au4[2], 2.);
  ion_map["Au4"] = Au4;
  static const MagneticIon Au5("Au", static_cast<uint16_t>(5), j_Au5[0],
                               j_Au5[1], j_Au5[2], 2.);
  ion_map["Au5"] = Au5;
/**
 * Returns a MagneticIon corresponding to the given symbol containing the atom &
 * charge
 * Throws std::runtime_error if one cannot be found
 * @param symbol :: The string symbol
 * @return A reference to the required ion
 */
const MagneticIon &getMagneticIon(const std::string &symbol) {
  const IonIndex &ionIndex = ionMap();
  auto cit = ionIndex.find(symbol);
  if (cit == ionIndex.end()) {
    // no such combination
    std::stringstream msg;
    msg << "Failed to find an atom using symbol=" << symbol;
    throw std::runtime_error(msg.str());
  } else {
    return cit->second;
  }
}
/**
 * Returns a MagneticIon corresponding  to the given symbol & charge.
 * Throws std::runtime_error if one cannot be found
 * @param symbol :: The string symbol
 * @param charge :: The charge
 * @return
 */
const MagneticIon &getMagneticIon(const std::string &symbol,
                                  const uint16_t charge) {
  std::stringstream what;
  what << symbol << charge;
  return getMagneticIon(what.str());
}
/**
 * Returns the coffieients for a given angular momentum
 * @param symbol :: The string symbol defining the element
 * @param charge :: The charge
 * @param l :: The angular momentum
 * @return The coefficients or throws if either the ion doesn't exist or the
 * angular momentum is invalid
 */
std::vector<double> getJL(const std::string &symbol, const uint16_t charge,
                          const uint16_t l) {
  MagneticIon ion(getMagneticIon(symbol, charge));
  std::vector<double> v(8, 0.);
  switch (l) {
  case 0:
    v = ion.j0;
    break;
  case 2:
    v = ion.j2;
    break;
  case 4:
    v = ion.j4;
    break;
  case 6:
    v = ion.j6;
    break;
  default:
    // all other <jl> are not defined
    std::stringstream msg;
    msg << "Failed to find <j" << l << ">";
    throw std::runtime_error(msg.str());
  }
  return v;
}
/**
 * Returns a std::vector<std::string> of the keys of ion_map
 * (a list of all ions programmed into this class)
 * @return
 */
std::vector<std::string> getMagneticIonList() {
  const IonIndex &ionIndex = ionMap();
  std::vector<std::string> keys;
  keys.reserve(ionIndex.size());
  std::transform(ionIndex.cbegin(), ionIndex.cend(), std::back_inserter(keys),
                 [](const auto kv) { return kv.first; });
} // namespace PhysicalConstants