Does light charge the quons? › Files cited on the page › check_earnshaw_fable/

check_sum_rule.py

In the investigation at sim/charge_wave/check_earnshaw_fable/check_sum_rule.py · last changed in commit ca0b096, 12 November 2026 · 13,088 bytes · the folder as a zip


"""Independent check of draft 0.8's section 8.5 'Notes on the table' (Earnshaw / sum rule / what holds the excess).

Gaussian lattice units: simple cubic spacing d = 1, quon charge q = 1, quon mass m = 1, Coulomb energy 1/r,
so w_p^2 = 4 pi n q^2 / m = 4 pi.  All dynamical-matrix eigenvalues are reported in units of w_p^2.

A. Ewald dynamical matrix written from scratch (own splitting, own cutoffs); eigenvalues at X, M, R; trace sum rule.
B. Direct real-space sum with Cesaro averaging over spherical cutoffs at M and X (no Ewald at all).
C. Held point charges of opposite sign at no quon site (s = 3 body-centred nesting, s = 2, CsCl): shift -1/3; trace 0;
   eigenvalues at M.
D. Zone average of D = 1/3 (W3 line 7) by sum rule and by direct averaging.
E. Extended quon: a finer point charge inside a uniform sphere / on a shell: trace of the hold = 4 pi q1 rho_q(r1).
F. Thomson-atom lattice (the opposite charge bound electrically inside an extended quon, both free): relative-mode
   spectrum equals the held-cloud spectrum, CM modes zero.
G. Numbers: the common-mode plasma frequency, the mass density an 'inertia hold' would need, the U44 ladder,
   and the Thomson-atom dielectric for light at c.
"""
import itertools, math
import numpy as np
from scipy.special import erfc

WP2 = 4 * math.pi

# ---------------------------------------------------------------- A. own Ewald
def hess_erfc(Rv, a):
    """Hessian of erfc(a r)/r at each vector (n,3,3)."""
    r = np.linalg.norm(Rv, axis=1)
    g = 2 * a / math.sqrt(math.pi) * np.exp(-(a * r) ** 2)
    f = erfc(a * r) / r                 # f(r)
    fp = -erfc(a * r) / r ** 2 - g / r  # f'
    fpp = 2 * erfc(a * r) / r ** 3 + g * (2 / r ** 2 + 2 * a ** 2)  # f''
    rr = np.einsum('ni,nj->nij', Rv, Rv) / (r ** 2)[:, None, None]
    return (fpp - fp / r)[:, None, None] * rr + (fp / r)[:, None, None] * np.eye(3)[None]

def make_lattice(nmax, basis=None):
    pts = np.array([v for v in itertools.product(range(-nmax, nmax + 1), repeat=3)], float)
    return pts

A_SPLIT = 2.2
NREAL, NREC = 6, 7
RV = make_lattice(NREAL)
RV = RV[np.any(RV != 0, axis=1)]
HR = hess_erfc(RV, A_SPLIT)
GV = 2 * math.pi * make_lattice(NREC)

def S_of_k(k, Rv=RV, HRv=HR, Gv=GV, a=A_SPLIT, vol=1.0):
    """S(k) = sum_{R != 0} d_a d_b (1/|R|) e^{i k.R} for the lattice {R} (Bravais, origin included as excluded term)."""
    k = np.asarray(k, float)
    real = np.einsum('n,nij->ij', np.cos(Rv @ k), HRv)
    K = Gv + k
    K2 = np.einsum('ni,ni->n', K, K)
    msk = K2 > 1e-14
    rec = -np.einsum('n,ni,nj->ij', (4 * math.pi / vol) * np.exp(-K2[msk] / (4 * a * a)) / K2[msk], K[msk], K[msk])
    self_t = (4 * a ** 3 / (3 * math.sqrt(math.pi))) * np.eye(3)   # removes the R = 0 erf-part's own Hessian
    return real + rec + self_t

def D_jell(k):
    """Point quons, rigid uniform background: D = (4pi/3) I - S(k)   (n = q = m = 1)."""
    return (WP2 / 3) * np.eye(3) - S_of_k(k)

def ev(D):
    return np.sort(np.linalg.eigvalsh(D)) / WP2

print("A. Own Ewald, simple cubic jellium (eigenvalues / w_p^2)")
pts = {"X": (math.pi, 0, 0), "M": (math.pi, math.pi, 0), "R": (math.pi, math.pi, math.pi)}
for nm, kk in pts.items():
    e = ev(D_jell(kk))
    print(f"   {nm}: {e[0]:+.5f} {e[1]:+.5f} {e[2]:+.5f}   trace {e.sum():.6f}")
# splitting independence
for a in (1.6, 2.2, 2.8):
    RVa = RV; HRa = hess_erfc(RV, a)
    e = np.sort(np.linalg.eigvalsh((WP2 / 3) * np.eye(3) - S_of_k(pts["M"], HRv=HRa, a=a))) / WP2
    print(f"   M with splitting a = {a}: {e[0]:+.6f} {e[1]:+.6f} {e[2]:+.6f}")
rng = np.random.default_rng(7)
tr = [np.trace(D_jell(rng.uniform(-math.pi, math.pi, 3))) / WP2 for _ in range(6)]
print("   trace D(k)/w_p^2 at 6 random k:", " ".join(f"{t:.7f}" for t in tr))
kT = (1e-4, 0, 0)
Dk = D_jell(kT)
print(f"   k -> 0 along x: longitudinal {Dk[0,0]/WP2:.7f}, transverse {Dk[1,1]/WP2:+.2e} {Dk[2,2]/WP2:+.2e}")

# ---------------------------------------------------------------- B. direct real-space sum
print("\nB. Direct real-space sum (no Ewald), Cesaro-averaged over spherical cutoffs 18 <= Rc <= 30")
NB = 31
RB = make_lattice(NB); RB = RB[np.any(RB != 0, axis=1)]
rB = np.linalg.norm(RB, axis=1)
PhiB = (3 * np.einsum('ni,nj->nij', RB, RB) / (rB ** 2)[:, None, None] - np.eye(3)[None]) / (rB ** 3)[:, None, None]
def D_direct(k, Rc):
    msk = rB < Rc
    S = np.einsum('n,nij->ij', np.cos(RB[msk] @ np.asarray(k, float)), PhiB[msk])
    return (WP2 / 3) * np.eye(3) - S
for nm in ("M", "X"):
    acc = np.zeros((3, 3)); cnt = 0
    for Rc in np.arange(18.0, 30.01, 0.25):
        acc += D_direct(pts[nm], Rc); cnt += 1
    e = np.sort(np.linalg.eigvalsh(acc / cnt)) / WP2
    print(f"   {nm}: {e[0]:+.5f} {e[1]:+.5f} {e[2]:+.5f}   (Ewald: {' '.join(f'{x:+.5f}' for x in ev(D_jell(pts[nm])))})")

# ---------------------------------------------------------------- C. held point charges of opposite sign
print("\nC. Opposite charge as held point charges at no quon site (total -1 per cell), no continuum")
def hess_sublattice(tau, a=A_SPLIT):
    """Hessian at the origin of the potential of unit charges on the Bravais lattice shifted by tau, with the
    G = 0 (uniform) term omitted.  Equals the k = 0 Ewald sum over R of d d 1/|R + tau|."""
    vecs = make_lattice(NREAL) + tau          # all R + tau (none is zero if tau is not a lattice vector)
    real = hess_erfc(vecs, a).sum(axis=0)
    G = GV; G2 = np.einsum('ni,ni->n', G, G); msk = G2 > 1e-14
    rec = -np.einsum('n,ni,nj->ij', 4 * math.pi * np.cos(G[msk] @ tau) * np.exp(-G2[msk] / (4 * a * a)) / G2[msk], G[msk], G[msk])
    return real + rec
def H_points(taus, qf):
    """Force-constant tensor on the quon (charge +1) from held point charges qf (signed) at taus; uniform part removed."""
    H = np.zeros((3, 3))
    for t in taus:
        H += qf * hess_sublattice(np.asarray(t, float))      # energy q*qf/|r - R - tau| -> Hessian q qf d d (1/|.|)
    return H
cases = {}
for s in (3, 2):
    ax = (np.arange(s) + 0.5) / s
    taus = list(itertools.product(ax, ax, ax))
    cases[f"s = {s} ({s**3} charges of -1/{s**3})"] = (taus, -1.0 / s ** 3)
cases["CsCl: one charge -1 at the body centre"] = ([(0.5, 0.5, 0.5)], -1.0)
for nm, (taus, qf) in cases.items():
    Hp = H_points(taus, qf)                                   # the point charges' Hessian (uniform part omitted)
    # the quon lattice with the points replacing the background: D = -S(k) + Hp  (no (4pi/3) background term)
    Dp = lambda k: (WP2 / 3) * np.eye(3) - S_of_k(k) + Hp   # = D_jell(k) + Hp: the quons' own background (-1) cancels the +1 background implied by the omitted G = 0 term in Hp
    eM = ev(Dp(pts["M"])); e0 = Dp(kT)
    trs = [np.trace(Dp(rng.uniform(-math.pi, math.pi, 3))) / WP2 for _ in range(4)]
    print(f"   {nm}: points' own Hessian (Hp + 4pi/3 I)/w_p^2 diag {np.diag(Hp+(WP2/3)*np.eye(3))/WP2} off {np.max(np.abs(Hp-np.diag(np.diag(Hp))))/WP2:.1e}  (expect 0: isotropic and traceless)")
    print(f"      k->0: L {e0[0,0]/WP2:+.6f}  T {e0[1,1]/WP2:+.6f} {e0[2,2]/WP2:+.6f};  at M: {eM[0]:+.5f} {eM[1]:+.5f} {eM[2]:+.5f};"
          f"  trace at random k: {' '.join(f'{t:+.1e}' for t in trs)}")

# ---------------------------------------------------------------- D. zone average = single quon moved alone
print("\nD. One quon moved alone = zone average of D(k) (W3 line 7)")
ng = 12
grid = (np.arange(ng) + 0.5) / ng * 2 * math.pi - math.pi
acc = np.zeros((3, 3))
for kx, ky, kz in itertools.product(grid, grid, grid):
    acc += D_jell((kx, ky, kz))
acc /= ng ** 3
print(f"   jellium: diag {np.diag(acc)/WP2}, max off-diag {np.max(np.abs(acc-np.diag(np.diag(acc))))/WP2:.1e}  (expect 1/3)")
Hp3 = H_points(*cases["s = 3 (27 charges of -1/27)"])
acc2 = np.zeros((3, 3))
for kx, ky, kz in itertools.product(grid, grid, grid):
    acc2 += (WP2 / 3) * np.eye(3) - S_of_k((kx, ky, kz)) + Hp3
acc2 /= ng ** 3
print(f"   held point charges s=3: diag {np.diag(acc2)/WP2}  (expect 0: a quon moved alone feels no first-order force)")

# ---------------------------------------------------------------- E. extended quon
print("\nE. Extended quon of charge +1, radius b, with a finer point charge -q1 at offset r1 inside it (Gaussian units)")
def hess_sphere_potential(r1, b, q=1.0):
    """Hessian of the potential of a uniformly charged sphere (charge q, radius b) at r1 (|r1| < b): -(q/b^3) I."""
    r = np.linalg.norm(r1)
    assert r < b
    return -(q / b ** 3) * np.eye(3)
for b in (0.036135562, 0.25, 0.49):
    rho_q = 3 / (4 * math.pi * b ** 3)
    K = -(-1.0) * hess_sphere_potential(np.array([0.3 * b, 0.1 * b, 0]), b)   # force constant on charge -q1=-1: q1 * (-Hess phi) ... sign below
    # energy of charge -q1 in potential phi: U = -q1 phi; force constant = -q1 d d phi = -q1 * (-(q/b^3)) I = (q q1 / b^3) I
    Kmat = (1.0 / b ** 3) * np.eye(3)
    print(f"   uniform sphere b = {b:.4f} d: hold on a point charge -1 anywhere inside = {Kmat[0,0]/WP2:.4f} w_p^2 per axis,"
          f" trace/(4 pi) = {np.trace(Kmat)/WP2:.4f} = q1*rho_q(r1)/(n q) = {rho_q:.4f};  rho_q/rho_mean = {rho_q:.3f}")
print("   shell (all the quon's charge on its surface): Hessian inside = 0 -> no hold on a charge strictly inside; only charge ON the shell counts.")
print("   general: trace of the hold = (1/eps_b) * integral rho_quon(r) rho_opp(r) d^3r  (overlap of the two charge densities).")

# ---------------------------------------------------------------- F. Thomson-atom lattice
print("\nF. Thomson-atom lattice: quon sphere (+1, radius b, mass mq) with its own point charge (-1, mass m1) at its centre, both free, no continuum")
def D_atom(k, b, mq=1.0, m1=1.0):
    Kb = 1.0 / b ** 3                     # overlap spring (Gaussian), q = q1 = 1
    S = S_of_k(k)                         # sum_{R!=0} dd(1/R) e^{ikR}
    I = np.eye(3)
    # force constants (see derivation in the report): quon self: Kb I ; quon-quon(k): -S ; quon-finer(k): +S ; quon-own finer: -Kb I
    Dqq = (Kb * I - S) / mq
    Dqf = (-Kb * I + S) / mq
    Dfq = (-Kb * I + S) / m1
    Dff = (Kb * I - S) / m1
    return np.block([[Dqq, Dqf], [Dfq, Dff]])
for b, mq, m1 in ((0.25, 1.0, 1.0), (0.25, 1.0, 1e6), (0.49, 1.0, 3.0)):
    mu = mq * m1 / (mq + m1)
    rho_ratio = 3 / (4 * math.pi * b ** 3)
    for nm in ("M", "X"):
        e = np.sort(np.linalg.eigvals(D_atom(pts[nm], b, mq, m1)).real) / (WP2 / mu)
        ej = ev(D_jell(pts[nm]))
        pred = (rho_ratio - 1) / 3 + ej
        print(f"   b={b}, mq={mq}, m1={m1:g}, {nm}: eigenvalues/(w_p^2 with reduced mass) {np.array2string(e, precision=5)}")
        print(f"      predicted: three zeros (neutral CM) and (rho_at/rho_mean - 1)/3 + jellium = {np.array2string(pred, precision=5)}")
kk = (1e-4, 0, 0)
for b in (0.25, 0.49, 0.036135562):
    e = np.sort(np.linalg.eigvals(D_atom(kk, b)).real) / (WP2 / 0.5)
    y = (4 * math.pi / 3) * b ** 3
    print(f"   b={b:.4f}: k->0 modes {np.array2string(e, precision=4)};  filling y=(4pi/3) n b^3 = {y:.4f};  transverse hold (1/y - 1)/3 = {(1/y-1)/3:.4f};"
          f"  eps(0)/eps_b = (1+2y)/(1-y) = {(1+2*y)/(1-y):.4f} -> f = {(1-y)/(1+2*y):.4f}")

# ---------------------------------------------------------------- G. numbers
print("\nG. Numbers (SI)")
e = 1.602176634e-19; eps0 = 8.8541878128e-12; hbar = 1.054571817e-34; c = 299792458.0; me = 9.1093837015e-31
d = 6.374e-13; m0 = 0.0407813 * me
n0 = 1 / d ** 3; sigma = n0 * e; rho_m0 = n0 * m0
wp2 = sigma ** 2 / (eps0 * rho_m0)
print(f"   Aspden lattice: d = {d:.3e} m, sigma = {sigma:.3e} C/m^3, mass density {rho_m0:.3e} kg/m^3 ({rho_m0/1e3:.1f} g/cm^3)")
print(f"   common-mode plasma frequency sigma^2/(eps0 rho_m): hbar w = {hbar*math.sqrt(wp2)/e/1e3:.1f} keV (W4 line 1: 361.3 keV)")
for name, w in (("1 MHz radio", 2 * math.pi * 1e6), ("1 kHz", 2 * math.pi * 1e3), ("photon-mass bound hbar w = 1e-18 eV", 1e-18 * e / hbar)):
    rho_need = sigma ** 2 / (eps0 * w ** 2)
    print(f"   mass density for the common mode's plasma frequency below {name}: {rho_need:.2e} kg/m^3 = {rho_need/rho_m0:.1e} x the lattice's")
print("   U44 ladder (s = 3, charge e per finer quon, mass m0 s^k, spacing d/3^k): common-mode plasma energy of level k alone = 361 keV x 3^k")
for k in (1, 2, 10, 29):
    print(f"      level {k}: {361.3e3*3**k:.3e} eV")
print("   e/27 bookkeeping (level 1: 27 charges e/27, mass m1 each; both levels in one continuum of 2 n0 e):")
for m1_over_m0 in (1.0, 3.0, 1e6):
    w2 = (2 * sigma) ** 2 / (eps0 * (n0 * m0 + 27 * n0 * m1_over_m0 * m0))
    print(f"      m1 = {m1_over_m0:g} m0: common-mode plasma energy {hbar*math.sqrt(w2)/e/1e3:.3g} keV")
print("   Thomson-atom lattice for light at c: y = (1-f)/(1+2f);  f=1/4 -> y = 0.5 -> b = (3y/(4 pi))^(1/3) d = %.3f d" % ((3*0.5/(4*math.pi))**(1/3)))
y_touch = math.pi / 6
print(f"   touching spheres (b = d/2): y = pi/6 = {y_touch:.4f}, eps(0)/eps_b = {(1+2*y_touch)/(1-y_touch):.3f}, f = {(1-y_touch)/(1+2*y_touch):.3f}; the quons carry {1-(1-y_touch)/(1+2*y_touch):.1%} of eps0")
print(f"   Aspden's b/d = 0.0361: y = {(4*math.pi/3)*0.036135562**3:.3e}, eps_q/eps_b = {3*((4*math.pi/3)*0.036135562**3)/(1-(4*math.pi/3)*0.036135562**3):.3e} (C7: 5.93e-4)")