""" TLT-002 EXTENDED: Full Periodic Table Suite (All 118 Elements) =============================================================== Tests the Time Ledger Theory N-wave interference framework against the complete periodic table. METHODOLOGY ----------- For each element Z=1..118: 1. Compute Compton frequency: nu_C = m*c^2 / h 2. Compute Compton wavelength: lambda_C = c / nu_C 3. Compute scale ratio: a / lambda_C (lattice constant / Compton wavelength) 4. Generate N-wave interference patterns (N=2,3,4,6) and extract metrics 5. Determine which N (if any) matches the element's known crystal symmetry 6. Factor the coordination number into {2,3} cipher products 7. Flag anomalies IMPORTANT: This test is AGNOSTIC. We compute all N values for all elements and report what the data shows, not what we expect. Crystal structure data: IUPAC 2021 atomic weights, experimentally measured lattice parameters from Wyckoff Crystal Structures / ASM / CRC Handbook. Radioactive/synthetic elements use best available predictions (DFT where published, otherwise marked "unknown"). Continues the TLT-002 framework — same constants, same code patterns. Date: 2026-03-13 Test ID: TLT-004 (Periodic Table Full Suite) AUDIT CORRECTIONS (2026-03-13): Cross-AI audit (Gemini/Grok/Claude, Entry 9 in results log) verified: - Equations, constants, data: 10/10 across all auditors - {2,3} cipher: 10/10, code integrity: 9-10/10 - Coordination numbers, crystal structures: 10/10 N-FOLD SYMMETRY MAPPING (A4): Scored 2/10 (Gemini), 6/10 (Grok), 7/10 (Claude). The mapping of crystal structures to N-fold symmetry is a MODEL-SPECIFIC ASSUMPTION, not a derivation from first principles. The 66.3% N=3 result depends entirely on this mapping. The mapping rationale (dominant close-packed plane symmetry) is documented in crystal_to_expected_N() but is not a standard crystallographic classification. Results that depend on N are flagged in output. """ import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.colors import Normalize, ListedColormap, BoundaryNorm from matplotlib.patches import Rectangle from pathlib import Path from scipy.signal import find_peaks import time import sys # ============================================================================ # CONSTANTS (exact — same as TLT-002 for continuity) # ============================================================================ C_LIGHT = 299_792_458.0 # m/s (exact, SI definition) H_PLANCK = 6.62607015e-34 # J*s (exact, 2019 SI) AMU_KG = 1.66053906660e-27 # kg per amu (CODATA 2018) AMU_TO_HZ = AMU_KG * C_LIGHT**2 / H_PLANCK # 1 amu -> Compton frequency Hz # Output paths OUTPUT_DIR = Path("/root/rhetroiluso/project_prometheus/time_ledger_theory/" "tlt results/unaudited/periodic_table_images") OUTPUT_DIR.mkdir(parents=True, exist_ok=True) DATA_DIR = Path("/root/rhetroiluso/project_prometheus/time_ledger_theory/" "tlt results/unaudited") DATA_DIR.mkdir(parents=True, exist_ok=True) # ============================================================================ # PERIODIC TABLE DATABASE — ALL 118 ELEMENTS # ============================================================================ # Fields per element: # Z: atomic number # symbol: element symbol # name: element name # mass: standard atomic weight (amu), IUPAC 2021 # crystal: crystal structure at STP (or solid phase for gases/liquids) # a: lattice constant a (Angstroms) # c: lattice constant c (Angstroms) for HCP, tetragonal, hexagonal # coord: coordination number in native crystal structure # spacegroup: space group (Hermann-Mauguin notation) # notes: additional information # # Crystal structure codes: # FCC = face-centered cubic (cF4, Fm-3m) # BCC = body-centered cubic (cI2, Im-3m) # HCP = hexagonal close-packed (hP2, P6_3/mmc) # diamond = diamond cubic (cF8, Fd-3m) # SC = simple cubic (cP1, Pm-3m) # BCT = body-centered tetragonal (tI2/tI4) # ortho = orthorhombic (various space groups) # mono = monoclinic # rhombo = rhombohedral # hex = hexagonal (non-HCP hexagonal) # triclinic = triclinic # unknown = no measured crystal structure (synthetic/radioactive) # # Sources: Wyckoff Crystal Structures, CRC Handbook 97th ed., # ASM International, Donohue "Structures of the Elements", # IUPAC 2021 atomic weights # ============================================================================ ELEMENTS = [ # ---- Period 1 ---- {"Z": 1, "symbol": "H", "name": "Hydrogen", "mass": 1.008, "crystal": "HCP", "a": 3.77, "c": 6.16, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "Solid below 14 K. HCP structure (para-H2 molecular solid)"}, {"Z": 2, "symbol": "He", "name": "Helium", "mass": 4.0026, "crystal": "HCP", "a": 3.57, "c": 5.83, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "Solid only under ~25 atm below 4 K. HCP at low T"}, # ---- Period 2 ---- {"Z": 3, "symbol": "Li", "name": "Lithium", "mass": 6.94, "crystal": "BCC", "a": 3.51, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 4, "symbol": "Be", "name": "Beryllium", "mass": 9.0122, "crystal": "HCP", "a": 2.2866, "c": 3.5833, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 5, "symbol": "B", "name": "Boron", "mass": 10.81, "crystal": "rhombo", "a": 5.06, "c": None, "coord": 6, "spacegroup": "R-3m", "notes": "alpha-rhombohedral B12 icosahedra. alpha=58.06 deg"}, {"Z": 6, "symbol": "C", "name": "Carbon", "mass": 12.011, "crystal": "diamond", "a": 3.5668, "c": None, "coord": 4, "spacegroup": "Fd-3m", "notes": "Diamond cubic. Graphite is hex (a=2.46, c=6.71) but diamond is reference"}, {"Z": 7, "symbol": "N", "name": "Nitrogen", "mass": 14.007, "crystal": "SC", "a": 5.661, "c": None, "coord": 12, "spacegroup": "Pa-3", "notes": "Solid alpha-N2. Cubic Pa-3 with N2 molecules. Molecular solid"}, {"Z": 8, "symbol": "O", "name": "Oxygen", "mass": 15.999, "crystal": "mono", "a": 5.403, "c": None, "coord": 2, "spacegroup": "C2/m", "notes": "Solid alpha-O2, monoclinic. b=3.429, c=5.086, beta=132.53 deg"}, {"Z": 9, "symbol": "F", "name": "Fluorine", "mass": 18.998, "crystal": "mono", "a": 5.50, "c": None, "coord": 2, "spacegroup": "C2/c", "notes": "Solid F2, monoclinic. b=3.28, c=7.28, beta=90 deg. Molecular solid"}, {"Z": 10, "symbol": "Ne", "name": "Neon", "mass": 20.180, "crystal": "FCC", "a": 4.4290, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "Solid below 24.56 K"}, # ---- Period 3 ---- {"Z": 11, "symbol": "Na", "name": "Sodium", "mass": 22.990, "crystal": "BCC", "a": 4.2906, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 12, "symbol": "Mg", "name": "Magnesium", "mass": 24.305, "crystal": "HCP", "a": 3.2094, "c": 5.2108, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 13, "symbol": "Al", "name": "Aluminum", "mass": 26.982, "crystal": "FCC", "a": 4.0495, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 14, "symbol": "Si", "name": "Silicon", "mass": 28.085, "crystal": "diamond", "a": 5.4310, "c": None, "coord": 4, "spacegroup": "Fd-3m", "notes": ""}, {"Z": 15, "symbol": "P", "name": "Phosphorus", "mass": 30.974, "crystal": "ortho", "a": 3.3136, "c": None, "coord": 3, "spacegroup": "Cmca", "notes": "Black phosphorus (most stable). b=10.478, c=4.3763"}, {"Z": 16, "symbol": "S", "name": "Sulfur", "mass": 32.06, "crystal": "ortho", "a": 10.465, "c": None, "coord": 2, "spacegroup": "Fddd", "notes": "alpha-S8 orthorhombic. b=12.866, c=24.486. S8 crown molecules"}, {"Z": 17, "symbol": "Cl", "name": "Chlorine", "mass": 35.45, "crystal": "ortho", "a": 6.24, "c": None, "coord": 2, "spacegroup": "Cmca", "notes": "Solid Cl2. b=4.48, c=8.26. Molecular solid"}, {"Z": 18, "symbol": "Ar", "name": "Argon", "mass": 39.948, "crystal": "FCC", "a": 5.3111, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "Solid below 83.8 K"}, # ---- Period 4 ---- {"Z": 19, "symbol": "K", "name": "Potassium", "mass": 39.098, "crystal": "BCC", "a": 5.328, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 20, "symbol": "Ca", "name": "Calcium", "mass": 40.078, "crystal": "FCC", "a": 5.5884, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 21, "symbol": "Sc", "name": "Scandium", "mass": 44.956, "crystal": "HCP", "a": 3.3090, "c": 5.2733, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 22, "symbol": "Ti", "name": "Titanium", "mass": 47.867, "crystal": "HCP", "a": 2.9508, "c": 4.6855, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "alpha-Ti"}, {"Z": 23, "symbol": "V", "name": "Vanadium", "mass": 50.942, "crystal": "BCC", "a": 3.0240, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 24, "symbol": "Cr", "name": "Chromium", "mass": 51.996, "crystal": "BCC", "a": 2.8839, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 25, "symbol": "Mn", "name": "Manganese", "mass": 54.938, "crystal": "BCC", "a": 8.9125, "c": None, "coord": 12, "spacegroup": "I-43m", "notes": "alpha-Mn, complex BCC with 58 atoms/cell. Coord varies 12-16"}, {"Z": 26, "symbol": "Fe", "name": "Iron", "mass": 55.845, "crystal": "BCC", "a": 2.8665, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": "alpha-Fe (ferrite)"}, {"Z": 27, "symbol": "Co", "name": "Cobalt", "mass": 58.933, "crystal": "HCP", "a": 2.5071, "c": 4.0695, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "alpha-Co (below 422 C)"}, {"Z": 28, "symbol": "Ni", "name": "Nickel", "mass": 58.693, "crystal": "FCC", "a": 3.5240, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 29, "symbol": "Cu", "name": "Copper", "mass": 63.546, "crystal": "FCC", "a": 3.6149, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 30, "symbol": "Zn", "name": "Zinc", "mass": 65.38, "crystal": "HCP", "a": 2.6650, "c": 4.9468, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "Distorted HCP, c/a=1.856 (ideal 1.633)"}, {"Z": 31, "symbol": "Ga", "name": "Gallium", "mass": 69.723, "crystal": "ortho", "a": 4.5186, "c": None, "coord": 7, "spacegroup": "Cmca", "notes": "Gallium-I, orthorhombic. b=7.6570, c=4.5258. Unique structure"}, {"Z": 32, "symbol": "Ge", "name": "Germanium", "mass": 72.630, "crystal": "diamond", "a": 5.6575, "c": None, "coord": 4, "spacegroup": "Fd-3m", "notes": ""}, {"Z": 33, "symbol": "As", "name": "Arsenic", "mass": 74.922, "crystal": "rhombo", "a": 3.7598, "c": None, "coord": 3, "spacegroup": "R-3m", "notes": "Grey arsenic, rhombohedral A7. alpha=54.13 deg. c_hex=10.548"}, {"Z": 34, "symbol": "Se", "name": "Selenium", "mass": 78.971, "crystal": "hex", "a": 4.3662, "c": 4.9536, "coord": 2, "spacegroup": "P3_121", "notes": "Trigonal (grey selenium). Helical chains"}, {"Z": 35, "symbol": "Br", "name": "Bromine", "mass": 79.904, "crystal": "ortho", "a": 6.67, "c": None, "coord": 2, "spacegroup": "Cmca", "notes": "Solid Br2 below -7.2 C. b=4.49, c=8.72. Molecular solid"}, {"Z": 36, "symbol": "Kr", "name": "Krypton", "mass": 83.798, "crystal": "FCC", "a": 5.721, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "Solid below 115.8 K"}, # ---- Period 5 ---- {"Z": 37, "symbol": "Rb", "name": "Rubidium", "mass": 85.468, "crystal": "BCC", "a": 5.585, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 38, "symbol": "Sr", "name": "Strontium", "mass": 87.62, "crystal": "FCC", "a": 6.0849, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 39, "symbol": "Y", "name": "Yttrium", "mass": 88.906, "crystal": "HCP", "a": 3.6482, "c": 5.7318, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 40, "symbol": "Zr", "name": "Zirconium", "mass": 91.224, "crystal": "HCP", "a": 3.2316, "c": 5.1475, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "alpha-Zr"}, {"Z": 41, "symbol": "Nb", "name": "Niobium", "mass": 92.906, "crystal": "BCC", "a": 3.3004, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 42, "symbol": "Mo", "name": "Molybdenum", "mass": 95.95, "crystal": "BCC", "a": 3.1470, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 43, "symbol": "Tc", "name": "Technetium", "mass": 97.0, "crystal": "HCP", "a": 2.7350, "c": 4.3880, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "Radioactive, all isotopes"}, {"Z": 44, "symbol": "Ru", "name": "Ruthenium", "mass": 101.07, "crystal": "HCP", "a": 2.7059, "c": 4.2815, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 45, "symbol": "Rh", "name": "Rhodium", "mass": 102.91, "crystal": "FCC", "a": 3.8034, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 46, "symbol": "Pd", "name": "Palladium", "mass": 106.42, "crystal": "FCC", "a": 3.8907, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 47, "symbol": "Ag", "name": "Silver", "mass": 107.87, "crystal": "FCC", "a": 4.0862, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 48, "symbol": "Cd", "name": "Cadmium", "mass": 112.41, "crystal": "HCP", "a": 2.9793, "c": 5.6181, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "Distorted HCP, c/a=1.886"}, {"Z": 49, "symbol": "In", "name": "Indium", "mass": 114.82, "crystal": "BCT", "a": 3.2523, "c": 4.9461, "coord": 12, "spacegroup": "I4/mmm", "notes": "Body-centered tetragonal, distorted FCC. c/a=1.521"}, {"Z": 50, "symbol": "Sn", "name": "Tin", "mass": 118.71, "crystal": "BCT", "a": 5.8318, "c": 3.1819, "coord": 6, "spacegroup": "I4_1/amd", "notes": "beta-Sn (white tin) at STP. alpha-Sn (grey) is diamond cubic a=6.4892"}, {"Z": 51, "symbol": "Sb", "name": "Antimony", "mass": 121.76, "crystal": "rhombo", "a": 4.3084, "c": None, "coord": 3, "spacegroup": "R-3m", "notes": "A7 structure like As. alpha=57.11 deg. c_hex=11.274"}, {"Z": 52, "symbol": "Te", "name": "Tellurium", "mass": 127.60, "crystal": "hex", "a": 4.4572, "c": 5.9290, "coord": 2, "spacegroup": "P3_121", "notes": "Trigonal, isostructural with Se. Helical chains"}, {"Z": 53, "symbol": "I", "name": "Iodine", "mass": 126.90, "crystal": "ortho", "a": 7.27, "c": None, "coord": 2, "spacegroup": "Cmca", "notes": "Solid I2. b=4.79, c=9.79. Molecular solid"}, {"Z": 54, "symbol": "Xe", "name": "Xenon", "mass": 131.29, "crystal": "FCC", "a": 6.1970, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "Solid below 161.4 K"}, # ---- Period 6 ---- {"Z": 55, "symbol": "Cs", "name": "Cesium", "mass": 132.91, "crystal": "BCC", "a": 6.141, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 56, "symbol": "Ba", "name": "Barium", "mass": 137.33, "crystal": "BCC", "a": 5.028, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 57, "symbol": "La", "name": "Lanthanum", "mass": 138.91, "crystal": "HCP", "a": 3.7740, "c": 12.171, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP (double HCP, ABAC stacking)"}, {"Z": 58, "symbol": "Ce", "name": "Cerium", "mass": 140.12, "crystal": "FCC", "a": 5.1610, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "gamma-Ce at STP (FCC). Also has DHCP alpha phase"}, {"Z": 59, "symbol": "Pr", "name": "Praseodymium", "mass": 140.91, "crystal": "HCP", "a": 3.6721, "c": 11.8326, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP"}, {"Z": 60, "symbol": "Nd", "name": "Neodymium", "mass": 144.24, "crystal": "HCP", "a": 3.6582, "c": 11.7966, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP"}, {"Z": 61, "symbol": "Pm", "name": "Promethium", "mass": 145.0, "crystal": "HCP", "a": 3.65, "c": 11.65, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP. Radioactive, all isotopes. Values from thin film measurements"}, {"Z": 62, "symbol": "Sm", "name": "Samarium", "mass": 150.36, "crystal": "rhombo", "a": 3.6290, "c": None, "coord": 12, "spacegroup": "R-3m", "notes": "Rhombohedral (Sm-type, 9R stacking). c_hex=26.207"}, {"Z": 63, "symbol": "Eu", "name": "Europium", "mass": 151.96, "crystal": "BCC", "a": 4.5827, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 64, "symbol": "Gd", "name": "Gadolinium", "mass": 157.25, "crystal": "HCP", "a": 3.6336, "c": 5.7810, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 65, "symbol": "Tb", "name": "Terbium", "mass": 158.93, "crystal": "HCP", "a": 3.6055, "c": 5.6966, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 66, "symbol": "Dy", "name": "Dysprosium", "mass": 162.50, "crystal": "HCP", "a": 3.5915, "c": 5.6501, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 67, "symbol": "Ho", "name": "Holmium", "mass": 164.93, "crystal": "HCP", "a": 3.5778, "c": 5.6178, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 68, "symbol": "Er", "name": "Erbium", "mass": 167.26, "crystal": "HCP", "a": 3.5592, "c": 5.5850, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 69, "symbol": "Tm", "name": "Thulium", "mass": 168.93, "crystal": "HCP", "a": 3.5375, "c": 5.5540, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 70, "symbol": "Yb", "name": "Ytterbium", "mass": 173.05, "crystal": "FCC", "a": 5.4848, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 71, "symbol": "Lu", "name": "Lutetium", "mass": 174.97, "crystal": "HCP", "a": 3.5031, "c": 5.5509, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 72, "symbol": "Hf", "name": "Hafnium", "mass": 178.49, "crystal": "HCP", "a": 3.1946, "c": 5.0511, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "alpha-Hf"}, {"Z": 73, "symbol": "Ta", "name": "Tantalum", "mass": 180.95, "crystal": "BCC", "a": 3.3013, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 74, "symbol": "W", "name": "Tungsten", "mass": 183.84, "crystal": "BCC", "a": 3.1652, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": ""}, {"Z": 75, "symbol": "Re", "name": "Rhenium", "mass": 186.21, "crystal": "HCP", "a": 2.7609, "c": 4.4582, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 76, "symbol": "Os", "name": "Osmium", "mass": 190.23, "crystal": "HCP", "a": 2.7344, "c": 4.3198, "coord": 12, "spacegroup": "P6_3/mmc", "notes": ""}, {"Z": 77, "symbol": "Ir", "name": "Iridium", "mass": 192.22, "crystal": "FCC", "a": 3.8394, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 78, "symbol": "Pt", "name": "Platinum", "mass": 195.08, "crystal": "FCC", "a": 3.9242, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 79, "symbol": "Au", "name": "Gold", "mass": 196.97, "crystal": "FCC", "a": 4.0782, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 80, "symbol": "Hg", "name": "Mercury", "mass": 200.59, "crystal": "rhombo", "a": 3.005, "c": None, "coord": 6, "spacegroup": "R-3m", "notes": "alpha-Hg, rhombohedral below -38.83 C. alpha=70.53 deg"}, {"Z": 81, "symbol": "Tl", "name": "Thallium", "mass": 204.38, "crystal": "HCP", "a": 3.4566, "c": 5.5248, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "alpha-Tl"}, {"Z": 82, "symbol": "Pb", "name": "Lead", "mass": 207.2, "crystal": "FCC", "a": 4.9502, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": ""}, {"Z": 83, "symbol": "Bi", "name": "Bismuth", "mass": 208.98, "crystal": "rhombo", "a": 4.5461, "c": None, "coord": 3, "spacegroup": "R-3m", "notes": "A7 structure. alpha=57.23 deg. c_hex=11.862"}, {"Z": 84, "symbol": "Po", "name": "Polonium", "mass": 209.0, "crystal": "SC", "a": 3.3590, "c": None, "coord": 6, "spacegroup": "Pm-3m", "notes": "alpha-Po. Only element with simple cubic at STP. Radioactive"}, {"Z": 85, "symbol": "At", "name": "Astatine", "mass": 210.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Radioactive, extremely short-lived. No crystal structure measured. Predicted FCC"}, {"Z": 86, "symbol": "Rn", "name": "Radon", "mass": 222.0, "crystal": "FCC", "a": 6.197, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "Predicted FCC from noble gas trend. Radioactive gas. Value extrapolated"}, # ---- Period 7 ---- {"Z": 87, "symbol": "Fr", "name": "Francium", "mass": 223.0, "crystal": "BCC", "a": 5.70, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": "Predicted BCC from alkali metal trend. Most unstable naturally occurring element"}, {"Z": 88, "symbol": "Ra", "name": "Radium", "mass": 226.0, "crystal": "BCC", "a": 5.148, "c": None, "coord": 8, "spacegroup": "Im-3m", "notes": "Radioactive. BCC confirmed by X-ray"}, {"Z": 89, "symbol": "Ac", "name": "Actinium", "mass": 227.0, "crystal": "FCC", "a": 5.3110, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "Radioactive. FCC confirmed"}, {"Z": 90, "symbol": "Th", "name": "Thorium", "mass": 232.04, "crystal": "FCC", "a": 5.0842, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "alpha-Th"}, {"Z": 91, "symbol": "Pa", "name": "Protactinium", "mass": 231.04, "crystal": "BCT", "a": 3.925, "c": 3.238, "coord": 10, "spacegroup": "I4/mmm", "notes": "Body-centered tetragonal. Radioactive"}, {"Z": 92, "symbol": "U", "name": "Uranium", "mass": 238.03, "crystal": "ortho", "a": 2.8537, "c": None, "coord": 12, "spacegroup": "Cmcm", "notes": "alpha-U orthorhombic. b=5.8695, c=4.9548"}, {"Z": 93, "symbol": "Np", "name": "Neptunium", "mass": 237.0, "crystal": "ortho", "a": 6.663, "c": None, "coord": 8, "spacegroup": "Pnma", "notes": "alpha-Np orthorhombic. b=4.723, c=4.887. Radioactive"}, {"Z": 94, "symbol": "Pu", "name": "Plutonium", "mass": 244.0, "crystal": "mono", "a": 6.183, "c": None, "coord": 16, "spacegroup": "P2_1/m", "notes": "alpha-Pu monoclinic (most complex elemental structure, 16 atoms/cell). b=4.822, c=10.963, beta=101.79"}, {"Z": 95, "symbol": "Am", "name": "Americium", "mass": 243.0, "crystal": "HCP", "a": 3.4681, "c": 11.241, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP. Radioactive"}, {"Z": 96, "symbol": "Cm", "name": "Curium", "mass": 247.0, "crystal": "HCP", "a": 3.496, "c": 11.331, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP. Radioactive"}, {"Z": 97, "symbol": "Bk", "name": "Berkelium", "mass": 247.0, "crystal": "HCP", "a": 3.416, "c": 11.069, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP. Radioactive. Limited measurements"}, {"Z": 98, "symbol": "Cf", "name": "Californium", "mass": 251.0, "crystal": "HCP", "a": 3.38, "c": 11.03, "coord": 12, "spacegroup": "P6_3/mmc", "notes": "DHCP. Radioactive. Very limited data"}, {"Z": 99, "symbol": "Es", "name": "Einsteinium", "mass": 252.0, "crystal": "FCC", "a": 5.75, "c": None, "coord": 12, "spacegroup": "Fm-3m", "notes": "Radioactive. FCC from X-ray on microgram samples"}, {"Z": 100, "symbol": "Fm", "name": "Fermium", "mass": 257.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Radioactive, no bulk crystal structure measured. Predicted FCC"}, {"Z": 101, "symbol": "Md", "name": "Mendelevium", "mass": 258.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Radioactive, no crystal structure measured"}, {"Z": 102, "symbol": "No", "name": "Nobelium", "mass": 259.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Radioactive, no crystal structure measured. Predicted FCC"}, {"Z": 103, "symbol": "Lr", "name": "Lawrencium", "mass": 266.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Radioactive, no crystal structure measured. Predicted HCP"}, {"Z": 104, "symbol": "Rf", "name": "Rutherfordium","mass": 267.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~1.3 h. Predicted HCP (analog Hf)"}, {"Z": 105, "symbol": "Db", "name": "Dubnium", "mass": 268.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~28 h. Predicted BCC (analog Ta)"}, {"Z": 106, "symbol": "Sg", "name": "Seaborgium", "mass": 269.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~14 min. Predicted BCC (analog W)"}, {"Z": 107, "symbol": "Bh", "name": "Bohrium", "mass": 270.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~61 s. Predicted HCP (analog Re)"}, {"Z": 108, "symbol": "Hs", "name": "Hassium", "mass": 277.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~16 s. Predicted HCP (analog Os)"}, {"Z": 109, "symbol": "Mt", "name": "Meitnerium", "mass": 278.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~4.5 s. Predicted FCC (analog Ir)"}, {"Z": 110, "symbol": "Ds", "name": "Darmstadtium","mass": 281.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~12.7 s. Predicted BCC"}, {"Z": 111, "symbol": "Rg", "name": "Roentgenium", "mass": 282.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~100 s. Predicted FCC (analog Au)"}, {"Z": 112, "symbol": "Cn", "name": "Copernicium", "mass": 285.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~29 s. Predicted to be liquid/gas at STP (relativistic effects)"}, {"Z": 113, "symbol": "Nh", "name": "Nihonium", "mass": 286.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~9.5 s. Predicted HCP (analog Tl)"}, {"Z": 114, "symbol": "Fl", "name": "Flerovium", "mass": 289.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~1.9 s. Predicted FCC or possibly noble-gas-like"}, {"Z": 115, "symbol": "Mc", "name": "Moscovium", "mass": 290.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~0.65 s. Predicted BCC (analog Bi)"}, {"Z": 116, "symbol": "Lv", "name": "Livermorium", "mass": 293.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~60 ms. Predicted SC (analog Po)"}, {"Z": 117, "symbol": "Ts", "name": "Tennessine", "mass": 294.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~78 ms"}, {"Z": 118, "symbol": "Og", "name": "Oganesson", "mass": 294.0, "crystal": "unknown", "a": None, "c": None, "coord": None, "spacegroup": "unknown", "notes": "Synthetic, t_1/2 ~0.7 ms. Predicted solid at STP (relativistic effects). Possibly FCC"}, ] # ============================================================================ # COMPTON CALCULATIONS # ============================================================================ def compton_freq(mass_amu): """Compton frequency from atomic mass in amu: nu = m*c^2/h.""" return mass_amu * AMU_TO_HZ def compton_wavelength(mass_amu): """Compton wavelength from atomic mass in amu: lambda_C = h/(m*c) = c/nu.""" return C_LIGHT / compton_freq(mass_amu) # ============================================================================ # N-WAVE INTERFERENCE (same as TLT-002) # ============================================================================ def generate_nwave_interference(N, wavelength, grid_extent, resolution=600): """ Generate 2D interference pattern from N plane waves at equal angles. psi(x,y) = sum_{n=0}^{N-1} exp(i * k * (x*cos(theta_n) + y*sin(theta_n))) I(x,y) = |psi(x,y)|^2 where theta_n = 2*pi*n/N, k = 2*pi/lambda Parameters: N: number of plane waves wavelength: wavelength of each wave (sets scale) grid_extent: half-width of the computation domain resolution: grid points per axis (600 for metric extraction) Returns: X, Y: coordinate meshgrids intensity: |psi|^2 at each point psi: complex wave field """ x = np.linspace(-grid_extent, grid_extent, resolution) y = np.linspace(-grid_extent, grid_extent, resolution) X, Y = np.meshgrid(x, y) k = 2.0 * np.pi / wavelength psi = np.zeros_like(X, dtype=complex) for n in range(N): theta = 2.0 * np.pi * n / N kx = k * np.cos(theta) ky = k * np.sin(theta) psi += np.exp(1j * (kx * X + ky * Y)) intensity = np.abs(psi) ** 2 return X, Y, intensity, psi def extract_interference_metrics(X, Y, intensity, N, resolution): """ Extract quantitative metrics from an N-wave interference pattern. Returns dict with: - I_max, I_min, I_range - peak_spacing (avg along x-axis midline) - num_maxima (along x-axis midline) - symmetry_class (inferred from pattern) """ I_max = float(np.max(intensity)) I_min = float(np.min(intensity)) # Extract intensity along x-axis (y=0) mid_row = resolution // 2 x_slice = X[mid_row, :] i_slice = intensity[mid_row, :] # Find peaks peaks, _ = find_peaks(i_slice, height=I_max * 0.5, distance=resolution // 80) if len(peaks) >= 2: peak_positions = x_slice[peaks] spacings = np.diff(peak_positions) avg_spacing = float(np.mean(spacings)) else: avg_spacing = None return { 'I_max': I_max, 'I_min': I_min, 'I_range': I_max - I_min, 'avg_peak_spacing': avg_spacing, 'num_maxima': len(peaks), } # ============================================================================ # CRYSTAL STRUCTURE -> EXPECTED N MAPPING # ============================================================================ def crystal_to_expected_N(crystal): """ Map crystal structure type to expected best-matching N value. AUDIT NOTE: This mapping is a MODEL-SPECIFIC ASSUMPTION. Cross-AI audit scored it 2/10 (Gemini), 6/10 (Grok), 7/10 (Claude). The reduction of 3D space groups (with multiple rotational symmetries) to a single integer N lacks standard crystallographic justification. The rationale below uses the dominant close-packed plane symmetry, but this choice is not unique — FCC has both 3-fold (111) and 4-fold (100) axes, BCC has both 4-fold (100) and 3-fold (111) axes. Results depending on this mapping (e.g., "66.3% of elements are N=3") should be interpreted with this caveat. Mapping rationale (2D symmetry of dominant close-packed planes): FCC -> (111) plane is hexagonal -> N=3 or N=6 HCP -> (0001) basal plane is hexagonal -> N=3 or N=6 BCC -> (110) plane is rectangular -> N=4 (closest) diamond -> hexagonal close-packed planes with sublattice -> N=3 SC -> (100) plane is square -> N=4 BCT -> depends on c/a ratio, between square and rectangular -> N=4 rhombo -> layered, pseudo-hexagonal -> N=3 hex -> hexagonal -> N=3 or N=6 ortho -> anisotropic, may not match single N -> None mono -> anisotropic -> None triclinic -> no simple N -> None Returns: int (expected N) or None (no clear match) """ mapping = { 'FCC': 3, # (111) planes are hexagonal 'HCP': 3, # basal plane is hexagonal 'BCC': 4, # (110) plane, rectangular but closest to N=4 'diamond': 3, # hexagonal close-packed planes in diamond structure 'SC': 4, # square planes 'BCT': 4, # tetragonal -> square-like 'rhombo': 3, # layered pseudo-hexagonal 'hex': 3, # hexagonal 'ortho': None, # anisotropic 'mono': None, # anisotropic 'triclinic': None, 'unknown': None, } return mapping.get(crystal, None) # ============================================================================ # {2,3} CIPHER ANALYSIS # ============================================================================ def factorize_23(n): """ Factor n into products of 2 and 3. Returns: (pow2, pow3, remainder, classification) where n = 2^pow2 * 3^pow3 * remainder Classification: 'pure_2' : only factors of 2 (n = 2^k) 'pure_3' : only factors of 3 (n = 3^k) 'mixed_23' : contains both 2 and 3 (n = 2^a * 3^b) 'has_other' : has factors other than 2 and 3 'prime' : n is prime and > 3 'unit' : n = 1 'zero' : n = 0 'unknown' : n is None """ if n is None: return (0, 0, 0, 'unknown') if n == 0: return (0, 0, 0, 'zero') if n == 1: return (0, 0, 1, 'unit') pow2 = 0 pow3 = 0 remainder = abs(n) while remainder % 2 == 0: pow2 += 1 remainder //= 2 while remainder % 3 == 0: pow3 += 1 remainder //= 3 if remainder == 1: if pow3 == 0: return (pow2, pow3, 1, 'pure_2') elif pow2 == 0: return (pow2, pow3, 1, 'pure_3') else: return (pow2, pow3, 1, 'mixed_23') else: # Check if original is prime if is_prime(abs(n)): return (pow2, pow3, remainder, 'prime') return (pow2, pow3, remainder, 'has_other') def is_prime(n): """Simple primality test.""" if n < 2: return False if n < 4: return True if n % 2 == 0 or n % 3 == 0: return False i = 5 while i * i <= n: if n % i == 0 or n % (i + 2) == 0: return False i += 6 return True def format_23_factorization(n): """Human-readable factorization string.""" if n is None: return "N/A" if n == 0: return "0" if n == 1: return "1" pow2, pow3, remainder, classification = factorize_23(n) parts = [] if pow2 > 0: parts.append(f"2^{pow2}" if pow2 > 1 else "2") if pow3 > 0: parts.append(f"3^{pow3}" if pow3 > 1 else "3") if remainder > 1: parts.append(str(remainder)) expr = " * ".join(parts) if parts else "1" return f"{n} = {expr} [{classification}]" # ============================================================================ # PERIODIC TABLE LAYOUT (for heatmap visualization) # ============================================================================ # Standard periodic table positions: (row, col) with 0-indexed # row 0 = period 1, col 0 = group 1 PERIODIC_TABLE_POSITIONS = { # Period 1 1: (0, 0), 2: (0, 17), # Period 2 3: (1, 0), 4: (1, 1), 5: (1, 12), 6: (1, 13), 7: (1, 14), 8: (1, 15), 9: (1, 16), 10: (1, 17), # Period 3 11: (2, 0), 12: (2, 1), 13: (2, 12), 14: (2, 13), 15: (2, 14), 16: (2, 15), 17: (2, 16), 18: (2, 17), # Period 4 19: (3, 0), 20: (3, 1), 21: (3, 2), 22: (3, 3), 23: (3, 4), 24: (3, 5), 25: (3, 6), 26: (3, 7), 27: (3, 8), 28: (3, 9), 29: (3, 10), 30: (3, 11), 31: (3, 12), 32: (3, 13), 33: (3, 14), 34: (3, 15), 35: (3, 16), 36: (3, 17), # Period 5 37: (4, 0), 38: (4, 1), 39: (4, 2), 40: (4, 3), 41: (4, 4), 42: (4, 5), 43: (4, 6), 44: (4, 7), 45: (4, 8), 46: (4, 9), 47: (4, 10), 48: (4, 11), 49: (4, 12), 50: (4, 13), 51: (4, 14), 52: (4, 15), 53: (4, 16), 54: (4, 17), # Period 6 55: (5, 0), 56: (5, 1), # Lanthanides (row 8) 57: (8, 3), 58: (8, 4), 59: (8, 5), 60: (8, 6), 61: (8, 7), 62: (8, 8), 63: (8, 9), 64: (8, 10), 65: (8, 11), 66: (8, 12), 67: (8, 13), 68: (8, 14), 69: (8, 15), 70: (8, 16), 71: (8, 17), # Back to period 6 72: (5, 3), 73: (5, 4), 74: (5, 5), 75: (5, 6), 76: (5, 7), 77: (5, 8), 78: (5, 9), 79: (5, 10), 80: (5, 11), 81: (5, 12), 82: (5, 13), 83: (5, 14), 84: (5, 15), 85: (5, 16), 86: (5, 17), # Period 7 87: (6, 0), 88: (6, 1), # Actinides (row 9) 89: (9, 3), 90: (9, 4), 91: (9, 5), 92: (9, 6), 93: (9, 7), 94: (9, 8), 95: (9, 9), 96: (9, 10), 97: (9, 11), 98: (9, 12), 99: (9, 13), 100: (9, 14), 101: (9, 15), 102: (9, 16), 103: (9, 17), # Back to period 7 104: (6, 3), 105: (6, 4), 106: (6, 5), 107: (6, 6), 108: (6, 7), 109: (6, 8), 110: (6, 9), 111: (6, 10), 112: (6, 11), 113: (6, 12), 114: (6, 13), 115: (6, 14), 116: (6, 15), 117: (6, 16), 118: (6, 17), } # ============================================================================ # MAIN COMPUTATION ENGINE # ============================================================================ def compute_all_elements(): """ Master computation: for each element, compute Compton data, interference metrics, crystal-structure matching, and {2,3} cipher analysis. Returns list of result dicts. """ print("=" * 70) print("TLT-002-PT: FULL PERIODIC TABLE SUITE") print("Computing Compton data, N-wave interference, {2,3} cipher") print("for all 118 elements") print("=" * 70) # Pre-compute N-wave interference patterns (shared by all elements) print("\n Pre-computing N-wave interference patterns...") wavelength = 1.0 grid_extent = 5.0 resolution = 600 nwave_data = {} for N in [2, 3, 4, 6]: t0 = time.time() X, Y, intensity, psi = generate_nwave_interference( N, wavelength, grid_extent, resolution ) metrics = extract_interference_metrics(X, Y, intensity, N, resolution) nwave_data[N] = { 'X': X, 'Y': Y, 'intensity': intensity, 'psi': psi, 'metrics': metrics, } dt = time.time() - t0 print(f" N={N}: I_range=[{metrics['I_min']:.2f}, {metrics['I_max']:.2f}], " f"peak_spacing={metrics['avg_peak_spacing']:.4f} lambda, " f"maxima={metrics['num_maxima']} ({dt:.2f}s)") # Process each element results = [] print(f"\n Processing {len(ELEMENTS)} elements...") for elem in ELEMENTS: Z = elem['Z'] if Z % 20 == 0 or Z == 1: print(f" Z={Z:3d} ({elem['symbol']:2s}) {elem['name']}...") # Compton calculations nu_C = compton_freq(elem['mass']) lambda_C = compton_wavelength(elem['mass']) # Scale ratio (lattice constant a / Compton wavelength) if elem['a'] is not None: a_m = elem['a'] * 1e-10 # Angstroms to meters scale_ratio = a_m / lambda_C else: scale_ratio = None # Expected N from crystal structure expected_N = crystal_to_expected_N(elem['crystal']) # {2,3} cipher pow2, pow3, remainder, classification = factorize_23(elem['coord']) cipher_str = format_23_factorization(elem['coord']) result = { 'Z': Z, 'symbol': elem['symbol'], 'name': elem['name'], 'mass': elem['mass'], 'crystal': elem['crystal'], 'a': elem['a'], 'c': elem['c'], 'coord': elem['coord'], 'spacegroup': elem['spacegroup'], 'notes': elem['notes'], 'compton_freq': nu_C, 'compton_wavelength': lambda_C, 'scale_ratio': scale_ratio, 'expected_N': expected_N, 'cipher_pow2': pow2, 'cipher_pow3': pow3, 'cipher_remainder': remainder, 'cipher_class': classification, 'cipher_str': cipher_str, } results.append(result) print(f" Done. {len(results)} elements processed.") return results, nwave_data # ============================================================================ # DATA OUTPUT # ============================================================================ def write_data_file(results, nwave_data): """Write comprehensive data file.""" filepath = DATA_DIR / "periodic_table_full_data.txt" print(f"\n Writing data file: {filepath}") with open(filepath, 'w') as f: # ---- Header ---- f.write("=" * 90 + "\n") f.write("TLT-002-PT: FULL PERIODIC TABLE SUITE — COMPREHENSIVE DATA\n") f.write("=" * 90 + "\n") f.write(f"Date: 2026-03-13\n") f.write(f"Test ID: TLT-002-PT (Periodic Table extension)\n") f.write(f"Elements: {len(results)}\n\n") f.write("METHODOLOGY\n") f.write("-" * 50 + "\n") f.write("For each element:\n") f.write(" 1. Compton frequency: nu_C = m * c^2 / h\n") f.write(" 2. Compton wavelength: lambda_C = c / nu_C = h / (m * c)\n") f.write(" 3. Scale ratio: a / lambda_C (lattice constant / Compton wavelength)\n") f.write(" 4. N-wave interference: compute patterns for N=2,3,4,6\n") f.write(" 5. Crystal-to-N mapping: which N matches the element's structure\n") f.write(" 6. {2,3} cipher: factor coordination number into 2^a * 3^b\n\n") f.write("CONSTANTS\n") f.write("-" * 50 + "\n") f.write(f" c (speed of light) = {C_LIGHT:.0f} m/s (exact)\n") f.write(f" h (Planck constant) = {H_PLANCK:.8e} J*s (exact)\n") f.write(f" 1 amu = {AMU_KG:.11e} kg\n") f.write(f" 1 amu -> Compton freq = {AMU_TO_HZ:.6e} Hz\n\n") # ---- N-wave reference data ---- f.write("N-WAVE INTERFERENCE REFERENCE DATA\n") f.write("-" * 50 + "\n") f.write(" (wavelength = 1.0, grid_extent = 5.0, resolution = 600)\n\n") for N in [2, 3, 4, 6]: m = nwave_data[N]['metrics'] f.write(f" N={N}: I_max={m['I_max']:.2f}, I_min={m['I_min']:.4f}, " f"peak_spacing={m['avg_peak_spacing']:.4f} lambda, " f"maxima_on_axis={m['num_maxima']}\n") f.write("\n") # ---- Section A: Full Table ---- f.write("=" * 90 + "\n") f.write("SECTION A: FULL ELEMENT TABLE\n") f.write("=" * 90 + "\n\n") # Column headers hdr = (f"{'Z':>3s} {'Sym':>3s} {'Mass(amu)':>10s} {'Crystal':>8s} " f"{'a(A)':>7s} {'Coord':>5s} {'nu_C(Hz)':>12s} " f"{'lam_C(m)':>12s} {'a/lam_C':>12s} {'N_match':>7s} " f"{'2,3 cipher':>20s}") f.write(hdr + "\n") f.write("-" * len(hdr) + "\n") for r in results: a_str = f"{r['a']:7.4f}" if r['a'] is not None else " N/A" coord_str = f"{r['coord']:5d}" if r['coord'] is not None else " N/A" ratio_str = f"{r['scale_ratio']:.4e}" if r['scale_ratio'] is not None else " N/A" n_str = f"{r['expected_N']:7d}" if r['expected_N'] is not None else " None" cipher_short = r['cipher_str'][:20] f.write(f"{r['Z']:3d} {r['symbol']:>3s} {r['mass']:10.4f} " f"{r['crystal']:>8s} {a_str} {coord_str} " f"{r['compton_freq']:12.4e} {r['compton_wavelength']:12.4e} " f"{ratio_str} {n_str} {cipher_short}\n") f.write("\n") # ---- Section B: Summary Statistics ---- f.write("=" * 90 + "\n") f.write("SECTION B: SUMMARY STATISTICS\n") f.write("=" * 90 + "\n\n") # Crystal structure counts crystal_counts = {} for r in results: c = r['crystal'] crystal_counts[c] = crystal_counts.get(c, 0) + 1 f.write("Crystal structure distribution:\n") for c, count in sorted(crystal_counts.items(), key=lambda x: -x[1]): f.write(f" {c:>10s}: {count:3d} elements\n") # N-match counts n_counts = {} for r in results: n = r['expected_N'] key = str(n) if n is not None else 'None' n_counts[key] = n_counts.get(key, 0) + 1 f.write(f"\nExpected N-match distribution:\n") for n, count in sorted(n_counts.items()): f.write(f" N={n:>4s}: {count:3d} elements\n") # {2,3} cipher counts cipher_counts = {} for r in results: c = r['cipher_class'] cipher_counts[c] = cipher_counts.get(c, 0) + 1 f.write(f"\n{{2,3}} cipher classification:\n") for c, count in sorted(cipher_counts.items(), key=lambda x: -x[1]): f.write(f" {c:>12s}: {count:3d} elements\n") # Coordination number distribution coord_counts = {} for r in results: c = r['coord'] key = str(c) if c is not None else 'None' coord_counts[key] = coord_counts.get(key, 0) + 1 f.write(f"\nCoordination number distribution:\n") for c, count in sorted(coord_counts.items(), key=lambda x: -x[1]): f.write(f" CN={c:>4s}: {count:3d} elements\n") # {2,3} factorizable summary factorizable = [r for r in results if r['cipher_class'] in ('pure_2', 'pure_3', 'mixed_23')] non_factorizable = [r for r in results if r['cipher_class'] in ('has_other', 'prime')] unknown_coord = [r for r in results if r['cipher_class'] in ('unknown', 'zero', 'unit')] f.write(f"\n{{2,3}} factorizability summary:\n") f.write(f" Factorizable (2^a * 3^b): {len(factorizable):3d} elements\n") f.write(f" Non-factorizable: {len(non_factorizable):3d} elements\n") f.write(f" Unknown/trivial (CN=None/0/1): {len(unknown_coord):3d} elements\n") f.write(f" TOTAL: {len(results):3d} elements\n") # ---- Section C: Anomalies ---- f.write("\n" + "=" * 90 + "\n") f.write("SECTION C: ANOMALIES\n") f.write("=" * 90 + "\n\n") f.write("Elements with non-{2,3} coordination numbers:\n") f.write("-" * 60 + "\n") for r in non_factorizable: f.write(f" Z={r['Z']:3d} {r['symbol']:2s} ({r['name']:15s}): " f"CN={r['coord']}, crystal={r['crystal']}, " f"{r['cipher_str']}\n") f.write(f"\nElements with no clear N match (anisotropic structures):\n") f.write("-" * 60 + "\n") no_n = [r for r in results if r['expected_N'] is None and r['crystal'] != 'unknown'] for r in no_n: f.write(f" Z={r['Z']:3d} {r['symbol']:2s} ({r['name']:15s}): " f"crystal={r['crystal']}, CN={r['coord']}\n") f.write(f"\nElements with unknown crystal structure (synthetic/radioactive):\n") f.write("-" * 60 + "\n") unknowns = [r for r in results if r['crystal'] == 'unknown'] for r in unknowns: f.write(f" Z={r['Z']:3d} {r['symbol']:2s} ({r['name']:15s}): " f"mass={r['mass']:.1f} amu. {r['notes']}\n") f.write(f"\nElements with unusual coordination:\n") f.write("-" * 60 + "\n") unusual = [r for r in results if r['coord'] is not None and r['coord'] not in (2, 3, 4, 6, 8, 12)] for r in unusual: f.write(f" Z={r['Z']:3d} {r['symbol']:2s} ({r['name']:15s}): " f"CN={r['coord']}, crystal={r['crystal']}. " f"{r['notes']}\n") # ---- Section D: Cross-element analysis ---- f.write("\n" + "=" * 90 + "\n") f.write("SECTION D: CROSS-ELEMENT ANALYSIS\n") f.write("=" * 90 + "\n\n") # Scale ratios by crystal structure type f.write("Scale ratios (a/lambda_C) grouped by crystal structure:\n") f.write("-" * 70 + "\n") by_crystal = {} for r in results: if r['scale_ratio'] is not None: c = r['crystal'] if c not in by_crystal: by_crystal[c] = [] by_crystal[c].append(r) for crystal_type in ['FCC', 'BCC', 'HCP', 'diamond', 'SC', 'BCT', 'rhombo', 'hex', 'ortho', 'mono']: if crystal_type in by_crystal: elems = by_crystal[crystal_type] ratios = [e['scale_ratio'] for e in elems] f.write(f"\n {crystal_type} ({len(elems)} elements):\n") f.write(f" Range: [{min(ratios):.4e}, {max(ratios):.4e}]\n") f.write(f" Mean: {np.mean(ratios):.4e}\n") f.write(f" StdDev: {np.std(ratios):.4e}\n") for e in sorted(elems, key=lambda x: x['Z']): f.write(f" Z={e['Z']:3d} {e['symbol']:2s}: " f"a={e['a']:.4f} A, " f"a/lambda_C = {e['scale_ratio']:.6e}\n") # Trend analysis: scale ratio vs Z f.write(f"\nScale ratio trend with Z:\n") f.write("-" * 70 + "\n") valid = [(r['Z'], r['scale_ratio']) for r in results if r['scale_ratio'] is not None] if valid: Zs = [v[0] for v in valid] ratios = [v[1] for v in valid] f.write(f" Elements with known a: {len(valid)}\n") f.write(f" Global ratio range: [{min(ratios):.4e}, {max(ratios):.4e}]\n") f.write(f" Ratio at Z=1 (H): {ratios[0]:.4e}\n") f.write(f" Ratio at Z=6 (C): " + next((f"{r['scale_ratio']:.4e}" for r in results if r['Z'] == 6), "N/A") + "\n") f.write(f" Ratio at Z=26 (Fe): " + next((f"{r['scale_ratio']:.4e}" for r in results if r['Z'] == 26), "N/A") + "\n") f.write(f" Ratio at Z=79 (Au): " + next((f"{r['scale_ratio']:.4e}" for r in results if r['Z'] == 79), "N/A") + "\n") # Mass vs lattice constant f.write(f"\nMass * lattice_constant product (a * m in A*amu):\n") f.write("-" * 70 + "\n") f.write(" (If decoherence is universal, a*m should be proportional for same crystal type)\n\n") for crystal_type in ['FCC', 'BCC', 'HCP', 'diamond']: if crystal_type in by_crystal: f.write(f" {crystal_type}:\n") for e in sorted(by_crystal[crystal_type], key=lambda x: x['Z']): product = e['a'] * e['mass'] f.write(f" Z={e['Z']:3d} {e['symbol']:2s}: " f"a*m = {e['a']:.4f} * {e['mass']:.3f} = {product:.2f}\n") products = [e['a'] * e['mass'] for e in by_crystal[crystal_type]] f.write(f" Range: [{min(products):.2f}, {max(products):.2f}], " f"spread factor: {max(products)/min(products):.2f}x\n\n") print(f" Data file written: {filepath}") return filepath # ============================================================================ # VISUALIZATION # ============================================================================ def plot_periodic_table_heatmap(results): """ Plot periodic-table-style heatmap showing which N matches each element. Color-coded by expected N value. """ print("\n Generating periodic table N-match heatmap...") fig, ax = plt.subplots(figsize=(20, 12)) # Color map: N=2 blue, N=3 green, N=4 orange, N=6 red, None grey, unknown lightgrey n_to_color = { 2: '#2196F3', # blue 3: '#4CAF50', # green 4: '#FF9800', # orange 6: '#F44336', # red None: '#9E9E9E', # grey } # Draw cells cell_w = 1.0 cell_h = 1.0 max_row = 10 max_col = 18 for r in results: Z = r['Z'] if Z not in PERIODIC_TABLE_POSITIONS: continue row, col = PERIODIC_TABLE_POSITIONS[Z] # Flip row for display (period 1 at top) y = max_row - row n_val = r['expected_N'] if r['crystal'] == 'unknown': color = '#E0E0E0' # light grey for unknown else: color = n_to_color.get(n_val, '#9E9E9E') rect = Rectangle((col, y), cell_w, cell_h, linewidth=0.5, edgecolor='black', facecolor=color, alpha=0.85) ax.add_patch(rect) # Element symbol ax.text(col + cell_w/2, y + cell_h * 0.65, r['symbol'], ha='center', va='center', fontsize=8, fontweight='bold') # Atomic number ax.text(col + cell_w/2, y + cell_h * 0.30, str(Z), ha='center', va='center', fontsize=5, color='#333333') # Legend legend_items = [ ('N=2 (stripes)', '#2196F3'), ('N=3 (hexagonal)', '#4CAF50'), ('N=4 (square)', '#FF9800'), ('N=6 (hex alt)', '#F44336'), ('No match', '#9E9E9E'), ('Unknown structure', '#E0E0E0'), ] for i, (label, color) in enumerate(legend_items): y_pos = 2.0 - i * 0.6 rect = Rectangle((0.5, y_pos), 0.4, 0.4, facecolor=color, edgecolor='black', linewidth=0.5) ax.add_patch(rect) ax.text(1.1, y_pos + 0.2, label, va='center', fontsize=9) # Labels for lanthanides and actinides ax.text(-0.5, max_row - 8 + 0.5, 'Ln', fontsize=10, fontweight='bold', va='center', ha='center') ax.text(-0.5, max_row - 9 + 0.5, 'An', fontsize=10, fontweight='bold', va='center', ha='center') ax.set_xlim(-1.5, max_col + 0.5) ax.set_ylim(-0.5, max_row + 1.5) ax.set_aspect('equal') ax.set_title('TLT-002-PT: N-Wave Match Across the Periodic Table\n' '(Which N produces the crystal symmetry of each element?)', fontsize=16, pad=15) ax.axis('off') plt.tight_layout() filepath = OUTPUT_DIR / "periodic_table_N_match_heatmap.png" fig.savefig(filepath, dpi=150, bbox_inches='tight') print(f" Saved: {filepath}") plt.close(fig) def plot_scale_ratio_vs_Z(results): """Plot scale ratio (a/lambda_C) vs atomic number Z.""" print(" Generating scale ratio vs Z plot...") valid = [(r['Z'], r['scale_ratio'], r['symbol'], r['crystal']) for r in results if r['scale_ratio'] is not None] if not valid: print(" No valid data for scale ratio plot.") return Zs = [v[0] for v in valid] ratios = [v[1] for v in valid] symbols = [v[2] for v in valid] crystals = [v[3] for v in valid] # Color by crystal type crystal_colors = { 'FCC': '#4CAF50', 'BCC': '#FF9800', 'HCP': '#2196F3', 'diamond': '#9C27B0', 'SC': '#F44336', 'BCT': '#795548', 'rhombo': '#00BCD4', 'hex': '#009688', 'ortho': '#607D8B', 'mono': '#E91E63', } fig, ax = plt.subplots(figsize=(18, 8)) for crystal_type, color in crystal_colors.items(): mask = [c == crystal_type for c in crystals] z_sub = [Zs[i] for i in range(len(Zs)) if mask[i]] r_sub = [ratios[i] for i in range(len(ratios)) if mask[i]] if z_sub: ax.scatter(z_sub, r_sub, c=color, s=40, label=crystal_type, edgecolors='black', linewidths=0.3, zorder=3) # Label select elements label_elements = {1, 2, 6, 14, 26, 29, 47, 79, 82, 84, 92} for i, (z, r, sym, _) in enumerate(valid): if z in label_elements: ax.annotate(sym, (z, r), textcoords="offset points", xytext=(5, 5), fontsize=7, alpha=0.8) ax.set_xlabel('Atomic Number Z', fontsize=14) ax.set_ylabel('Scale Ratio a / lambda_C', fontsize=14) ax.set_title('TLT-002-PT: Scale Ratio (Lattice Constant / Compton Wavelength) vs Z', fontsize=14) ax.legend(loc='upper right', fontsize=8, ncol=2) ax.set_yscale('log') ax.grid(True, alpha=0.3) ax.tick_params(labelsize=11) plt.tight_layout() filepath = OUTPUT_DIR / "scale_ratio_vs_Z.png" fig.savefig(filepath, dpi=150, bbox_inches='tight') print(f" Saved: {filepath}") plt.close(fig) def plot_cipher_periodic_table(results): """ Plot {2,3} cipher classification as a color-coded periodic table. """ print(" Generating {2,3} cipher periodic table...") fig, ax = plt.subplots(figsize=(20, 12)) # Color map for cipher classification cipher_colors = { 'pure_2': '#2196F3', # blue — CN is pure power of 2 'pure_3': '#FF9800', # orange — CN is pure power of 3 'mixed_23': '#4CAF50', # green — CN = 2^a * 3^b 'has_other': '#F44336', # red — CN has factors beyond 2,3 'prime': '#9C27B0', # purple — CN is prime > 3 'unit': '#FFEB3B', # yellow — CN = 1 'unknown': '#E0E0E0', # light grey 'zero': '#BDBDBD', # grey } cell_w = 1.0 cell_h = 1.0 max_row = 10 for r in results: Z = r['Z'] if Z not in PERIODIC_TABLE_POSITIONS: continue row, col = PERIODIC_TABLE_POSITIONS[Z] y = max_row - row color = cipher_colors.get(r['cipher_class'], '#E0E0E0') rect = Rectangle((col, y), cell_w, cell_h, linewidth=0.5, edgecolor='black', facecolor=color, alpha=0.85) ax.add_patch(rect) # Element symbol ax.text(col + cell_w/2, y + cell_h * 0.65, r['symbol'], ha='center', va='center', fontsize=8, fontweight='bold') # Coordination number coord_str = str(r['coord']) if r['coord'] is not None else '?' ax.text(col + cell_w/2, y + cell_h * 0.30, f"CN={coord_str}", ha='center', va='center', fontsize=5, color='#333333') # Legend legend_items = [ ('Pure 2^n (CN=2,4,8,16)', '#2196F3'), ('Pure 3^n (CN=3,9,27)', '#FF9800'), ('Mixed 2^a*3^b (CN=6,12,24)', '#4CAF50'), ('Has other factors (CN=7,10,...)', '#F44336'), ('Prime > 3', '#9C27B0'), ('CN = 1', '#FFEB3B'), ('Unknown CN', '#E0E0E0'), ] for i, (label, color) in enumerate(legend_items): y_pos = 2.5 - i * 0.55 rect = Rectangle((0.3, y_pos), 0.4, 0.4, facecolor=color, edgecolor='black', linewidth=0.5) ax.add_patch(rect) ax.text(0.9, y_pos + 0.2, label, va='center', fontsize=8) ax.set_xlim(-1.5, 18.5) ax.set_ylim(-0.5, max_row + 1.5) ax.set_aspect('equal') ax.set_title('TLT-002-PT: {2,3} Cipher Classification Across the Periodic Table\n' '(Can the coordination number be expressed as 2^a * 3^b?)', fontsize=16, pad=15) ax.axis('off') plt.tight_layout() filepath = OUTPUT_DIR / "periodic_table_23_cipher.png" fig.savefig(filepath, dpi=150, bbox_inches='tight') print(f" Saved: {filepath}") plt.close(fig) def plot_nonmatching_overlays(results, nwave_data): """ For elements whose crystal structure does NOT match N=3 (the dominant pattern), generate overlay comparisons showing what each N produces. This shows N=2,3,4,6 side by side for each non-N=3 element. """ print(" Generating overlay comparisons for non-N=3 elements...") # Find elements that are NOT N=3 and have known crystal structures non_n3 = [r for r in results if r['expected_N'] is not None and r['expected_N'] != 3 and r['a'] is not None] if not non_n3: print(" No non-N=3 elements with known structure found.") return # Group by expected N to avoid redundant plots by_expected_n = {} for r in non_n3: n = r['expected_N'] if n not in by_expected_n: by_expected_n[n] = [] by_expected_n[n].append(r) # Select representative elements for each non-N=3 group representatives = {} for n, elems in by_expected_n.items(): # Pick the most common/recognizable element from each group priority = {'Fe': 0, 'Cr': 1, 'W': 2, 'Si': 3, 'C': 4, 'Po': 5, 'Na': 6, 'K': 7, 'V': 8, 'Ge': 9, 'Sn': 10} elems_sorted = sorted(elems, key=lambda x: priority.get(x['symbol'], 99)) # Take up to 3 representatives per group representatives[n] = elems_sorted[:3] for n_expected, rep_elems in representatives.items(): for elem in rep_elems: fig, axes = plt.subplots(1, 4, figsize=(28, 7)) for idx, N in enumerate([2, 3, 4, 6]): ax = axes[idx] X = nwave_data[N]['X'] Y = nwave_data[N]['Y'] intensity = nwave_data[N]['intensity'] im = ax.pcolormesh(X, Y, intensity, cmap='inferno', shading='auto', alpha=0.9) match_str = "" if N == n_expected: match_str = " << MATCH" ax.spines['bottom'].set_color('#00FF00') ax.spines['top'].set_color('#00FF00') ax.spines['left'].set_color('#00FF00') ax.spines['right'].set_color('#00FF00') for spine in ax.spines.values(): spine.set_linewidth(3) ax.set_title(f"N={N}{match_str}", fontsize=14) ax.set_aspect('equal') ax.set_xlabel('x / lambda') ax.set_ylabel('y / lambda') plt.suptitle(f"{elem['symbol']} ({elem['name']}) — Z={elem['Z']}, " f"crystal={elem['crystal']}, CN={elem['coord']}\n" f"Expected match: N={n_expected}", fontsize=14, y=1.02) plt.tight_layout() filepath = OUTPUT_DIR / f"overlay_{elem['symbol']}_Z{elem['Z']}_all_N.png" fig.savefig(filepath, dpi=150, bbox_inches='tight') print(f" Saved: {filepath}") plt.close(fig) # ============================================================================ # MAIN # ============================================================================ def main(): t_start = time.time() # Compute all element data results, nwave_data = compute_all_elements() # Write comprehensive data file write_data_file(results, nwave_data) # Generate visualizations print("\n" + "=" * 70) print("GENERATING VISUALIZATIONS") print("=" * 70) plot_periodic_table_heatmap(results) plot_scale_ratio_vs_Z(results) plot_cipher_periodic_table(results) plot_nonmatching_overlays(results, nwave_data) # Print summary to console t_elapsed = time.time() - t_start print("\n" + "=" * 70) print("SUMMARY") print("=" * 70) total = len(results) known = sum(1 for r in results if r['crystal'] != 'unknown') unknown = sum(1 for r in results if r['crystal'] == 'unknown') print(f" Total elements: {total}") print(f" Known structure: {known}") print(f" Unknown: {unknown}") # N-match summary n3_count = sum(1 for r in results if r['expected_N'] == 3) n4_count = sum(1 for r in results if r['expected_N'] == 4) n_none = sum(1 for r in results if r['expected_N'] is None and r['crystal'] != 'unknown') print(f"\n N=3 (hexagonal symmetry): {n3_count} elements ({100*n3_count/known:.1f}% of known)") print(f" N=4 (square symmetry): {n4_count} elements ({100*n4_count/known:.1f}% of known)") print(f" No clear N match: {n_none} elements ({100*n_none/known:.1f}% of known)") # {2,3} cipher summary factorizable = sum(1 for r in results if r['cipher_class'] in ('pure_2', 'pure_3', 'mixed_23')) non_fact = sum(1 for r in results if r['cipher_class'] in ('has_other', 'prime')) with_coord = sum(1 for r in results if r['coord'] is not None) print(f"\n {{2,3}} factorizable CN: {factorizable} elements " f"({100*factorizable/with_coord:.1f}% of elements with known CN)") print(f" Non-{{2,3}} CN: {non_fact} elements") # List non-factorizable if non_fact > 0: print(f"\n Non-{{2,3}} elements:") for r in results: if r['cipher_class'] in ('has_other', 'prime'): print(f" Z={r['Z']:3d} {r['symbol']:2s} ({r['name']}): " f"CN={r['coord']}, {r['cipher_str']}") print(f"\n Elapsed time: {t_elapsed:.1f} seconds") print(f" Data file: {DATA_DIR / 'periodic_table_full_data.txt'}") print(f" Images: {OUTPUT_DIR}") print("=" * 70) print("TLT-002-PT COMPLETE") print("=" * 70) if __name__ == "__main__": main()