function on.create() pse_db = { -- {"name","symbol",atomic number,atomic mass,nonmetal=1/metal=2/semimetal=3/edel=4,ionisation energy,EN,melting,boiling,dichtheid 20C,elctronen config,discovery name, year",crist struct(0ukwn,1cfc,2cbc,3c,4hex,5rhb,6mon,7trg,8ort),nr of natural isotopes} {"Actinium ","Ac",89,227,5,5.17,1.1,1050,3200,10.07,"[Rn] 6d1 7s2","Andre Debierne",1899,1,4,"+III"}, {"Aluminum ","Al",13,26.9815,3,5.9858,1.5,660,2467,2.7,"[Ne] 3S2 3p1","Hans Christian Oersted",1825,1,3,"+III"}, {"Americium ","Am",95,243,5,5.9738,1.3,994,2607,13.67,"[Rn] 5f7 7s2","G.T. Seaborg",1945,4,8,"+III, +IV, +V, +VI"}, {"Antimony ","Sb",51,121.76,3,8.6084,1.9,630,1750,6.684,"[Kr] 4d10 5s2 5p3","someone","ancient times",4,12,"+III, +V, -III"}, {"Argon ","Ar",18,39.948,4,15.7596,"no EN",-189,-186,1.784,"[Ne] 3s2 3p6","Sir Ramsay",1894,1,6,"0"}, {"Arsenic ","As",33,74.92,1,9.7886,2.0,81,613,5.7,"[Ar] 3d10 4s2 4p3","someone","ancient times",5,8,"+III, +V, -III"}, {"Astatine ","At",85,210,1,9.3,2.2,302,337,"unknown","[Xe] 4f14 5d10 6s2 6p5","someone","ancient times","unknown",7,"unknown"}, {"Barium ","Ba",56,137.327,8,5.2117,0.9,725,1640,3.5,"[Xe] 6s2","Sir Humprey Davy",1808,2,16,"+II"}, {"Berkelium ","Bk",97,247,5,6.1979,1.3,986,"unknown","unknown","[Rn] 5f9 6d0 7s2","G.T. Seaborg",1949,"unknown",8,"+III, +IV"}, {"Beryllium ","Be",4,9.0122,8,9.3227,1.5,1278,2970,1.86,"[He] 2s2","Abbe Rene-Justt Hauy",1798,4,1,"+III"}, {"Bismuth ","Bi",83,208.9804,3,7.2856,1.9,271,1560,9.80,"[Xe] 4f14 5d10 6s2 6p3","unknown","ancient times",6,14,"+III, +V"}, {"Bohrium ","Bh",107,264,2,"unknown","unknown","unknown","unknown","unknown","[Rn] 5f14 6d5 7s2","Peter Armbuster and Gottfried Munzenber",1976,"unknown",3,"unknown"}, {"Boron ","B",5,10.811,1,8.298,2.0,2300,2550,2.3,"[He] 2s2 2p1","Sir Humphry Davy and J.L Gay-Lussac",1808,5,2,"+III"}, {"Bromine","Br",35,79.904,1,11.8138,2.8,-7,58.8,3.1,"[Ar] 3d10 4s2 4p5","Anthoine Balard",1826,3,10,"+I, +V, -I"}, {"Cadmium ","Cd",48,112.411,2,8.9938,1.7,321,765,8.7,"[Kr] 4d10 5s2","Fredrich Stromeyer",1817,4,15,"+II"}, {"Calcium ","Ca",20,40.078,8,6.1132,1.0,839,1484,1.6,"[Ar] 4s2","Sir Humphrey Davy",1808,1,10,"+II"}, {"Californium ","Cf",98,251,5,6.2817,"unknown",900,"unknown","unknown","[Rn] 5f9 6d1 7s2","G.T. Seaborg",1950,"unknown",10,"+III"}, {"Carbon ","C",6,12.0107,1,11.2603,2.5,3500,4827,2.2,"[He] 2s2 2p2","unknown","ancient times",4,3,"+II, +IV, -IV"}, {"Cerium ","Ce",58,140.116,6,5.5387,1.1,795,3257,6.76,"[Xe] 4f1 5d1 6s2","W. von Hisinger",1903,4,9,"+III, +IV"}, {"Cesium ","Cs",55,132.9055,7,3.8939,0.7,29,678,1.9,"[Xe] 6s1","Fustov Kirchhoff",1860,2,12,"+I"}, {"Chlorine ","Cl",17,35.453,1,12.9676,3.0,-101,-35,0.00321,"[Ne] 3s2 3p5","Carl Wilhelm Scheele",1774,5,4,"+I, +V, +VII, -I"}, {"Chromium ","Cr",24,51.9961,2,6.7665,1.55,1857,2672,7.19,"[Ar] 3d5 4s1","Vaughlin",1797,2,6,"+II, +III, +VI"}, {"Cobalt ","Co",27,58.9332,2,7.881,1.91,1495,2870,8.9,"[Ar] 3d7 4s2","George Brandt",1737,4,8,"+II, +III"}, {"Copernicium ","Cn",112,277,2,"unknown","unknown","unknown","unknown","unknown","S. Hofmann, V. Ninov and F.P. Hessbuger",1996,"unknown",1,"unknown"}, {"Copper ","Cu",29,63.546,2,7.7264,1.65,1083,2567,8.9,"[Ar] 3d10 4s1","unknown","ancient times",1,6,"+I, +II"}, {"Curium ","Cm",96,247,5,5.9915,1.28,1340,"unknown",13.51,"[Rn],5f7 6d1 7s2","G.T. Seaborg",1944,"unknown",10,"+III, +IV"}, {"Darmstadtium ","Ds",110,268,2,"unknown","unknown","unknown","unknown","unknown","unknown","Albert Ghiorso",1970,"unknown",1,"unknown"}, {"Dubnium ","Db",105,262,2,"unknown","unknown","unknown","unknown","unknown","unknown","Albert Ghiorso",1970,"unknown",1,"unknown"}, {"Dysprosium ","Dy",66,162.5,6,5.9389,1.2,1412,2562,8.6,"[Xe] 4f10 6s2","Paul Emile Lecoq de Boisbaudran",1886,4,12,"+III"}, {"Einsteinium ","Es",99,252,5,6.42,1.3,860,"unknown","unknown","[Rn] 5f10 6d1 7s2","Argonne",1952,"unknown",10,"unknown"}, {"Erbium","Er",68,167.259,6,6.1077,1.22,1522,2510,9.2,"[Xe] 4f12 6s2","Carl Mosander",1843,4,9,"+III"}, {"Europium ","Eu",63,151.964,6,5.6704,1.2,822,1597,9.2,"[Xe] 4f7 6s2","Carl Mosander",1843,4,35,"+II, +III"}, {"Fermium ","Fm",100,257,5,6.5,1.3,1527,"unknown","unknown","[Rn] 5f11 6d1 7s2","Ghiorso",1952,"unknown",1,"unknown"}, {"Fluorine ","F",9,18.9984,1,17.4228,3.98,-220,-188,1.96,"[He] 2s2 2p5","Moissan",1886,3,2,"-I"}, {"Francium ","Fr",87,223,7,4.0727,0.7,27,677,"unknown","[Rn] 7s1","Marguerite Perey",1939,2,4,"+I"}, {"Gadolinium ","Gd",64,157.25,6,6.1501,1.17,1311,3233,7.9,"[Xe] 4f7 5d1 6s2","Jean de Marignac",1880,4,13,"+III"}, {"Gallium ","Ga",31,69.723,3,5.9993,2.01,30,2403,5.1,"[Ar] 3d10 4s2 4p1","unknown","unknown",7,6,"+III"}, {"Germanium ","Ge",32,72.64,3,7.8994,1.8,937,2830,5.3,"[Ar] 3d10 4s2 4p2","Clemens Winkler",1886,1,9,"+II, +IV"}, {"Gold ","Au",79,196.9665,2,9.2255,2.2,1064,2807,19.3,"[Xe] 4f14 5d10 6s1","unknown","ancient times",1,7,"+I, +III"}, {"Hafnium ","Hf",72,178.49,2,6.8251,1.3,2150,5400,13.07,"[Xe] 4f14 5d2 6s2","Dirk Coster",1923,4,10,"+IV"}, {"Hassium ","Hs",108,277,2,"unknown","unknown","unknown","unknown","unknown","unknown","unknown","unknown","unknown",1,"unknown"}, {"Helium ","He",2,4.0026,4,24.5874,"no EN",-272,-269,0.00178,"1s2","Sir Ramsey",1895,4,2,"0"}, {"Holmium ","Ho",67,164.9303,6,6.0215,0.2,1470,2720,8.8,"[Xe] 4f11 6s2","J.L. Soret",1878,4,4,"+III"}, {"Hydrogen ","H",1,1.0079,1,13.5984,2.2,-259,-253,0.0000899,"1s1","Henry Cavendish",1766,4,3,"+I, -I"}, {"Indium ","In",49,114.818,3,5.7864,1.69,157,2000,7.31,"[Kr] 4d10 5s2 5p1","Ferdinand Reich",1863,8,11,"+III"}, {"Iodine ","I",53,126.9045,1,10.4513,2.05,114,184,4.93,"[Kr] 4d10 5s2 5p5","Bernard Courtois",1811,7,15,"+I, +V, +VII, -I"}, {"Iridium ","Ir",77,192.217,2,8.967,1.9,2410,4527,22.4,"[Xe] 4f14 5d7 6s2","Smithson Tennant",1804,1,11,"+III, +IV"}, {"Iron ","Fe",26,55.845,2,7.9024,1.88,1535,2750,7.8,"[Ar] 3d6 4s2","unknown","ancient times",2,8,"+II, +III"}, {"Krypton ","Kr",36,83.8,4,13.9996,"unknown",-157,-153,3.73,"[Ar] 3d10 4s2 4p6","Sir Ramsey",1898,1,15,"0"}, {"Lanthanum ","La",57,138.9055,6,5.5769,0.79,920,3469,6.18,"[Xe] 5d1 6s2","Carl Monsander",1839,4,7,"+III"}, {"Lawrencium","Lr",103,262,5,4.9,1.3,1627,"unknown","unknown","[Rn] 5f14 6d1 7s2","Albert Ghiosp",1961,"unknown",1,"unknown"}, {"Lead ","Pb",82,207.2,3,7.4167,2.0,327,1740,11.34,"[Xe] 4f14 5d10 6s2 6p2","unknown","ancient times",1,13,"+II, +IV"}, {"Lithium ","Li",3,6.941,7,5.3917,0.98,180,1347,0.53,"[He] 2s1","Johann Arfvedson",1817,2,2,"+I"}, {"Lutetium ","Lu",71,174.967,6,5.4259,1.25,1656,3315,9.7,"[Xe] 4f14 5d1 6s2","George Urbain",1907,4,9,"+III"}, {"Magnesium ","Mg",12,24.305,8,7.6462,1.31,639,1090,1.74,"[Ne] 3s2","Sir Humphrey Davy",1808,4,5,"+II"}, {"Manganese ","Mn",25,54.938,2,7.434,1.83,1245,1962,7.43,"[Ar] 3d5 4s2","Johann Gahn",1774,2,7,"+II, +III, +IV, +VII"}, {"Meitnerium ","Mt",109,268,2,"unknown","unknown","unknown","unknown","unknown","unknown","Heavy ion research lab",1982,"unknown",1,"unknown"}, {"Mendelevium ","Md",101,258,5,6.58,1.3,"unknown","unknown","unknown","[Rn] 5f12 6d1 7s2","G.T. Seaborg",1955,"unknown",1,"unknown"}, {"Mercury ","Hg",80,200.59,2,10.4375,2.28,-39,357,13.6,"[Xe] 4f14 5d10 6s2","unknown","ancient times",5,12,"+I, +II"}, {"Molybdenum ","Mo",42,95.94,2,7.0924,1.6,2617,4612,10.2,"[Kr] 4d5 5s1","Carl Wilhelm Scheele",1778,2,11,"+VI"}, {"Neodymium ","Nd",60,144.24,6,5.525,1.12,1010,3127,7.0,"[Xe] 4f1 6s2","Carl Auer von Welsbach",1885,4,9,"+III"}, {"Neon ","Ne",10,20.1797,4,21.5645,"no EN",-249,-246,0.9,"[He] 2s2 2p6","Sir Ramsey",1898,1,3,"0"}, {"Neptunium ","Np",93,237,5,6.2657,1.5,640,3902,20.25,"[Rn] 5f4 6d1 7s2","McMillan",1940,8,8,"+III, +IV, +V, +VI"}, {"Nickel ","Ni",28,58.6934,2,7.6398,1.9,1453,2732;8.9,"[Ar] 3d8 4s2","Alex Constedt",1751,1,10,"+II, +III"}, {"Niobium ","Nb",41,92.91,2,6.7589,1.33,2468,4927,8.4,"[Kr] 4d4 5s1","Chares Hatchett",1801,2,14,"+III, +V"}, {"Nitrogen ","N",7,14.0067,1,14.5341,3.04,-210,-196,1.2506,"[He] 2s2 2p3","Rutherford",1772,4,4,"+I, -I, +II, -II,+III, -III, +IV, V"}, {"Nobelium ","No",102,259,5,6.65,1.3,827,"unknown","unknown","[Rn] 5f13 6d1 7s2","Nobel institute for Physics",1957,"unknown",1,"unknown"}, {"Osmium ","Os",76,190.23,2,8.4382,2.36,3045,5027,22.5,"[Xe] 4f14 6s2","Smithson Tennant",1803,4,13,"+III, +IV"}, {"Oxygen ","O",8,15.9994,1,13.6181,3.44,-218,-183,1.429,"[He] 2s2 2p4","Joseph Priestly",1774,3,4,"-II"}, {"Palladium ","Pd",46,106.42,2,8.3369,2.28,1552,2927,11.9,"[Kr] 4d10","William Wollaston",1803,1,9,"+II, +IV"}, {"Phosphorus ","P",15,30.9738,1,10.4867,2.19,44,280,1.82,"[Ne] 3s2 3p3","Hennig Brandt",1669,6,23,"+III, +V, -III"}, {"Platinum ","Pt",78,195.078,2,8.9587,2.2,1772,3827,21.4,"[Xe] 4f14 5d9 6s1","Julius Scaliger",1735,1,13,"+II, +IV"}, {"Plutonium ","Pu",94,244,5,6.0262,1.38,640,3235,19.84,"[Rn] 5f6 7s2","G.T. Seaborg",1940,6,11,"+III, +IV, +V, +VI"}, {"Polonium ","Po",84,209,3,8.417,2.33,254,962,9.51,"[Xe] 4f14 5d10 6s2 6p4","Pierre and Marie Curie",1898,6,12,"+II, +IV"}, {"Potassium ","K",19,39.0983,7,4.3407,0.82,64,760,0.86,"[Ar] 4s1","Sir Davy",1808,2,5,"+I"}, {"Praseodymium ","Pr",59,140.9077,6,5.473,1.1,935,3127,6.8,"[Xe] 4f3 6s2","Von Welsbach",1885,4,5,"+III"}, {"Promethium ","Pm",61,145,6,5.582,1.13,1100,3000,6.475,"[Xe] 4f5 6s2","Marinsky",1945,4,9,"+III"}, {"Protactinium ","Pa",91,231.0359,5,5.89,1.1,1568,"unknown",15.37,"[Rn] 5f2 6d1 7s2","K. Kajans and O.H. Gohring",1913,7,5,"+IV, +V"}, {"Radium ","Ra",88,226,8,5.2784,0.9,700,1737,5,"[Rn] 7s2","Pierre and Marie Curie",1898,2,6,"+II"}, {"Radon ","Rn",86,222,4,10.7485,"no EN",-71,-62,0.00996,"[Xe] 4f14 5d10 6s2 6p6","Fredrich Ernst Dorn",1898,1,7,"0"}, {"Rhenium","Re",75,186.207,2,7.8335,1.5,3180,5627,20.5,"[Xe] 4f14 5d5 6s2","Walter Noddack",1925,4,9,"+IV, +VI, +VII"}, {"Rhodium ","Rh",45,102.9055,2,7.4589,2.2,1966,3727,12.4,"[Kr] 4d8 5s1","William Wollaston",1803,1,9,"+III"}, {"Roentgenium ","Ro",111,272,2,"unknown","unknown","unknown","unknown","unknown","unknown","unknown","unknown",1}, {"Rubidium ","Rb",37,85.4678,7,4.1771,0.8,39,688,1.53,"[Kr] 5s1","Robert Wilhem Bunsen and Gustav Robert Kirchhoff",11861,2,11,"+I"}, {"Ruthenium ","Ru",44,101.07,2,7.3605,1.9,"unknown",3900,12.2,"[Kr] 4d7 5s1","Karl Klaus",1844,4,11,"+III"}, {"Rutherfordium ","Rf",104,261,2,"unknown",1.3,"unknown","unknown","unknown","[Rn] 5f14 6d2 7s2","Lord Rutherford of Nelson","unknown","unknown",9,"unknown"}, {"Samarium ","Sm",62,150.36,6,5.6437,1.14,1072,1900,6.9,"[Xe] 4f6 6s2","Paul Emile Lecoq de Boisbaudran",1879,4,11,"+II, +III"}, {"Scandium ","Sc",21,44.9559,6,6.5615,1.54,1539,2832,3.0,"[Ar] 3d1 4s2","Lars Nilson",1879,4,7,"+III"}, {"Seaborgium ","Sg",106,266,2,"unknown","unknown","unknown","unknown","unknown","[Rn] 7s2 5f14 6d4","Albert Ghiorso",1974,"unknown",1,"unknown"}, {"Selenium ","Se",34,78.96,1,9.7524,2.55,217,685,4.79,"[Ar] 3d10 4s2 4p4","Jons Berzelius",1817,4,9,"+IV, +VI, -II"}, {"Silicon ","Si",14,28.0855,1,8.1517,1.9,1410,2355,2.33,"[Ne] 3s2 3p2","Jons Berzelius",1823,1,5,"+II, +IV, -IV"}, {"Silver ","Ag",47,107.8682,2,7.5762,2.2,962,2212,10.5,"[Kr] 4d10 5s1","unknown","ancient times",1,11,"+I"}, {"Sodium","Na",11,22.9897,7,5.1391,0.93,98,883,0.97,"[Ne] 3s1","Sir Humphrey Davy",1807,2,3,"+I"}, {"Strontium ","Sr",38,87.62,8,5.6949,0.82,769,1384,2.6,"[Kr] 5s2","A. Crawford",1790,1,14,"+II"}, {"Sulfur ","S",16,32.065,1,10.36,2.58,113,445,2.07,"[Ne] 3s2 3p4","unknown","ancient times",5,5,"+IV, +VI, -II"}, {"Tantalum ","Ta",73,180.9479,2,7.5496,1.27,2996,5425,16.69,"[Xe] 4f14 5d3 6s2","Anders Ekeberg", 1802,2,4,"+V"}, {"Technetium ","Tc",43,98,2,7.28,1.9 ,2200,4877, 11.5,"[Kr] 4d6 5s1","Carlo Perrier",1937,4,9,"+IV, +VI, +VII"}, {"Tellurium ","Te",52,127.6,1,9.0096,2.1,449,990,6.24,"[Kr] 4d10 5s2 5p4","Franz Muller von Reichenstein",1782,4,23,"+IV, +VI, -II"}, {"Terbium ","Tb",65,158.9253,6,5.8638,1.2,1360,3041,8.3,"[Xe] 4f9 6s2","Carl Mosander",1843,4,9,"+III, +IV"}, {"Thallium ","Tl",81,204.3833,3,3.1082,2.54,303,1457,11.71,"[Xe] 4f14 5d10 6s2 6p1","Sir William Crookes",1861,7,11,"+I, +III"}, {"Thorium ","Th",90,232.0381,5,6.3067,0.89,1750,4790,11.72,"[rn] 6d2 7s2","Jons Berzelius",18228,1,9,"+IV"}, {"Thulium ","Tm",69,168.9342,6,6.1843,1.23,1545,1727,9.3,"[Xe] 4f13 6s2","Theodore Cleve",1879,4,5,"+III"}, {"Tin ","Sn",50,118.71,3,7.3439,1.78,232,2270,7.28,"[Kr] 4d10 5s2 5p2","unknown","ancient times",8,20,"+II, +IV"}, {"Titanium ","Ti",22,47.867,2,6.8281,1.63,1660,3287,4.51,"[Ar] 3d1 4s2","William Gregor",1791,4,8,"+II, +III, +IV"}, {"Tungsten ","W",74,183.84,2,7.864,1.3,3410,5660,19.3,"[Xe] 4f14 5d4 6s2","Fausto and Juan Jose de Elhuyar ",1783,2,10,"+III"}, {"Ununbium","Uub",112,277,2,"unknown","unknown","unknown","unknown","unknown","unknown","S. Hofmann, V. Ninov and F.P. Hessbuger",1996,"unknown",1,"unknown"}, {"Ununhexium","Uuh",116,263,3,"unknown","unknown","unknown","unknown","unknown","unknown","The Lawrence Berkeley National Laboratory","unknown","unknown",1,"unknown"}, {"Ununnilium ","Uun",110,268,2,"unknown","unknown","unknown","unknown","unknown","unknown","Albert Ghiorso",1970,"unknown",1,"unknown"}, --[[Darmstadtium]] {"Ununoctium","Uuo",118,293,4,"unknown","unknown","unknown","unknown","unknown","unknown","Berkeley Lab scientists",1999,"unknown",1,"unknown"}, {"Ununpentium","Uup",115,262,3,"unknown","unknown","unknown","unknown","unknown","unknown","JINR Dubna and LLNL california",2003,"unknown","unknown","+IV"}, {"Ununquadium","Uuq",114,261,3,"unknown","unknown","unknown","unknown","unknown","unknown","JINR Dubna",1999,"unknown","unknown","unknown"}, {"Ununseptium","Uus",117,"unknown",3,"unknown","unknown","unknown","unknown","unknown","unknown","unknown","undiscovered","unknown","unknown","unknown"}, {"Ununtrium","Uut",113,286,3,"unknown","unknown","unknown","unknown","unknown","unknown","JINR Dubna and LLNL california",2003,"unknown","unknown","unknown"}, {"Unununium","Uuu",111,272,2,"unknown","unknown","unknown","unknown","unknown","unknown","unknown","unknown","unknown","unknown","unknown"}, {"Uranium ","U",92,238.0289,5,6.1941,1.3,1132,3818,18.95,"[Rn] 5f3 6d1 7s2","Martin Klaproth",1789,3,11,"+III, +IV, +V, +VI"}, {"Vanadium ","V",23,50.9415,2,6.7462,1.66,1890,3380,6.1,"[Ar] 3d3 4s2","Nils Sefstrom",1830,2,5,"+II, +III, +IV, +V"}, {"Xenon ","Xe",54,131.293,4,12.1298,"no EN",-112,-108,0.0059,"[Kr] 4d10 5s2 5p6","Sir Ramsey",1898,1,21,"0"}, {"Ytterbium ","Yb",70,173.04,6,6.2542,1.24,824,1466,7.0,"[Xe] 4f14 6s2","Jean de Marignac",1878,1,9,"+II, +III"}, {"Yttrium ","Y",39,88.906,6,6.2173,0.95,1523,3337,4.47,"[Kr] 4d1 5s2","Johann Gadolin",1794,4,10,"+III"}, {"Zinc ","Zn",30,65.39,2,9.3942,1.81,420,907,7.11,"[Ar] 3d10 4s2","Andreas Marggraf",1746,4,10,"+II"}, {"Zirconium","Zr",40,91.22,2,6.6339,1.22,1852,4377,6.49,"[Kr] 4d2 5s2","Martin Klaproth",1789,4,11,"+IV"} } pse_order = { {44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42}, {53,10,0,0,0,0,0,0,0,0,0,0,13,18,66,69,34,62}, {93,55,0,0,0,0,0,0,0,0,0,0,2,91,71,95,21,5}, {75,16,88,104,116,22,56,48,23,64,25,120,37,38,6,90,14,49}, {84,94,119,121,65,60,97,85,82,70,92,15,45,103,4,98,46,117}, {20,8,54,40,96,105,81,68,47,72,39,59,100,52,11,74,7,80}, {35,79,51,86,28,89,12,41,57,108,114,106,113,111,110,107,112,109}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,50,19,76,61,77,87,32,36,99,29,43,31,102,118}, {0,0,0,0,1,101,78,115,63,73,3,26,9,17,30,33,58,67} } pse_link = {} layout = "pse" elsel = 0 border = false if platform.isColorDisplay() then color = {{255,165,63},{193,186,216},{255,204,204},{221,224,52},{147,200,235},{139,205,173},{255,210,112},{255,154,133}} -- nonmetal=1/metal=2/semimetal=3/edel=4/actinide=5/lanthanide=6/alkali metals=7/alkaline earth metals=8 else color = {{170,170,170},{255,255,255},{255,255,255},{130,130,130},{255,255,255},{255,255,255},{255,255,255},{255,255,255}} end types = {"nonmetal","transition metal","other metal","noble gas","actinide","lanthanide","alkali metal","alkaline earth metal"} pse_groups = {{"Ia",0.35,1.3},{"IIa",1.3,2.3},{"IIIb",3.3,3.2},{"IVb",3.3,4.2},{"Vb",3.3,5.3},{"VIb",3.3,6.1},{"VIIb",3.3,7},{"VIIIb",3.3,9},{"Ib",3.3,11.3},{"IIb",3.3,12.3},{"IIIa",1.3,13.1},{"IVa",1.3,14.1},{"Va",1.3,15.2},{"VIa",1.3,16.1},{"VIIa",1.3,17},{"0",0.35,18.5}} structures = {"Cubic, body centered","cubic, face centered","cubic","hexagonal","rhombohedral","monoclinic","tetragonal","orthorhombic"} cubeVertices={} cubeFaces={} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) --Lua Tiny3D - By Loic Pujet interval = 0.05 --timer.start(interval) nrofcubes = 1 cubedata = {{0,0,0,0,0,0}} setcube = true rowsel = 0 colsel = 0 end --------------- -----PAINT----- --------------- function on.paint(gc) if layout=="pse" then --gc:drawString(elsel,0,0,"top") gc:setColorRGB(0,0,0) gc:setFont("sansserif","r","6") for i=1,7 do gc:drawString(i,1,i*20-8,"top") end for i=1,16 do gc:drawString(pse_groups[i][1],pse_groups[i][3]*17-9,pse_groups[i][2]*20-10,"top") end for i=1,#pse_order do for j=1,#pse_order[i] do if pse_order[i][j]~=0 then gc:setColorRGB(unpack(color[pse_db[pse_order[i][j]][5]])) gc:fillRect(j*17-8,i*20-10,16,19) gc:setColorRGB(0,0,0) gc:drawString(pse_db[pse_order[i][j]][2],j*17-8,i*20-4,"top") gc:drawString(pse_db[pse_order[i][j]][3],j*17-7,i*20-12,"top") if #pse_link ~= #pse_db then table.insert(pse_link,#pse_link,{j*17-9,i*20-10,17,19,pse_order[i][j],i,j}) end end end end for i=1,8,2 do gc:setColorRGB(unpack(color[i])) gc:drawString(types[i],8+(i-1)*35,147,"top") end for i=2,9,2 do gc:setColorRGB(unpack(color[i])) gc:drawString(types[i],8+(i-1)*35-35,156,"top") end gc:setColorRGB(0,0,0) gc:drawString("6",4*17+1,9*20-8,"top") gc:drawString("7",4*17+1,10*20-8,"top") gc:drawPolyLine({8,10, 25,10, 25,29, 42,29, 42,69, 212,69, 212,29, 297,29, 297,10, 314,10, 314,149, 8,149, 8,10}) gc:drawPolyLine({76,170, 314,170, 314,209, 76,209, 76,170}) gc:setFont("sansserif","r","6") gc:drawString("The",83,20,"bottom") gc:setFont("sansserif","b","9") gc:drawString("Periodic",72,30,"bottom") gc:setFont("sansserif","b","11") gc:drawString("Table",122,32,"bottom") gc:setFont("sansserif","r","6") gc:drawString("of",92,42,"bottom") gc:setFont("sansserif","b","9") gc:drawString("Elements",105,45,"bottom") gc:setFont("sansserif","r","6") gc:drawString("Nick Steen",1,200,"top") -- End drawing fct pse elseif layout=="specs" then -- {1 "name",2 "symbol",3 atomic number,4 atomic mass,5 nonmetal=1/metal=2/semimetal=3/edel=4,6 ionisation energy,7 EN,8 melting,9 boiling,10 dichtheid 20C, -- 11 elctronen config,12 discovery name,13 year,14 crist struct(0ukwn,1cfc,2cbc,3c,4hex,5rhb,6mon,7trg,8ort),15 nr of natural isotopes} if pse_db[elsel][3]>=83 then gc:setFont("sansserif","b","10") w = gc:getStringWidth("Name: "..pse_db[elsel][1].." ( "..pse_db[elsel][2].." )") gc:drawImage(radioactive,w+10,5) end gc:setColorRGB(190,190,190) gc:fillPolygon({259,5, 262,5, 262,8, 265,8, 265,14, 295,14, 295,8, 310,8, 310,5, 313,5, 313,26, 259,26}) gc:fillPolygon({271,29, 313,29, 313,35, 271,35}) gc:setColorRGB(0,0,0) gc:fillPolygon({colsel*3+256,rowsel*3+2, colsel*3+256+3,rowsel*3+2, colsel*3+259,rowsel*3+5, colsel*3+256,rowsel*3+5}) gc:setFont("sansserif","b","10") gc:drawString("Name: "..pse_db[elsel][1].." ( "..pse_db[elsel][2].." )",1,0,"top") gc:setFont("sansserif","r","8") gc:drawString("Atomic Number: "..pse_db[elsel][3],1,15,"top") gc:drawString("Relative atomic weight (12C): "..pse_db[elsel][4],1,25,"top") gc:drawString("Type: "..types[pse_db[elsel][5]],1,35,"top") gc:drawString("Ionisation energy: "..pse_db[elsel][6],1,45,"top") gc:drawString("Electronegativity (Pauling): "..pse_db[elsel][7],1,55,"top") if pse_db[elsel][8]~="unknown" then gc:drawString("Melting point: "..(pse_db[elsel][8]+273.15).." K ="..(pse_db[elsel][8]).." C ="..(pse_db[elsel][8]*1.8+32).." F",1,65,"top") else gc:drawString("Melting point: "..pse_db[elsel][8],1,65,"top") end if pse_db[elsel][9]~="unknown" then gc:drawString("Boiling point: "..(pse_db[elsel][9]+273.15).." K ="..(pse_db[elsel][9]).." C ="..(pse_db[elsel][9]*1.8+32).." F",1,75,"top") else gc:drawString("Boiling point: "..pse_db[elsel][9],1,75,"top") end gc:drawString("Density at 20 C: "..pse_db[elsel][10].." g*cm^-3",1,85,"top") gc:drawString("Electron configuration: "..pse_db[elsel][11],1,95,"top") gc:drawString("Discovered by "..pse_db[elsel][12].." in "..pse_db[elsel][13],1,105,"top") gc:drawString("Nr of natural isotopes: "..pse_db[elsel][15],1,115,"top") gc:drawString("Oxidation states: "..pse_db[elsel][16],1,125,"top") if pse_db[elsel][14]~="unknown" and pse_db[elsel][14]>0 then gc:drawString("Crystal structure: "..structures[pse_db[elsel][14]],1,135,"top") else gc:drawString("Crystal structure: "..pse_db[elsel][14],1,135,"top") end gc:drawString("Group: "..colsel,259,32,"top") gc:drawString("Period: "..rowsel,259,42,"top") if pse_db[elsel][14]==2 then if setcube then cubeVertices={{-1,-1,-1},{1,-1,-1},{-1,1,-1},{-1,-1,1},{1,1,-1},{-1,1,1},{1,-1,1},{1,1,1},{0,0,-1},{0,0,1},{0,-1,0},{0,1,0},{1,0,0},{-1,0,0}} cubeFaces={{1,2,5,3},{1,4,6,3},{1,4,7,2},{8,7,4,6},{8,5,3,6},{8,5,2,7}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) elseif pse_db[elsel][14]==1 then if setcube then cubeVertices={{-1,-1,-1},{1,-1,-1},{-1,1,-1},{-1,-1,1},{1,1,-1},{-1,1,1},{1,-1,1},{1,1,1},{0,0,0}} cubeFaces={{1,2,5,3},{1,4,6,3},{1,4,7,2},{8,7,4,6},{8,5,3,6},{8,5,2,7}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) elseif pse_db[elsel][14]==3 then if setcube then cubeVertices={{-1,-1,-1},{1,-1,-1},{-1,1,-1},{-1,-1,1},{1,1,-1},{-1,1,1},{1,-1,1},{1,1,1}} cubeFaces={{1,2,5,3},{1,4,6,3},{1,4,7,2},{8,7,4,6},{8,5,3,6},{8,5,2,7}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) elseif pse_db[elsel][14]==5 then if setcube then cubeVertices={{-0.1,-1,1},{-0.1,1,1},{1.9,1,1},{1.9,-1,1},{-1,-1,-1},{-1,1,-1},{1,1,-1},{1,-1,-1}} cubeFaces={{1,2,3,4},{5,6,7,8},{1,2,6,5},{3,4,8,7}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) elseif pse_db[elsel][14]==4 then if setcube then cubeVertices={{0,-1,1},{-0.6,-0.6,1},{-0.6,0.6,1},{0,1,1},{0.6,0.6,1},{0.6,-0.6,1},{0,-1,-1},{-0.6,-0.6,-1},{-0.6,0.6,-1},{0,1,-1},{0.6,0.6,-1},{0.6,-0.6,-1}} cubeFaces={{1,2,3,4,5,6},{7,8,9,10,11,12},{1,2,8,7},{3,4,10,9},{5,6,12,11}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) elseif pse_db[elsel][14]==6 then if setcube then cubeVertices={{-0.3,-1,1},{-0.3,1,1},{1.1,1,1},{1.1,-1,1},{-0.5,-1,-1},{-0.5,1,-1},{0.7,1,-1},{0.7,-1,-1}} cubeFaces={{1,2,3,4},{5,6,7,8},{1,2,6,5},{3,4,8,7}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) elseif pse_db[elsel][14]==7 then if setcube then cubeVertices={{-1,-1,0},{-1,1,0},{1,1,0},{1,-1,0},{0,0,1.5},{0,0,-1.5}} cubeFaces={{1,2,3,4},{1,2,5},{1,2,6},{3,4,5},{3,4,6}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) elseif pse_db[elsel][14]==8 then if setcube then cubeVertices={{-1,-0.5,-1},{1,-0.5,-1},{-1,0.5,-1},{-1,-0.5,1},{1,0.5,-1},{-1,0.5,1},{1,-0.5,1},{1,0.5,1}} cubeFaces={{1,2,5,3},{1,4,6,3},{1,4,7,2},{8,7,4,6},{8,5,3,6},{8,5,2,7}} translate(cubeVertices,0,0,-3) scale(cubeVertices,0.8,0.8,0.8) setcube = false end render(gc,cubeVertices,cubeFaces,2,{200,0,0},8) end gc:drawString("Nick Steen",1,200,"top") -- End drawing fct specs end end --------------- -----TIMER----- --------------- function on.timer() rotate(cubeVertices,math.pi/80,0,0,1) platform.window:invalidate(100,130,120,90) end ----------------------- -----MOUSE ACTIONS----- ----------------------- function on.mouseMove(x,y) if layout=="pse" then elsel = 0 cursor.set("pointer") if #pse_link>0 and #pse_order>0 then for i=1,#pse_link do if x>pse_link[i][1] and y>pse_link[i][2] and x<(pse_link[i][3]+pse_link[i][1]) and y<(pse_link[i][4]+pse_link[i][2]) then cursor.set("hand pointer") elsel = pse_link[i][5] rowsel = pse_link[i][6] colsel = pse_link[i][7] end end end end end function on.mouseDown(x,y) if elsel~=0 then layout = "specs" cursor.set("pointer") timer.start(interval) if layout~="specs" then setcube = true end end platform.window:invalidate() end -------------------- -----KEYPRESSES----- -------------------- function on.escapeKey() if layout=="specs" then layout="pse" timer.stop() setcube = true end cursor.show("pointer") platform.window:invalidate() end ---------------- -----IMAGES----- ---------------- radioactive = image.new("\011\0\0\0\011\0\0\0\0\0\0\0\022\0\0\0\016\0\001\0\0\0\0\0\0\0\192\255\192\255\192\255\192\255\192\255\0\0\0\0\0\0\0\0\0\0\192\255\192\255\192\255\192\255\192\255\192\255\192\255\0\0\0\0\0\0\192\255\0\128\0\128\192\255\192\255\192\255\0\128\0\128\192\255\0\0\192\255\0\128\0\128\0\128\192\255\192\255\192\255\0\128\0\128\0\128\192\255\192\255\0\128\0\128\0\128\224\255\0\128\167\247\0\128\0\128\0\128\192\255\192\255\192\251\192\251\192\251\001\128\0\128\0\128\192\251\192\251\192\251\192\255\192\255\192\255\192\255\192\255\192\255\0\128\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\0\128\0\128\0\128\192\255\192\255\192\255\192\255\0\0\192\255\192\255\192\255\0\128\0\128\0\128\192\255\192\255\192\255\0\0\0\0\0\0\192\255\0\128\0\128\0\128\0\128\0\128\192\255\0\0\0\0\0\0\0\0\0\0\192\255\192\255\192\255\192\255\192\255\0\0\0\0\0\0") ------------------------------- -----TINY 3D BY LOIC PUJET----- ------------------------------- function multiplyMatrix(matrix,vector) local x=matrix[1][1]*vector[1]+matrix[1][2]*vector[2]+matrix[1][3]*vector[3] local y=matrix[2][1]*vector[1]+matrix[2][2]*vector[2]+matrix[2][3]*vector[3] local z=matrix[3][1]*vector[1]+matrix[3][2]*vector[2]+matrix[3][3]*vector[3] return x,y,z end function rotate(vertices,angle,x,y,z) local sum=x+y+z x,y,z=x/sum,y/sum,z/sum local c,s=math.cos(angle),math.sin(angle) local matrix={{x*x+(1-x*x)*c,x*y*(1-c)-z*s,x*z*(1-c)+y*s},{x*y*(1-c)+z*s,y*y+(1-y*y)*c,y*z*(1-c)-x*s},{x*z*(1-c)-y*s,y*z*(1-c)+x*s,z*z+(1-z*z)*c}} for i,e in pairs(vertices) do vertices[i]={multiplyMatrix(matrix,e)} end end function translate(vertices,x,y,z) for i,e in pairs(vertices) do vertices[i]={e[1]+x,e[2]+y,e[3]+z} end end function scale(vertices,x,y,z) for i,e in pairs(vertices) do vertices[i]={e[1]*x,e[2]*y,e[3]*z} end end function width() return platform.window:width() end function height() return platform.window:height() end function reverseTable(tbl) local tbl2={} for i,e in ipairs(tbl) do tbl2[#tbl-i+1]=e end return tbl2 end function replaceFaces(tbl1,tbl2,faces) local faces2={} for i,e in pairs(tbl1) do for j,e2 in pairs(tbl2) do if e2 then if e==e2 then table.insert(faces2,faces[j]) tbl2[j]=nil end end end end return reverseTable(faces2) end function sortFaces(vertices,faces) local faces2,distTbl,facesTbl={},{},{} local middle={} local dist,xsum,ysum,zsum=0,0,0,0 for i,e in pairs(faces) do xsum,ysum,zsum=0,0,0,0 for j,e2 in pairs(e) do xsum,ysum,zsum=xsum+vertices[e2][1],ysum+vertices[e2][2],zsum+vertices[e2][3] end middle={xsum/#e,ysum/#e+5,zsum/#e} dist=math.sqrt(middle[1]*middle[1]+middle[2]*middle[2]+middle[3]*middle[3]) table.insert(distTbl,dist) table.insert(facesTbl,dist) end table.sort(distTbl) return replaceFaces(distTbl,facesTbl,faces) end function renderFaces(gc,vertices,faces,pos,mode,color) local polygon={} local faces2=sortFaces(vertices,faces) for i,e in pairs(faces2) do polygon={} drawPoly=true for j,f in pairs(faces2[i]) do if not pos[f] then drawPoly=false else table.insert(polygon,pos[f][1]) table.insert(polygon,pos[f][2]) end end if drawPoly then table.insert(polygon,pos[faces2[i][1]][1]) table.insert(polygon,pos[faces2[i][1]][2]) if mode==4 or mode==5 then gc:setColorRGB(color[1],color[2],color[3]) gc:fillPolygon(polygon) end if mode==2 or mode==3 or mode==4 then gc:setColorRGB(0,0,0) gc:drawPolyLine(polygon) end end end end function renderVertices(gc,pos) gc:setColorRGB(0,0,0) for i,e in pairs(pos) do if e then gc:fillRect(e[1]-1,e[2]-1,3,3) end end end function render(gc,vertices,faces,mode,color) local yDist,pos=0,{} for i,e in pairs(vertices) do if e[2]>-5 then yDist=5/(e[2]+5) table.insert(pos,{e[1]*yDist*25+width()/2,height()/2-e[3]*yDist*25}) else table.insert(pos,false) end end if mode==1 or mode==2 then renderVertices(gc,pos) end if mode==2 or mode==3 or mode==4 or mode==5 then renderFaces(gc,vertices,faces,pos,mode,color) end end