The macro in this page returns Atomic Number or Number of Protons, or Number of Electrons based on Atomic Symbol. This macro has been tested working in v6 and v7.
macro Atomic_Number(Atom) { #if (Atom == "H") 1 #elseif (Atom == "He") 2 #elseif (Atom == "Li") 3 #elseif (Atom == "Be") 4 #elseif (Atom == "B") 5 #elseif (Atom == "C") 6 #elseif (Atom == "N") 7 #elseif (Atom == "O") 8 #elseif (Atom == "F") 9 #elseif (Atom == "Ne") 10 #elseif (Atom == "Na") 11 #elseif (Atom == "Mg") 12 #elseif (Atom == "Al") 13 #elseif (Atom == "Si") 14 #elseif (Atom == "P") 15 #elseif (Atom == "S") 16 #elseif (Atom == "Cl") 17 #elseif (Atom == "Ar") 18 #elseif (Atom == "K") 19 #elseif (Atom == "Ca") 20 #elseif (Atom == "Sc") 21 #elseif (Atom == "Ti") 22 #elseif (Atom == "V") 23 #elseif (Atom == "Cr") 24 #elseif (Atom == "Mn") 25 #elseif (Atom == "Fe") 26 #elseif (Atom == "Co") 27 #elseif (Atom == "Ni") 28 #elseif (Atom == "Cu") 29 #elseif (Atom == "Zn") 30 #elseif (Atom == "Ga") 31 #elseif (Atom == "Ge") 32 #elseif (Atom == "As") 33 #elseif (Atom == "Se") 34 #elseif (Atom == "Br") 35 #elseif (Atom == "Kr") 36 #elseif (Atom == "Rb") 37 #elseif (Atom == "Sr") 38 #elseif (Atom == "Y") 39 #elseif (Atom == "Zr") 40 #elseif (Atom == "Nb") 41 #elseif (Atom == "Mo") 42 #elseif (Atom == "Tc") 43 #elseif (Atom == "Ru") 44 #elseif (Atom == "Rh") 45 #elseif (Atom == "Pd") 46 #elseif (Atom == "Ag") 47 #elseif (Atom == "Cd") 48 #elseif (Atom == "In") 49 #elseif (Atom == "Sn") 50 #elseif (Atom == "Sb") 51 #elseif (Atom == "Te") 52 #elseif (Atom == "I") 53 #elseif (Atom == "Xe") 54 #elseif (Atom == "Cs") 55 #elseif (Atom == "Ba") 56 #elseif (Atom == "La") 57 #elseif (Atom == "Ce") 58 #elseif (Atom == "Pr") 59 #elseif (Atom == "Nd") 60 #elseif (Atom == "Pm") 61 #elseif (Atom == "Sm") 62 #elseif (Atom == "Eu") 63 #elseif (Atom == "Gd") 64 #elseif (Atom == "Tb") 65 #elseif (Atom == "Dy") 66 #elseif (Atom == "Ho") 67 #elseif (Atom == "Er") 68 #elseif (Atom == "Tm") 69 #elseif (Atom == "Yb") 70 #elseif (Atom == "Lu") 71 #elseif (Atom == "Hf") 72 #elseif (Atom == "Ta") 73 #elseif (Atom == "W") 74 #elseif (Atom == "Re") 75 #elseif (Atom == "Os") 76 #elseif (Atom == "Ir") 77 #elseif (Atom == "Pt") 78 #elseif (Atom == "Au") 79 #elseif (Atom == "Hg") 80 #elseif (Atom == "Tl") 81 #elseif (Atom == "Pb") 82 #elseif (Atom == "Bi") 83 #elseif (Atom == "Po") 84 #elseif (Atom == "At") 85 #elseif (Atom == "Rn") 86 #elseif (Atom == "Fr") 87 #elseif (Atom == "Ra") 88 #elseif (Atom == "Ac") 89 #elseif (Atom == "Th") 90 #elseif (Atom == "Pa") 91 #elseif (Atom == "U") 92 #elseif (Atom == "Np") 93 #elseif (Atom == "Pu") 94 #elseif (Atom == "Am") 95 #elseif (Atom == "Cm") 96 #elseif (Atom == "Bk") 97 #elseif (Atom == "Cf") 98 #elseif (Atom == "Es") 99 #elseif (Atom == "Fm") 100 #elseif (Atom == "Md") 101 #elseif (Atom == "No") 102 #elseif (Atom == "Lr") 103 #elseif (Atom == "Rf") 104 #elseif (Atom == "Db") 105 #elseif (Atom == "Sg") 106 #elseif (Atom == "Bh") 107 #elseif (Atom == "Hs") 108 #elseif (Atom == "Mt") 109 #elseif (Atom == "Ds") 110 #elseif (Atom == "Rg") 111 #elseif (Atom == "Cn") 112 #elseif (Atom == "Nh") 113 #elseif (Atom == "Fl") 114 #elseif (Atom == "Mc") 115 #elseif (Atom == "Lv") 116 #elseif (Atom == "Ts") 117 #elseif (Atom == "Og") 118 #endif }
RAW(corundum) CuKa5(0.001) Radius(173) LP_Factor(26.6) Full_Axial_Model(12, 15, 12, 4.6, 4.6) Slit_Width(0.3) Divergence(1) Absorption(@, 30) ZE(@, 0) One_on_X(@, 2000) bkg @ 0 0 0 0 0 0 STR(R_-3_C) phase_name "Corundum" Trigonal(@ 4.758467`, @ 12.990371`) site Al num_posns 12 x 0 y 0 z @ 0.35228` occ Al 1 beq @ 0.30072` prm Al_electrons =Get(num_posns) * Atomic_Number("Al"); site O num_posns 18 x @ 0.30608` y 0 z 0.25 occ O 1 beq @ 0.16898` prm O_electrons =Get(num_posns) * Atomic_Number("O"); scale @ 0.00208215503` CS_L(@, 274.288734`) Strain_L(@, 0.01637535`) prm = Al_electrons + O_electrons;:300 ' Total Number of Electron in Unit Cell
If any user in our open TOPAS community has suggestion or idea, or bug report on these macros, please kindly let me know and I am happy to learn from you: tony.wang@qut.edu.au Thanks for Alan's inspiration about #if. :)