DelphiUdIT 242 Posted May 19 (edited) Hello everyone. From a post in the international Lazarus forum ( https://forum.lazarus.freepascal.org/index.php/topic,71183.msg555336.html#msg555336 ) I noticed the use of the "absolute" directive to actually initialize an array of records. By defining an initialized array of strings, these are then fully matched to an array of records. I knew about the "absolute" directive, but honestly I have never seen it applied (or at least I have never noticed it, I vaguely remember seeing it in Indy). Apart from other ways to obtain the same results, does the definition as it was made have any contraindications other than the pure reading of an element of the record (I think of its writing or passing as a "var" to some processing method)? Sample: const TABLE_SIZE = 118; //118*3 -1 = array size TABLE_DATA: array[0..pred(TABLE_SIZE * 3)] of string = ( 'H', 'Hydrogen', '1.00794', 'He', 'Helium', '4.002602', 'Li', 'Lithium', '6.941', 'Be', 'Beryllium', '9.012182', 'B', 'Boron', '10.811', 'C', 'Carbon', '12.0107', 'N', 'Nitrogen', '14.0067', 'O', 'Oxygen', '15.9994', 'F', 'Fluorine', '18.9984032', 'Ne', 'Neon', '20.1797', 'Na', 'Sodium', '22.98976...', 'Mg', 'Magnesium', '24.305', 'Al', 'Aluminium', '26.9815386', 'Si', 'Silicon', '28.0855', 'P', 'Phosphorus', '30.973762', 'S', 'Sulfur', '32.065', 'Cl', 'Chlorine', '35.453', 'Ar', 'Argon', '39.948', 'K', 'Potassium', '39.948', 'Ca', 'Calcium', '40.078', 'Sc', 'Scandium', '44.955912', 'Ti', 'Titanium', '47.867', 'V', 'Vanadium', '50.9415', 'Cr', 'Chromium', '51.9961', 'Mn', 'Manganese', '54.938045', 'Fe', 'Iron', '55.845', 'Co', 'Cobalt', '58.933195', 'Ni', 'Nickel', '58.6934', 'Cu', 'Copper', '63.546', 'Zn', 'Zinc', '65.38', 'Ga', 'Gallium', '69.723', 'Ge', 'Germanium', '72.63', 'As', 'Arsenic', '74.9216', 'Se', 'Selenium', '78.96', 'Br', 'Bromine', '79.904', 'Kr', 'Krypton', '83.798', 'Rb', 'Rubidium', '85.4678', 'Sr', 'Strontium', '87.62', 'Y', 'Yttrium', '88.90585', 'Zr', 'Zirconium', '91.224', 'Nb', 'Niobium', '92.90628', 'Mo', 'Molybdenum', '95.96', 'Tc', 'Technetium', '(98)', 'Ru', 'Ruthenium', '101.07', 'Rh', 'Rhodium', '102.9055', 'Pd', 'Palladium', '106.42', 'Ag', 'Silver', '107.8682', 'Cd', 'Cadmium', '112.411', 'In', 'Indium', '114.818', 'Sn', 'Tin', '118.71', 'Sb', 'Antimony', '121.76', 'Te', 'Tellurium', '127.6', 'I', 'Iodine', '126.90447', 'Xe', 'Xenon', '131.293', 'Cs', 'Caesium', '132.9054', 'Ba', 'Barium', '132.9054', 'La', 'Lanthanum', '138.90547', 'Ce', 'Cerium', '140.116', 'Pr', 'Praseodymium', '140.90765', 'Nd', 'Neodymium', '144.242', 'Pm', 'Promethium', '(145)', 'Sm', 'Samarium', '150.36', 'Eu', 'Europium', '151.964', 'Gd', 'Gadolinium', '157.25', 'Tb', 'Terbium', '158.92535', 'Dy', 'Dysprosium', '162.5', 'Ho', 'Holmium', '164.93032', 'Er', 'Erbium', '167.259', 'Tm', 'Thulium', '168.93421', 'Yb', 'Ytterbium', '173.054', 'Lu', 'Lutetium', '174.9668', 'Hf', 'Hafnium', '178.49', 'Ta', 'Tantalum', '180.94788', 'W', 'Tungsten', '183.84', 'Re', 'Rhenium', '186.207', 'Os', 'Osmium', '190.23', 'Ir', 'Iridium', '192.217', 'Pt', 'Platinum', '195.084', 'Au', 'Gold', '196.966569', 'Hg', 'Mercury', '200.59', 'Tl', 'Thallium', '204.3833', 'Pb', 'Lead', '207.2', 'Bi', 'Bismuth', '208.9804', 'Po', 'Polonium', '(209)', 'At', 'Astatine', '(210)', 'Rn', 'Radon', '(222)', 'Fr', 'Francium', '(223)', 'Ra', 'Radium', '(226)', 'Ac', 'Actinium', '(227)', 'Th', 'Thorium', '232.03806', 'Pa', 'Protactinium', '231.0588', 'U', 'Uranium', '238.02891', 'Np', 'Neptunium', '(237)', 'Pu', 'Plutonium', '(244)', 'Am', 'Americium', '(243)', 'Cm', 'Curium', '(247)', 'Bk', 'Berkelium', '(247)', 'Cf', 'Californium', '(251)', 'Es', 'Einstenium', '(252)', 'Fm', 'Fermium', '(257)', 'Md', 'Mendelevium', '(258)', 'No', 'Nobelium', '(259)', 'Lr', 'Lawrencium', '(262)', 'Rf', 'Rutherfordium', '(267)', 'Db', 'Dubnium', '(268)', 'Sg', 'Seaborgium', '(271)', 'Bh', 'Bohrium', '(272)', 'Hs', 'Hassium', '(270)', 'Mt', 'Meitnerium', '(276)', 'Ds', 'Darmstadium', '(281)', 'Rg', 'Roentgenium', '(280)', 'Cn', 'Copernicium', '(285)', 'Nh', 'Nihonium', '(286)', 'Fl', 'Flerovium', '(289)', 'Mc', 'Moscovium', '(290)', 'Lv', 'Livermorium', '(293)', 'Ts', 'Tennessine', '(294)', 'Og', 'Oganesson', '(294)'); var Elements : array[0..pred(TABLE_SIZE)] of record Symbol : string; Name : string; Mass : string; end absolute TABLE_DATA; { absolute, don't program without it !! } procedure XXXXX begin for var i in Elements do begin ShowMessage(i.Symbol+' / '+i.Name+' / '+i.Mass); end; end; Thanks EDIT: the question is for TABLE_DATA defined as "var" of course, not as "const" ... Edited May 19 by DelphiUdIT 1 Share this post Link to post
Stefan Glienke 2141 Posted May 19 One could make it a const array of records where mass would be a number instead of a string 1 Share this post Link to post
Rollo62 577 Posted May 19 (edited) Nice. To handle it more effectively, I would encapsulate this const array in an Enum with a record helper. That allows to add a lot of convenience functions around this table and offers a nice and effective Enum handle. Edited May 19 by Rollo62 1 Share this post Link to post
Anders Melander 1999 Posted May 19 I don't understand the question but... while absolute has its uses, in this case it would IMO just be laziness on the part of the developer. And what's up with the use of pred? Since when did that become more readable than -1 ? 1 Share this post Link to post
Uwe Raabe 2146 Posted May 19 1 hour ago, Anders Melander said: And what's up with the use of pred? Since when did that become more readable than -1 ? It survives the change from Integer to an enumeration type. 1 Share this post Link to post
Anders Melander 1999 Posted May 19 4 minutes ago, Uwe Raabe said: It survives the change from Integer to an enumeration type. What change? You mean a possible future change of the index type? I can't see how any of the Pred used here would survive that: TABLE_DATA: array[0..pred(TABLE_SIZE * 3)] of string Elements : array[0..pred(TABLE_SIZE)] of record Regardless, if I changed the index type I would want to review the implications of that change manually and not assume that it just worked - especially with absolute in the game. Share this post Link to post
David Heffernan 2437 Posted May 19 What are you trying to achieve here? As Stefan says, why aren't you declaring these as records to begin with? And why would you want to make anything here a variable. Seems like this area of Physics is pretty much fixed! 1 1 Share this post Link to post
David Heffernan 2437 Posted May 19 2 hours ago, Stefan Glienke said: where mass would be a number instead of a string I think the use of string here is to allow encoding of indeterminate masses for elements with no stable isotopes, or something along those lines. Look at the items with mass surrounded by parens. Share this post Link to post
DelphiUdIT 242 Posted May 19 It is not mine, I'm not a chemical tech. I only see the use of the "absolute" directive and ask if there is any issue (in assignement for example). By the way I have tested some uses case and i don't found any issue, it's like a normal array of records. Like I wrote, I had know that there are other methods, I was only curious about "absolute" used in array of records. Thank you all for your interest. Share this post Link to post
DelphiUdIT 242 Posted May 19 52 minutes ago, Anders Melander said: What change? You mean a possible future change of the index type? I can't see how any of the Pred used here would survive that: TABLE_DATA: array[0..pred(TABLE_SIZE * 3)] of string Elements : array[0..pred(TABLE_SIZE)] of record The use of pred here is only the result of copy / paste operation. But I use pred sometimes, especially when there is a dimension of an array in play. In a for / to cycle instead I use normally "-1". Share this post Link to post
Anders Melander 1999 Posted May 19 The only issue with absolute that I can think of is that the compiler treats the aliased variables as "volatile" which inhibits certain optimizations - AFAIR. Apart from that it's just like a hard typecast. Of course one has to avoid doing stupid things like using absolute on managed types. Share this post Link to post
DelphiUdIT 242 Posted May 19 1 minute ago, Anders Melander said: The only issue with absolute that I can think of is that the compiler treats the aliased variables as "volatile" which inhibits certain optimizations - AFAIR. Apart from that it's just like a hard typecast. Of course one has to avoid doing stupid things like using absolute on managed types. You are right, those were my fear. Share this post Link to post
Anders Melander 1999 Posted May 19 Just now, DelphiUdIT said: But I use pred sometimes, especially when there is a dimension of an array in play. Use High(MyArray) instead; It clearly communicates what your intentions are. IMO, using Succ and Pred for anything other than enumerations is like using Assigned on pointers (even object pointers). On delegates it makes sense, but for everything else I think (FooBar <> nil) is more readable and better communicate intention than Assigned(FooBar). I'm sure everybody agrees with me on that 😉 1 Share this post Link to post
Anders Melander 1999 Posted May 19 4 minutes ago, DelphiUdIT said: You are right, those were my fear. If you mean the volatile thing then it's not a problem unless you are doing high performance low-level stuff. AFAIR the worst that can happen is that a value is kept on the stack instead of in a register. Share this post Link to post
DelphiUdIT 242 Posted May 19 (edited) 23 minutes ago, Anders Melander said: is like using Assigned on pointers (even object pointers). On delegates it makes sense, but for everything else I think (FooBar <> nil) is more readable and better communicate intention than Assigned(FooBar). I'm sure everybody agrees with me on that 😉 Lool, I always use Assigned(...) hoping that one day or another it will solve all the situations (either nil or an invalid pointer) 🙂 Edited May 19 by DelphiUdIT Share this post Link to post
David Heffernan 2437 Posted May 19 1 hour ago, DelphiUdIT said: I always use Assigned(...) hoping that one day or another it will solve all the situations (either nil or an invalid pointer) 🙂 It will never find invalid pointers, but that's not why Assigned exists Share this post Link to post
David Heffernan 2437 Posted May 19 2 hours ago, DelphiUdIT said: It is not mine, I'm not a chemical tech. I only see the use of the "absolute" directive and ask if there is any issue (in assignement for example). By the way I have tested some uses case and i don't found any issue, it's like a normal array of records. Like I wrote, I had know that there are other methods, I was only curious about "absolute" used in array of records. Thank you all for your interest. It has nothing to do with assignment. It's pretty rare for absolute to be useful. Pretend it doesn't exists, and you'll get a long way. 1 Share this post Link to post
Anders Melander 1999 Posted May 19 24 minutes ago, David Heffernan said: It's pretty rare for absolute to be useful. Pretend it doesn't exists, and you'll get a long way. I agree - but here's a few examples of where I've used it: // Using absolute to rename a public API function while maintaining backward compatibility: // - MyFunction is the old API entrypoint. // - NewNameSameFunction is the new API entrypoint. type TMyDelegate = procedure(X, Y, Z: Single); var NewNameSameFunction: TMyDelegate var MyFunction: TMyDelegate absolute NewNameSameFunction deprecated 'Use NewNameSameFunction instead'; // Same with global vars: type TLUT88 = array[byte, byte] of byte; var DivMul255Table: TLUT88; MulDiv255Table: TLUT88; var RcTable: TLUT88 absolute DivMul255Table; DivTable: TLUT88 absolute MulDiv255Table; // Casting between "uncastable" types without pointers procedure FooBar(const X1, Y1, X2, Y2: Single) var Y1bin: Cardinal absolute Y1; Y2bin: Cardinal absolute Y2; begin // Fast way of testing if a Single is zero; Same as "if (Y1 = 0) and (Y2 = 0) then" but faster. if (Y1bin shl 1 = 0) and (Y2bin shl 1 = 0) then Exit; ... end; 1 Share this post Link to post
Rollo62 577 Posted May 19 (edited) Perhaps a little rework into a record will remove the whole question of the absolute directive completely. So that you get the point of the additional benefits I see from such structure, to have much more related informations included and easy extendable. This way you can use the right types for specific fields, not all as strings. unit PeriodicTable; interface uses System.SysUtils, System.Math; { TElementRecord encapsulates properties of a chemical element } type TElementRecord = record AtomicNumber : Integer; // Ordnungszahl Symbol : string; // Elementsymbol Name : string; // Elementname AtomicMass : Double; // Atommasse in u HasStableIsotopes : Boolean; // True, wenn stabile Isotope existieren Group : Integer; // Gruppennummer (0=unknown) Period : Integer; // Periode (0=unknown) Electronegativity : Double; // (0=unknown) IonizationEnergy : Double; // erste Ionisierungsenergie in eV (0=unknown) AtomicRadius : Double; // Kovalenter Radius in pm (0=unknown) ElectronConfig : string; // Elektronenkonfiguration (' '=unknown) Density : Double; // Dichte in g/cm³ (0=unknown) MeltingPoint : Double; // Schmelzpunkt in K (0=unknown) BoilingPoint : Double; // Siedepunkt in K (0=unknown) OxidationStates : string; // (''=unknown) Abundance : Double; // Natürliche Häufigkeit in ‰ (0=unknown) end; { Enumeration of all 118 elements } TElement = ( elH, elHe, elLi, elBe, elB, elC, elN, elO, elF, elNe, elNa, elMg, elAl, elSi, elP, elS, elCl, elAr, elK, elCa, elSc, elTi, elV, elCr, elMn, elFe, elCo, elNi, elCu, elZn, elGa, elGe, elAs, elSe, elBr, elKr, elRb, elSr, elY, elZr, elNb, elMo, elTc, elRu, elRh, elPd, elAg, elCd, elIn, elSn, elSb, elTe, elI, elXe, elCs, elBa, elLa, elCe, elPr, elNd, elPm, elSm, elEu, elGd, elTb, elDy, elHo, elEr, elTm, elYb, elLu, elHf, elTa, elW, elRe, elOs, elIr, elPt, elAu, elHg, elTl, elPb, elBi, elPo, elAt, elRn, elFr, elRa, elAc, elTh, elPa, elU, elNp, elPu, elAm, elCm, elBk, elCf, elEs, elFm, elMd, elNo, elLr, elRf, elDb, elSg, elBh, elHs, elMt, elDs, elRg, elCn, elNh, elFl, elMc, elLv, elTs, elOg ); { Helper with utilities } TElementHelper = record helper for TElement function ToRecord: TElementRecord; function Symbol: string; function Name: string; // Including HasStableIsotopes bracket convention function MassString: string; function MassValue: Double; class function Count: Integer; static; class function FromSymbol(const ASym: string): TElement; static; class function FromMass(const AMass, ATolerance: Double = 1e-6): TArray<TElement>; static; end; const Elements: array[TElement] of TElementRecord = ( (AtomicNumber:1; Symbol:'H'; Name:'Hydrogen'; AtomicMass:1.00794; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:2; Symbol:'He'; Name:'Helium'; AtomicMass:4.002602; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:3; Symbol:'Li'; Name:'Lithium'; AtomicMass:6.941; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:4; Symbol:'Be'; Name:'Beryllium'; AtomicMass:9.012182; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:5; Symbol:'B'; Name:'Boron'; AtomicMass:10.811; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:6; Symbol:'C'; Name:'Carbon'; AtomicMass:12.0107; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:7; Symbol:'N'; Name:'Nitrogen'; AtomicMass:14.0067; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:8; Symbol:'O'; Name:'Oxygen'; AtomicMass:15.9994; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:9; Symbol:'F'; Name:'Fluorine'; AtomicMass:18.9984032; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:10; Symbol:'Ne'; Name:'Neon'; AtomicMass:20.1797; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:11; Symbol:'Na'; Name:'Sodium'; AtomicMass:22.98976928; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:12; Symbol:'Mg'; Name:'Magnesium'; AtomicMass:24.305; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:13; Symbol:'Al'; Name:'Aluminium'; AtomicMass:26.9815386; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:14; Symbol:'Si'; Name:'Silicon'; AtomicMass:28.0855; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:15; Symbol:'P'; Name:'Phosphorus'; AtomicMass:30.973762; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:16; Symbol:'S'; Name:'Sulfur'; AtomicMass:32.065; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:17; Symbol:'Cl'; Name:'Chlorine'; AtomicMass:35.453; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:18; Symbol:'Ar'; Name:'Argon'; AtomicMass:39.948; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:19; Symbol:'K'; Name:'Potassium'; AtomicMass:39.0983; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:20; Symbol:'Ca'; Name:'Calcium'; AtomicMass:40.078; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:21; Symbol:'Sc'; Name:'Scandium'; AtomicMass:44.955912; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:22; Symbol:'Ti'; Name:'Titanium'; AtomicMass:47.867; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:23; Symbol:'V'; Name:'Vanadium'; AtomicMass:50.9415; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:24; Symbol:'Cr'; Name:'Chromium'; AtomicMass:51.9961; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:25; Symbol:'Mn'; Name:'Manganese'; AtomicMass:54.938045; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:26; Symbol:'Fe'; Name:'Iron'; AtomicMass:55.845; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:27; Symbol:'Co'; Name:'Cobalt'; AtomicMass:58.933195; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:28; Symbol:'Ni'; Name:'Nickel'; AtomicMass:58.6934; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:29; Symbol:'Cu'; Name:'Copper'; AtomicMass:63.546; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:30; Symbol:'Zn'; Name:'Zinc'; AtomicMass:65.38; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:31; Symbol:'Ga'; Name:'Gallium'; AtomicMass:69.723; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:32; Symbol:'Ge'; Name:'Germanium'; AtomicMass:72.63; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:33; Symbol:'As'; Name:'Arsenic'; AtomicMass:74.9216; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:34; Symbol:'Se'; Name:'Selenium'; AtomicMass:78.96; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:35; Symbol:'Br'; Name:'Bromine'; AtomicMass:79.904; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:36; Symbol:'Kr'; Name:'Krypton'; AtomicMass:83.798; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:37; Symbol:'Rb'; Name:'Rubidium'; AtomicMass:85.4678; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:38; Symbol:'Sr'; Name:'Strontium'; AtomicMass:87.62; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:39; Symbol:'Y'; Name:'Yttrium'; AtomicMass:88.90585; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:40; Symbol:'Zr'; Name:'Zirconium'; AtomicMass:91.224; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:41; Symbol:'Nb'; Name:'Niobium'; AtomicMass:92.90628; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:42; Symbol:'Mo'; Name:'Molybdenum'; AtomicMass:95.96; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:43; Symbol:'Tc'; Name:'Technetium'; AtomicMass:98; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:44; Symbol:'Ru'; Name:'Ruthenium'; AtomicMass:101.07; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:45; Symbol:'Rh'; Name:'Rhodium'; AtomicMass:102.9055; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:46; Symbol:'Pd'; Name:'Palladium'; AtomicMass:106.42; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:47; Symbol:'Ag'; Name:'Silver'; AtomicMass:107.8682; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:48; Symbol:'Cd'; Name:'Cadmium'; AtomicMass:112.411; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:49; Symbol:'In'; Name:'Indium'; AtomicMass:114.818; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:50; Symbol:'Sn'; Name:'Tin'; AtomicMass:118.71; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:51; Symbol:'Sb'; Name:'Antimony'; AtomicMass:121.76; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:52; Symbol:'Te'; Name:'Tellurium'; AtomicMass:127.6; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:53; Symbol:'I'; Name:'Iodine'; AtomicMass:126.90447; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:54; Symbol:'Xe'; Name:'Xenon'; AtomicMass:131.293; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:55; Symbol:'Cs'; Name:'Caesium'; AtomicMass:132.9054; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:56; Symbol:'Ba'; Name:'Barium'; AtomicMass:132.9054; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:57; Symbol:'La'; Name:'Lanthanum'; AtomicMass:138.90547; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:58; Symbol:'Ce'; Name:'Cerium'; AtomicMass:140.116; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:59; Symbol:'Pr'; Name:'Praseodymium'; AtomicMass:140.90765; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:60; Symbol:'Nd'; Name:'Neodymium'; AtomicMass:144.242; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:61; Symbol:'Pm'; Name:'Promethium'; AtomicMass:145; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:62; Symbol:'Sm'; Name:'Samarium'; AtomicMass:150.36; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:63; Symbol:'Eu'; Name:'Europium'; AtomicMass:151.964; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:64; Symbol:'Gd'; Name:'Gadolinium'; AtomicMass:157.25; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:65; Symbol:'Tb'; Name:'Terbium'; AtomicMass:158.92535; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:66; Symbol:'Dy'; Name:'Dysprosium'; AtomicMass:162.5; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:67; Symbol:'Ho'; Name:'Holmium'; AtomicMass:164.93032; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:68; Symbol:'Er'; Name:'Erbium'; AtomicMass:167.259; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:69; Symbol:'Tm'; Name:'Thulium'; AtomicMass:168.93421; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:70; Symbol:'Yb'; Name:'Ytterbium'; AtomicMass:173.054; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:71; Symbol:'Lu'; Name:'Lutetium'; AtomicMass:174.9668; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:72; Symbol:'Hf'; Name:'Hafnium'; AtomicMass:178.49; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:73; Symbol:'Ta'; Name:'Tantalum'; AtomicMass:180.94788; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:74; Symbol:'W'; Name:'Tungsten'; AtomicMass:183.84; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:75; Symbol:'Re'; Name:'Rhenium'; AtomicMass:186.207; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:76; Symbol:'Os'; Name:'Osmium'; AtomicMass:190.23; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:77; Symbol:'Ir'; Name:'Iridium'; AtomicMass:192.217; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:78; Symbol:'Pt'; Name:'Platinum'; AtomicMass:195.084; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:79; Symbol:'Au'; Name:'Gold'; AtomicMass:196.966569; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:80; Symbol:'Hg'; Name:'Mercury'; AtomicMass:200.59; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:81; Symbol:'Tl'; Name:'Thallium'; AtomicMass:204.3833; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:82; Symbol:'Pb'; Name:'Lead'; AtomicMass:207.2; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:83; Symbol:'Bi'; Name:'Bismuth'; AtomicMass:208.9804; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:84; Symbol:'Po'; Name:'Polonium'; AtomicMass:209; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:85; Symbol:'At'; Name:'Astatine'; AtomicMass:210; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:86; Symbol:'Rn'; Name:'Radon'; AtomicMass:222; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:87; Symbol:'Fr'; Name:'Francium'; AtomicMass:223; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:88; Symbol:'Ra'; Name:'Radium'; AtomicMass:226; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:89; Symbol:'Ac'; Name:'Actinium'; AtomicMass:227; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:90; Symbol:'Th'; Name:'Thorium'; AtomicMass:232.03806; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:91; Symbol:'Pa'; Name:'Protactinium'; AtomicMass:231.0588; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:92; Symbol:'U'; Name:'Uranium'; AtomicMass:238.02891; HasStableIsotopes:true; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:93; Symbol:'Np'; Name:'Neptunium'; AtomicMass:237; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:94; Symbol:'Pu'; Name:'Plutonium'; AtomicMass:244; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:95; Symbol:'Am'; Name:'Americium'; AtomicMass:243; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:96; Symbol:'Cm'; Name:'Curium'; AtomicMass:247; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:97; Symbol:'Bk'; Name:'Berkelium'; AtomicMass:247; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:98; Symbol:'Cf'; Name:'Californium'; AtomicMass:251; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:99; Symbol:'Es'; Name:'Einsteinium'; AtomicMass:252; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:100; Symbol:'Fm'; Name:'Fermium'; AtomicMass:257; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:101; Symbol:'Md'; Name:'Mendelevium'; AtomicMass:258; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:102; Symbol:'No'; Name:'Nobelium'; AtomicMass:259; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:103; Symbol:'Lr'; Name:'Lawrencium'; AtomicMass:262; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:104; Symbol:'Rf'; Name:'Rutherfordium'; AtomicMass:267; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:105; Symbol:'Db'; Name:'Dubnium'; AtomicMass:268; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:106; Symbol:'Sg'; Name:'Seaborgium'; AtomicMass:271; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:107; Symbol:'Bh'; Name:'Bohrium'; AtomicMass:272; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:108; Symbol:'Hs'; Name:'Hassium'; AtomicMass:270; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:109; Symbol:'Mt'; Name:'Meitnerium'; AtomicMass:276; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:110; Symbol:'Ds'; Name:'Darmstadtium'; AtomicMass:281; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:111; Symbol:'Rg'; Name:'Roentgenium'; AtomicMass:280; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:112; Symbol:'Cn'; Name:'Copernicium'; AtomicMass:285; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:113; Symbol:'Nh'; Name:'Nihonium'; AtomicMass:286; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:114; Symbol:'Fl'; Name:'Flerovium'; AtomicMass:289; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:115; Symbol:'Mc'; Name:'Moscovium'; AtomicMass:290; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:116; Symbol:'Lv'; Name:'Livermorium'; AtomicMass:293; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:117; Symbol:'Ts'; Name:'Tennessine'; AtomicMass:294; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), (AtomicNumber:118; Symbol:'Og'; Name:'Oganesson'; AtomicMass:294; HasStableIsotopes:false; Group:0;Period:0;Electronegativity:0;IonizationEnergy:0;AtomicRadius:0;ElectronConfig:'';Density:0;MeltingPoint:0;BoilingPoint:0;OxidationStates:'';Abundance:0), ); implementation { TElementHelper impl } function TElementHelper.ToRecord: TElementRecord; begin Result := Elements[Self]; end; function TElementHelper.Symbol: string; begin Result := Elements[Self].Symbol; end; function TElementHelper.Name: string; begin Result := Elements[Self].Name; end; // Including HasStableIsotopes bracket convention function TElementHelper.MassString: string; begin if not Elements[Self].HasStableIsotopes then Result := Format('(%s)', [ FloatToStr(Elements[Self].AtomicMass) ]); else Result := FloatToStr(Elements[Self].AtomicMass); end; function TElementHelper.MassValue: Double; begin Result := Elements[Self].AtomicMass; end; class function TElementHelper.Count: Integer; begin Result := Length(Elements); end; class function TElementHelper.FromSymbol(const ASym: string): TElement; var e: TElement; begin for e := Low(TElement) to High(TElement) do if CompareText(Elements[e].Symbol, ASym) = 0 then Exit(e); raise Exception.CreateFmt('Symbol %s not found', [ASym]); end; class function TElementHelper.FromMass(const AMass, ATolerance: Double): TArray<TElement>; var e: TElement; L: TList<TElement>; begin L := TList<TElement>.Create; try for e := Low(TElement) to High(TElement) do if Abs(Elements[e].AtomicMass - AMass) <= ATolerance then L.Add(e); Result := L.ToArray; finally L.Free; end; end; end. Edit: I forgot to add a little how-to-use example program PeriodicTableDemo; {$APPTYPE CONSOLE} uses System.SysUtils, PeriodicTable; var e : TElement; rec : TElementRecord; matches : TArray<TElement>; i : Integer; begin try // 1) Total count of elements Writeln('Total elements: ', TElementHelper.Count); // 2) Lookup for symbol „Fe“ e := TElementHelper.FromSymbol('Fe'); rec := e.ToRecord; Writeln(Format('Element %d: %s – %s, Mass = %s u', [rec.AtomicNumber, rec.Symbol, rec.Name, e.MassString])); // 3) Search for elements with mass ≈ 1.00794 matches := TElementHelper.FromMass(1.00794, 1e-4); if Length(matches) = 0 then Writeln('No matching elements found.') else begin Writeln('Matches for mass ≈ 1.00794:'); for i := 0 to High(matches) do begin e := matches[i]; rec := e.ToRecord; Writeln(Format(' %s (%s), AtomicNumber = %d', [rec.Symbol, rec.Name, rec.AtomicNumber])); end; end; // 4) Iteration over all elements Writeln('Erste 5 Elemente im Periodensystem:'); for i := 0 to Min(4, TElementHelper.Count-1) do begin e := TElement(i); rec := e.ToRecord; Writeln(Format('%2d: %s – %s, Mass = %s u', [rec.AtomicNumber, rec.Symbol, rec.Name, e.MassString])); end; except on E: Exception do Writeln('Error: ', E.ClassName, ': ', E.Message); end; end. Edited Tuesday at 11:55 AM by Rollo62 Addition 2 Share this post Link to post
Kas Ob. 138 Posted May 19 2 hours ago, Anders Melander said: // Casting between "uncastable" types without pointers procedure FooBar(const X1, Y1, X2, Y2: Single) var Y1bin: Cardinal absolute Y1; Y2bin: Cardinal absolute Y2; begin // Fast way of testing if a Single is zero; Same as "if (Y1 = 0) and (Y2 = 0) then" but faster. if (Y1bin shl 1 = 0) and (Y2bin shl 1 = 0) then Exit; ... end; Here a faster suggestion procedure FooBar(const X1, Y1, X2, Y2: Single); var Y1bin: Cardinal absolute Y1; Y2bin: Cardinal absolute Y2; begin // Check if both Y1 and Y2 are zero using a single bitwise operation if (Y1bin or Y2bin) shl 1 = 0 then Exit; ... end; Or using AND instead of bit shifting procedure FooBar(const X1, Y1, X2, Y2: Single); var Y1bin: Cardinal absolute Y1; Y2bin: Cardinal absolute Y2; begin if (Y1bin or Y2bin) and $7FFFFFFF = 0 then Exit; ... end; Share this post Link to post