Does light charge the quons? › Files cited on the page › the trials
engine.py
"""The wheel-and-band ether (candidate M8) as a running engine, with M2's held charges on its bands.
Author seat (Claude Opus 5.5), 25 November 2026, at Doug Westmoreland's word ("ok to run").
Units: cell d = 1, c = 1, eps0 = mu0 = 1. Periodic box of N1 x N2 x N3 cells.
The physical things [M, the outline's 5.1 to 5.3]:
E[a](r) a band's tension on the edge from corner r to r + e_a (band stretch s = E, in these units)
H[a](r) a wheel's rate of turning, on the face normal to a whose lowest corner is r
wheels: dH/dt = -curl_e2f(E) (a wheel is turned by the tensions of the four bands round its face)
bands: dE/dt = curl_f2e(H) - J (a band is stretched by the turns of the four wheels round its edge, and eased by charge passing along it)
matter: P[a](r) = q x, the displacement of a held charge along its band (the dipole it makes), present where occ = 1;
d2P/dt2 = -wb2 P + wp2 E - g dP/dt (wb2: the bare hold, omega_b^2; wp2: q^2/m; g: a loss, used only to reach a steady state)
J = dP/dt (the charge's motion along its band is the band's slip rate)
optional sigma_m: a drag on the wheels (dH/dt gains -sigma_m H), used only to reach a steady state; zero in every run that measures time.
Time: leapfrog. E and P at whole steps, H and dP/dt at half steps. Its law, for one plane wave, is the continuous one with omega replaced by
Omega~ = (2/dt) sin(omega dt/2) everywhere [D].
"""
import numpy as np
def curl_e2f(E):
f = lambda a, ax: np.roll(a, -1, axis=ax) - a
return np.stack([f(E[2], 1) - f(E[1], 2), f(E[0], 2) - f(E[2], 0), f(E[1], 0) - f(E[0], 1)])
def curl_f2e(H):
b = lambda a, ax: a - np.roll(a, 1, axis=ax)
return np.stack([b(H[2], 1) - b(H[1], 2), b(H[0], 2) - b(H[2], 0), b(H[1], 0) - b(H[0], 1)])
def div_e(E):
"""Charge at each corner: the stretches of the six bands that meet there, with their signs."""
return sum(E[a] - np.roll(E[a], 1, axis=a) for a in range(3))
class Lattice:
def __init__(self, shape, dt, wb2=0.0, wp2=0.0, occ=None, g=0.0, sigma_m=0.0):
self.shape, self.dt = tuple(shape), dt
self.E = np.zeros((3, *shape)); self.H = np.zeros((3, *shape))
self.P = np.zeros((3, *shape)); self.V = np.zeros((3, *shape))
self.wb2, self.wp2, self.g, self.sigma_m = wb2, wp2, g, sigma_m
self.occ = np.zeros((3, *shape)) if occ is None else occ.astype(float)
self.t = 0.0
def step(self):
dt = self.dt
if self.sigma_m:
self.H = (self.H * (1 - self.sigma_m * dt / 2) - dt * curl_e2f(self.E)) / (1 + self.sigma_m * dt / 2)
else:
self.H -= dt * curl_e2f(self.E)
if self.occ.any():
force = (-self.wb2 * self.P + self.wp2 * self.E) * self.occ
self.V = (self.V * (1 - self.g * dt / 2) + dt * force) / (1 + self.g * dt / 2)
self.P += dt * self.V
self.E += dt * (curl_f2e(self.H) - self.V)
else:
self.E += dt * curl_f2e(self.H)
self.t += dt
def energy(self):
"""Bands' strain + wheels' motion + the held charges' spring and motion (the last two in units where wp2 = q^2/m)."""
u = 0.5 * np.sum(self.E**2) + 0.5 * np.sum(self.H**2)
if self.occ.any() and self.wp2 > 0:
u += 0.5 * np.sum(self.occ * (self.wb2 * self.P**2 + self.V**2)) / self.wp2
return u
def edge_positions(shape):
"""Coordinates of each band's middle: corner r plus half a cell along its own axis."""
g = np.meshgrid(*[np.arange(n, dtype=float) for n in shape], indexing="ij")
out = []
for a in range(3):
pos = [g[0].copy(), g[1].copy(), g[2].copy()]
pos[a] += 0.5
out.append(pos)
return out
def plane_wave_E(shape, k, pol):
"""A standing transverse wave: E_a = pol_a cos(k . (middle of band a))."""
pos = edge_positions(shape)
return np.stack([pol[a] * np.cos(k[0] * pos[a][0] + k[1] * pos[a][1] + k[2] * pos[a][2]) for a in range(3)])
def static_field_of(P):
"""The field that a polarization P leaves when nothing moves: E = -(its part with a source), so that D = E + P has none [D].
Corners' charge rho = -div P; E = -grad V with the lattice's own Laplacian."""
shape = P.shape[1:]
rho = -div_e(P)
kv = [2 * np.pi * np.fft.fftfreq(n) for n in shape]
Kf = np.stack(np.meshgrid(*[np.exp(1j * k) - 1 for k in kv], indexing="ij"))
K2 = np.sum(np.abs(Kf) ** 2, 0)
K2[(0,) * 3] = 1.0
Vh = np.fft.fftn(rho) / K2
Vh[(0,) * 3] = 0.0
return -np.real(np.fft.ifftn(Kf * Vh, axes=(1, 2, 3)))
def prony_frequencies(x, dt, nfreq, with_zero=False):
"""Frequencies of a sum of nfreq real cosines (and a constant, if with_zero) from equally spaced samples, by linear prediction [S].
Exact for a noise-free sum; returns the angular frequencies, sorted."""
order = 2 * nfreq + (1 if with_zero else 0)
rows = len(x) - order
A = np.array([x[i:i + order] for i in range(rows)])
b = x[order:order + rows]
coef, *_ = np.linalg.lstsq(A, b, rcond=None)
roots = np.roots(np.concatenate([[1.0], -coef[::-1]]))
ang = np.abs(np.angle(roots)) / dt
ang = np.sort(ang)
out = []
for w in ang:
if with_zero and w < 1e-6:
continue
if not out or abs(w - out[-1]) > 1e-9 * max(1, w):
out.append(w)
return np.array(out), roots