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

lattice_waves_check.py

In the investigation at sim/charge_wave/check_earnshaw_pages_fable/lattice_waves_check.py · last changed in commit 08d8d68, 13 November 2026 · 6,958 bytes · the folder as a zip


"""Ninth review: my own Ewald dynamical matrix for point charges in a rigid uniform continuum of opposite charge,
to check §9.6's numbers: the simple cubic lattice's worst wave at M (−0.093 of the continuum's pull), the share cap
91.5%, and the claim that the body-centred lattice has no wave leaning the wrong way. Also the hold values f/(1 − f).
Units: force constants in units of n q^2/eps_b (the continuum's pull along the beam, m omega_p^2), d = 1 for the cube.
Run: ~/aspden-review-venv/bin/python3 -I lattice_waves_check.py"""
import numpy as np
from scipy.special import erfc

def dyn_matrix(k, lattice, alpha=2.4, nmax=5, mmax=6):
    """D(k) = sum over lattice vectors R != 0 of (Hessian of 1/R) * (1 - exp(i k.R)) ... written per unit mass and
    per n q^2/eps_b: Phi(k) = (1/(4 pi n)) * sum_R [ -H(R) ] e^{ikR} (self term included via k->0 limit), with the
    continuum removing the G = 0 term. Built from the Ewald split of the lattice sum of the dipole tensor."""
    if lattice == "sc":
        a1, a2, a3 = np.eye(3); vol = 1.0
    else:  # bcc with the same volume per quon (cube root of the volume per quon = 1)
        a = 2 ** (1 / 3)  # conventional cube side so that a^3/2 = 1
        a1, a2, a3 = a * np.array([-.5, .5, .5]), a * np.array([.5, -.5, .5]), a * np.array([.5, .5, -.5]); vol = 1.0
    A = np.array([a1, a2, a3]); B = 2 * np.pi * np.linalg.inv(A).T  # reciprocal vectors as rows
    k = np.asarray(k, float)
    # reciprocal part: (4 pi / vol) sum_G (K K^T / K^2) exp(-K^2/(4 alpha^2)), K = k + G, excluding K = 0
    rec = np.zeros((3, 3), complex)
    rng = range(-mmax, mmax + 1)
    for i in rng:
        for j in rng:
            for l in rng:
                K = k + i * B[0] + j * B[1] + l * B[2]
                K2 = K @ K
                if K2 < 1e-12:
                    continue
                rec += (4 * np.pi / vol) * np.outer(K, K) / K2 * np.exp(-K2 / (4 * alpha ** 2))
    # real-space part: sum_R != 0 of -[Hessian of erfc(alpha R)/R] e^{i k R}
    real = np.zeros((3, 3), complex)
    for i in rng:
        for j in rng:
            for l in rng:
                if i == j == l == 0:
                    continue
                R = i * A[0] + j * A[1] + l * A[2]; r = np.linalg.norm(R)
                if r > nmax:
                    continue
                x = alpha * r
                f = erfc(x) / r; g = 2 * alpha / np.sqrt(np.pi) * np.exp(-x * x)
                # phi(r) = erfc(ar)/r ; phi' = -(f + g)/r ; phi'' = (2f + 2g)/r^2 + 2 a^2 g
                phi1 = -(f + g) / r; phi2 = (2 * f + 2 * g) / r ** 2 + 2 * alpha ** 2 * g
                H = (phi2 - phi1 / r) * np.outer(R, R) / r ** 2 + (phi1 / r) * np.eye(3)
                real += -H * np.exp(1j * (k @ R))
    # self term from the Gaussian screening cloud: -(4 alpha^3 / (3 sqrt(pi))) I  (the k-independent piece of the real sum at R = 0)
    self_t = -(4 * alpha ** 3 / (3 * np.sqrt(np.pi))) * np.eye(3)
    Phi = rec + real + self_t
    # Phi is the force-constant matrix for a wave: m omega^2 u = q^2 Phi u, with q^2/vol = n q^2 ; in units of 4 pi n q^2
    # (Gaussian), the continuum's full pull 4 pi n q^2 corresponds to 1.  Tr Phi should equal 4 pi n (the sum rule).
    return (Phi / (4 * np.pi / vol)).real

_S0 = {}
def D_of(k, lat):
    """D(k) = S(k) - S(0): the wave's force constants minus the k = 0 sum with its K = 0 term left out (the uniform
    continuum cancels that term). Tr D = 1 (the continuum's full pull) at every k; S itself is traceless."""
    if lat not in _S0:
        _S0[lat] = dyn_matrix(np.zeros(3), lat)
    return dyn_matrix(k, lat) - _S0[lat]
def eig(k, lat):
    return np.sort(np.linalg.eigvalsh(D_of(k, lat)))

print("Sum rule and splitting independence (sc, random k):")
rng = np.random.default_rng(1)
for _ in range(3):
    k = rng.uniform(-np.pi, np.pi, 3)
    e1 = eig(k, "sc"); D2 = dyn_matrix(k, "sc", alpha=1.8, nmax=6, mmax=7) - dyn_matrix(np.zeros(3), "sc", alpha=1.8, nmax=6, mmax=7)
    print(f"  k={np.round(k,3)}  eig={np.round(e1,6)}  trace={e1.sum():.7f}  alt-splitting trace={np.trace(D2):.7f}  max|diff|={np.abs(np.sort(np.linalg.eigvalsh(D2))-e1).max():.1e}")
M = np.array([np.pi, np.pi, 0.0]); X = np.array([np.pi, 0, 0]); R = np.array([np.pi, np.pi, np.pi])
for name, kk in (("X", X), ("M", M), ("R", R), ("k->0 along x (transverse should be 0, longitudinal 1)", np.array([1e-3, 0, 0]))):
    print(f"sc {name}: {np.round(eig(kk, 'sc'), 5)}")
# the single displaced quon: zone average of D
g = 10; ks = (np.arange(g) + 0.5) / g * 2 * np.pi - np.pi
avg = np.zeros((3, 3))
for kx in ks:
    for ky in ks:
        for kz in ks:
            avg += D_of(np.array([kx, ky, kz]), "sc")
avg /= g ** 3
print("sc: zone average of D (a quon moved alone) =\n", np.round(avg, 4))
# fraction unstable on a grid, sc
tot = 0; bad = 0; worst = 1
for kx in ks:
    for ky in ks:
        for kz in ks:
            e = eig([kx, ky, kz], "sc"); tot += 3; bad += (e < 0).sum(); worst = min(worst, e.min())
print(f"sc: unstable fraction on a {g}^3 grid = {bad/tot:.3f}; lowest eigenvalue found = {worst:.5f}")
# bcc: minimum eigenvalue over a grid in its zone (use the reciprocal cell of the bcc lattice: fractional coordinates)
a = 2 ** (1 / 3); A = a * np.array([[-.5, .5, .5], [.5, -.5, .5], [.5, .5, -.5]]); B = 2 * np.pi * np.linalg.inv(A).T
worst = 1; where = None; tot = 0; bad = 0
fr = (np.arange(g) + 0.5) / g - 0.5
for fx in fr:
    for fy in fr:
        for fz in fr:
            k = fx * B[0] + fy * B[1] + fz * B[2]
            e = eig(k, "bcc"); tot += 3; bad += (e < -1e-6).sum()
            if e.min() < worst:
                worst = e.min(); where = k
print(f"bcc: unstable fraction on a {g}^3 grid = {bad/tot:.3f}; lowest eigenvalue found = {worst:.5f} at k={np.round(where,3)}")
print(f"bcc: trace at that k = {eig(where,'bcc').sum():.6f}; small-k transverse (k=1e-3 x): {np.round(eig(np.array([1e-3,0,0]),'bcc'),6)}")
# threshold and shares
lamM = eig(M, "sc")[0]
print(f"\nThreshold: hold >= {-lamM:.4f}; f/(1-f) = {-lamM:.4f} gives f = {(-lamM)/(1-lamM):.5f}, quons' share {1-(-lamM)/(1-lamM):.4f}")
for f in (0.75, 0.90, 0.99, 1.0):
    s = 1 - f
    print(f"  quons carry {f:.0%}: f_space = {s:.2f}, hold f/(1-f) = {s/(1-s) if s < 1 else float('inf'):.4f}")
for KT in (0.0992, 0.0984, 0.1011, 0.1196, 0.0927):
    print(f"  K_T = {KT}: quons' share = {1/(1+KT):.4f}")
print("Requirement 3's spacing bound 4.6e-27*sqrt(f)/(1-f) at f = 0.01, 0.0848, 0.25:", [f"{4.6e-27*np.sqrt(f)/(1-f):.2e}" for f in (0.01, 0.0848, 0.25)])
print("sqrt(f)/(1-f) vs sqrt(f) at f = 0.01, 0.0848, 0.25:", [f"{np.sqrt(f)/(1-f)/np.sqrt(f):.3f}" for f in (0.01, 0.0848, 0.25)])
print("Where the electric dispersion 3*beta*(1-f)^2/(2f) equals the magnetic 1/8: beta=0.057 ->", end=" ")
from scipy.optimize import brentq
for beta in (0.057, 0.023, 0.003):
    fcross = brentq(lambda f: 3*beta*(1-f)**2/(2*f) - 1/8, 1e-4, 0.999)
    print(f"beta={beta}: f={fcross:.3f}", end="; ")
print()