nDot.io physics
07-ilang-weight / 06-inertia-of-pair
06inertia of pairverified

Determines the inertia of a pair bound through the field against the inertias of its bodies and its cost, and whether weight over inertia of the pair equals that of a single body.

Code of version 1

check_inertia.py14 KB · raw
"""Check of item 2 of 07-ilang-weight/06-inertia-of-pair (and of the numbers of items 1, 3).

Two Model D bodies (one clock level each: half-gap M_i, branch sigma_i), N_f = 1 field object
on a ring of L places, couplings (a) and (c).  The exact sector contract H(P) of bodies and
field (body 1 at place 0 as representative) is continued to real P; the curvature of the
exact bound level at P = 0 is compared with (6.6) evaluated on the band contract at order
tau^2 (second-order Schrieffer-Wolff on the tau = 0 levels), and with mu_1 + mu_2.
Branch basis (|+>, i|->): the motion term is real, -i sigma_1 -> J.
"""
import json
from pathlib import Path

import numpy as np

OUT = Path(__file__).parent / "output"
J = np.array([[0.0, 1.0], [-1.0, 0.0]])
SG = np.array([1.0, -1.0])  # branch index 0: sigma = +1, 1: sigma = -1


def bidx(sig):
    return 0 if sig > 0 else 1


def ground(h):
    w, v = np.linalg.eigh(h)
    g = v[:, 0]
    return w[0], g * np.sign(g.sum())


def field_hop(L, tf):
    h = np.zeros((L, L))
    for y in range(L):
        h[y, (y + 1) % L] = h[(y + 1) % L, y] = -tf
    return h


# ---------------------------------------------------------------- one body + field, sector
def body_sector(L, tf, b, cpl):
    cc = 1.0 if cpl == "c" else 0.0
    n = 2 * L
    ix = lambda s, y: s * L + y
    H0 = np.zeros((n, n)); B = np.zeros((n, n))
    hf = field_hop(L, tf)
    for s in range(2):
        H0[s * L:(s + 1) * L, s * L:(s + 1) * L] += hf
        for y in range(L):
            a = ix(s, y)
            H0[a, a] += SG[s] * b["M"] * (1 + b["gam"] * (y == 0))
            f = 1 + cc * b["gam"] * 0.5 * ((y == 0) + (y == 1))
            for sp in range(2):  # right hop 0 -> 1, frame shift y -> y-1, phase e^{-iP}
                B[ix(sp, (y - 1) % L), a] += 0.5 * b["tau"] * J[sp, s] * f
    return H0, B


def curvature(H0, B, sel_vec, mode):
    """E''(0) of the eigenvector of H(0)=H0+B+B^T selected by overlap with sel_vec (G-weight)."""
    H = H0 + B + B.T
    w, v = np.linalg.eigh(H)
    gw = np.abs(sel_vec.T @ v) ** 2 if sel_vec.ndim == 1 else (np.abs(sel_vec.T @ v) ** 2).sum(0)
    cand = np.where(gw > 0.5)[0]
    k = cand[np.argmin(w[cand])] if mode == "low" else cand[np.argmax(w[cand])]
    H1 = -1j * (B - B.T)
    H2 = -(B + B.T)
    x = v[:, k]
    d = w[k] - w
    d[k] = np.inf
    m1 = v.conj().T @ (H1 @ x)
    E2 = (x @ H2 @ x) + 2 * np.sum(np.abs(m1) ** 2 / d)
    return w[k], E2.real, v[:, k], gw[k]


def sw_scalar(H0, V, gvec):
    """Second-order SW energy of the single G state gvec (V complex allowed)."""
    w, U = np.linalg.eigh(H0)
    a = np.argmax(np.abs(U.T @ gvec))
    Vt = U.T @ V @ U
    d = w[a] - w
    d[a] = np.inf
    return w[a] + np.sum(np.abs(Vt[:, a]) ** 2 / d)


def body_data(L, tf, b, cpl):
    H0, B = body_sector(L, tf, b, cpl)
    s = bidx(b["sig"])
    hf = field_hop(L, tf); hf0 = hf.copy(); hf0[0, 0] += b["sig"] * b["gam"] * b["M"]
    e0, Om = ground(hf0)
    g = np.zeros(2 * L); g[s * L:(s + 1) * L] = Om
    E0, E2, _, gw = curvature(H0, B, g, "low" if b["sig"] > 0 else "high")
    # band contract (order tau^2): kappa_bar from P = 0 and P = pi/2
    Hs = lambda P: sw_scalar(H0, np.exp(-1j * P) * B + np.exp(1j * P) * B.T, g)
    kbar = (Hs(0.0) - Hs(np.pi / 2)).real / 4
    eps = lambda gg: np.linalg.eigvalsh(hf + np.diag([gg] + [0] * (L - 1)))[0]
    R = b["M"] + 0.5 * (eps(b["gam"] * b["M"]) - eps(-b["gam"] * b["M"]))
    c2 = b["tau"] ** 2 * (1 + (b["gam"] / L if cpl == "c" else 0.0)) ** 2
    return dict(E0=E0, mu=1 / E2, mubar=-1 / (8 * kbar), kbar=kbar, R=R, c2=c2, gw=gw)


# ---------------------------------------------------------------- two bodies + field, sector
def pair_sector(L, tf, b1, b2, cpl):
    cc = 1.0 if cpl == "c" else 0.0
    n = 4 * L * L
    ix = lambda s1, r, s2, y: ((s1 * L + r) * 2 + s2) * L + y
    H0 = np.zeros((n, n)); B1 = np.zeros((n, n)); V2 = np.zeros((n, n))
    for s1 in range(2):
        for r in range(L):
            for s2 in range(2):
                for y in range(L):
                    a = ix(s1, r, s2, y)
                    H0[a, a] += SG[s1] * b1["M"] * (1 + b1["gam"] * (y == 0)) \
                        + SG[s2] * b2["M"] * (1 + b2["gam"] * (y == r))
                    H0[ix(s1, r, s2, (y + 1) % L), a] += -tf
                    H0[ix(s1, r, s2, (y - 1) % L), a] += -tf
                    for t in range(2):
                        f = 1 + cc * b2["gam"] * 0.5 * ((y == r) + (y == (r + 1) % L))
                        V2[ix(s1, (r + 1) % L, t, y), a] += 0.5 * b2["tau"] * J[t, s2] * f
                        f = 1 + cc * b2["gam"] * 0.5 * ((y == (r - 1) % L) + (y == r))
                        V2[ix(s1, (r - 1) % L, t, y), a] += 0.5 * b2["tau"] * J[s2, t] * f
                        f = 1 + cc * b1["gam"] * 0.5 * ((y == 0) + (y == 1))
                        B1[ix(t, (r - 1) % L, s2, (y - 1) % L), a] += 0.5 * b1["tau"] * J[t, s1] * f
    return H0, B1, V2, ix


def pair_block(L, tf, b1, b2, cpl, par):
    """Restrict to the block of (-1)^r s1 s2 containing the band G (branches sig_i, r = par mod 2).
    Returns H0, B1, V2 on the block, the tau=0 eigenbasis U0 (block by block in (s1, r, s2)),
    its eigenvalues w0, the columns gi of U0 that form G (field ground, positive), and rs."""
    H0, B1, V2, ix = pair_sector(L, tf, b1, b2, cpl)
    pi0 = (-1) ** par * b1["sig"] * b2["sig"]
    trip = [(s1, r, s2) for s1 in range(2) for r in range(L) for s2 in range(2)
            if (-1) ** r * SG[s1] * SG[s2] == pi0]
    keep = np.array([ix(s1, r, s2, y) for (s1, r, s2) in trip for y in range(L)])
    sub = lambda A: A[np.ix_(keep, keep)]
    H0b, B1b, V2b = sub(H0), sub(B1), sub(V2)
    n = len(keep)
    U0 = np.zeros((n, n)); w0 = np.zeros(n)
    s1g, s2g = bidx(b1["sig"]), bidx(b2["sig"])
    rs, gi = [], []
    for t, (s1, r, s2) in enumerate(trip):
        sl = slice(t * L, (t + 1) * L)
        w, v = np.linalg.eigh(H0b[sl, sl])
        v[:, 0] *= np.sign(v[:, 0].sum())
        U0[sl, sl] = v; w0[sl] = w
        if (s1, s2) == (s1g, s2g):
            rs.append(r); gi.append(t * L)
    order = np.argsort(rs)
    rs = [rs[i] for i in order]; gi = np.array([gi[i] for i in order])
    return H0b, B1b, V2b, U0, w0, gi, rs


def band_contract(U0, w0, gi, V):
    """Second-order SW band contract on the G columns gi of the tau=0 eigenbasis U0."""
    mask = np.ones(len(w0), bool); mask[gi] = False
    Vgc = U0[:, gi].T @ V @ U0[:, mask]
    Ea, Ec = w0[gi], w0[mask]
    A = Vgc / (Ea[:, None] - Ec[None, :])
    Heff = np.diag(Ea).astype(complex) + 0.5 * (A @ Vgc.conj().T + Vgc @ A.conj().T)
    return Heff, Ea


def ell(r, L):
    r = np.mod(r, L)
    return (L * L - 1) / (12 * L) - r * (L - r) / (2 * L)


def band_data(L, tf, b1, b2, cpl, par, mode):
    """Band contract at order tau^2 at P = 0: relative level f, bonds b, kappa_i(rho), m(rho)."""
    H0, B1, V2, U0, w0, gi, rs = pair_block(L, tf, b1, b2, cpl, par)
    K1, _ = band_contract(U0, w0, gi, B1 + B1.T)
    K2, Ea = band_contract(U0, w0, gi, V2)
    K1 = (K1 - np.diag(Ea)).real; K2 = (K2 - np.diag(Ea)).real
    w, v = np.linalg.eigh(np.diag(Ea) + K1 + K2)
    k = 0 if mode == "low" else -1
    f = v[:, k]
    nr = len(rs)
    nb = lambda A: np.array([A[j, (j + 1) % nr] for j in range(nr)])  # bond (r_j, r_j + 2)
    k1, k2 = nb(K1), nb(K2)
    b = np.array([f[j] * f[(j + 1) % nr] for j in range(nr)])
    rho = np.array(rs) + 1
    return dict(H0=H0, B1=B1, V2=V2, U0=U0, w0=w0, gi=gi, rs=rs, K1=K1, K2=K2, Ea=Ea, f=f, eps=w[k],
                b=b, k1=k1, k2=k2, m=-1 / (8 * k1) - 1 / (8 * k2), rho=rho)


def mark_formula(L, tf, b1, b2, cpl, d1, d2, rho):
    """s_c (c1^-2 + c2^-2) Mbar2(rho), with M2(r) = -(2 n g1 g2 / t_f) ell(r) (quoted (4.3))."""
    n = 1.0 / L
    g1, g2 = b1["sig"] * b1["gam"] * b1["M"], b2["sig"] * b2["gam"] * b2["M"]
    M2 = lambda r: -(2 * n * g1 * g2 / tf) * ell(r, L)
    M2bar = 0.25 * (M2(rho + 1) + 2 * M2(rho) + M2(rho - 1))
    sc = 1.0 if cpl == "a" else -1.0
    return sc * (1 / d1["c2"] + 1 / d2["c2"]) * M2bar


def run_case(L, tf, b1, b2, cpl, par, mode):
    bd = band_data(L, tf, b1, b2, cpl, par, mode)
    H0, B1, V2, U0, gi = bd["H0"], bd["B1"], bd["V2"], bd["U0"], bd["gi"]
    G = U0[:, gi]
    # exact bound level and its curvature: H(P) = H0 + V2 + e^{-iP}B1 + e^{iP}B1^T (body 1 as representative)
    Eb, Ebpp, _, gw = curvature(H0 + V2, B1, G, mode)
    def lev(P):  # finite-difference cross-check of the continuation in P
        w, v = np.linalg.eigh(H0 + V2 + np.exp(-1j * P) * B1 + np.exp(1j * P) * B1.T)
        c = np.where((np.abs(G.T @ v) ** 2).sum(0) > 0.5)[0]
        return w[c].min() if mode == "low" else w[c].max()
    h = 2e-3
    Ebpp_fd = (lev(h) - 2 * lev(0.0) + lev(-h)) / h ** 2
    # curvature of the band-contract level on the ring (same continuation)
    def band_lev(P):
        hP, _ = band_contract(U0, bd["w0"], gi, np.exp(-1j * P) * B1 + np.exp(1j * P) * B1.T + V2)
        e = np.linalg.eigvalsh(hP)
        return e[0] if mode == "low" else e[-1]
    Epp_band = (band_lev(h) - 2 * band_lev(0.0) + band_lev(-h)) / h ** 2
    # (6.6): sum_rho b/m plus the ring term Phi'(0)^2 d^2 eps / dPhi^2
    b, m, k1, k2 = bd["b"], bd["m"], bd["k1"], bd["k2"]
    Epp_66 = np.sum(b / m)
    h0 = np.diag(bd["Ea"]) + bd["K1"] + bd["K2"]
    nr = len(bd["rs"])
    def eF(F):
        hF = h0.astype(complex); hF[nr - 1, 0] *= np.exp(1j * F); hF[0, nr - 1] *= np.exp(-1j * F)
        e = np.linalg.eigvalsh(hF)
        return e[0] if mode == "low" else e[-1]
    d2F = (eF(1e-2) - 2 * eF(0.0) + eF(-1e-2)) / 1e-4
    dPhi = -2 * np.sum(k1 / (k1 + k2))
    ring = dPhi ** 2 * d2F
    beta = b.sum()
    d1, d2 = body_data(L, tf, b1, cpl), body_data(L, tf, b2, cpl)
    mu, mub = d1["mu"] + d2["mu"], d1["mubar"] + d2["mubar"]
    Dmark = np.sum(b * mark_formula(L, tf, b1, b2, cpl, d1, d2, bd["rho"])) / beta ** 2
    Dlat = mu * (1 - beta) / beta
    dE = Eb - d1["E0"] - d2["E0"] + (-2 * tf)  # cost difference: pair - body 1 - body 2 + field alone
    n = 1.0 / L
    g1, g2 = b1["sig"] * b1["gam"] * b1["M"], b2["sig"] * b2["gam"] * b2["M"]
    return dict(L=L, coupling=cpl, parity=par, level=mode, Gweight=float(gw), Eb0=Eb,
                inv_Epp_exact=1 / Ebpp, inv_Epp_fd=1 / Ebpp_fd, inv_Epp_band_ring=1 / Epp_band,
                inv_Epp_66=1 / Epp_66, inv_Epp_66_plus_ring=1 / (Epp_66 + ring), ring_term_rel=ring / Epp_66,
                beta=beta, mu1=d1["mu"], mu2=d2["mu"], mu_sum=mu, mubar_sum=mub, mu_over_beta=mu / beta,
                rel_dev_band_ring_vs_exact=Ebpp / Epp_band - 1,
                rel_dev_66ring_vs_exact=Ebpp / (Epp_66 + ring) - 1,
                rel_dev_mu_over_beta_vs_exact=(mu / beta) * Ebpp - 1,
                D_exact=1 / Ebpp - mu, D_lat=Dlat, D_mark_formula=Dmark, D_lat_plus_mark=Dlat + Dmark,
                sigR_over_c2_mu=[b1["sig"] * d1["R"] / d1["c2"] / d1["mu"], b2["sig"] * d2["R"] / d2["c2"] / d2["mu"]],
                kappa_bar=[d1["kbar"], d2["kbar"]], chi=n * abs(g1 * g2) / tf / abs(d1["kbar"] + d2["kbar"]),
                participation=1 / np.sum(bd["f"] ** 4), dE_cost=dE,
                D_over_dE_times_c1sq=(1 / Ebpp - mu) * d1["c2"] / dE,
                D_over_dE_times_c2sq=(1 / Ebpp - mu) * d2["c2"] / dE)


def mark_check(L, tf, b1, b2, cpl, par, mode, scales=(1.0, 0.3, 0.1, 0.03)):
    """Ratio [m(rho) - mubar_1 - mubar_2] / [s_c (c1^-2+c2^-2) Mbar2(rho)] at the contact bonds, couplings scaled."""
    out = []
    for s in scales:
        c1, c2 = dict(b1), dict(b2)
        c1["gam"] *= s; c2["gam"] *= s
        bd = band_data(L, tf, c1, c2, cpl, par, mode)
        d1, d2 = body_data(L, tf, c1, cpl), body_data(L, tf, c2, cpl)
        num = bd["m"] - d1["mubar"] - d2["mubar"]
        pred = mark_formula(L, tf, c1, c2, cpl, d1, d2, bd["rho"])
        j = np.argsort(np.abs(((bd["rho"] + L // 2) % L) - L // 2))[:2]  # bonds nearest to contact
        out.append(dict(scale=s, coupling=cpl, ratio_contact=float(np.mean(num[j] / pred[j])),
                        ratio_all=[float(x) for x in num / pred]))
    return out


SETS = {  # (body 1, body 2, parity of r, extreme level); t_f = 1, M_i > 2 t_f so that R1 holds for sigma = +1
    "A": (dict(M=3.0, tau=0.20, gam=0.09, sig=+1), dict(M=4.0, tau=0.20, gam=0.07, sig=+1), 0, "low"),
    "B": (dict(M=2.5, tau=0.16, gam=0.10, sig=-1), dict(M=2.0, tau=0.20, gam=-0.14, sig=-1), 1, "high"),
}

if __name__ == "__main__":
    OUT.mkdir(exist_ok=True)
    tf = 1.0
    res = []
    for name, (b1, b2, par, mode) in SETS.items():
        for L in (12, 16):
            for cpl in ("a", "c"):
                r = run_case(L, tf, b1, b2, cpl, par, mode)
                r["set"] = name
                res.append(r)
    keys = ["set", "L", "coupling", "level", "chi", "beta", "inv_Epp_exact", "inv_Epp_fd", "inv_Epp_band_ring",
            "inv_Epp_66", "inv_Epp_66_plus_ring", "mu_sum", "mu_over_beta", "rel_dev_band_ring_vs_exact",
            "rel_dev_66ring_vs_exact", "rel_dev_mu_over_beta_vs_exact", "ring_term_rel", "D_exact", "D_lat",
            "D_mark_formula", "D_lat_plus_mark", "dE_cost", "D_over_dE_times_c1sq", "D_over_dE_times_c2sq"]
    fmt = lambda k, v: f"{k}={v:.6g}" if isinstance(v, (float, np.floating)) else f"{k}={v}"
    lines = ["  ".join(fmt(k, r[k]) for k in keys) for r in res]
    mk = []
    for cpl in ("a", "c"):
        b1, b2, par, mode = SETS["A"]
        mk += mark_check(12, tf, b1, b2, cpl, par, mode)
    lines.append("mark term check (set A, L=12): ratio of m(rho)-mubar_1-mubar_2 to the mark term of (6.7) at contact bonds")
    lines += [f"  coupling={x['coupling']} scale={x['scale']} ratio={x['ratio_contact']:.4f}" for x in mk]
    txt = "\n".join(lines)
    print(txt)
    (OUT / "inertia_check.txt").write_text(txt + "\n")
    conv = lambda o: o.tolist() if isinstance(o, np.ndarray) else float(o)
    (OUT / "inertia_check.json").write_text(json.dumps(dict(cases=res, mark_check=mk), indent=1, default=conv))
check_weight.py9 KB · raw
"""Check of item 4 of 07-ilang-weight/06-inertia-of-pair against exact eigenvalues with a held source.

Two Model D bodies and N_f = 1 field object on a ring of L places (set A of check_inertia.py),
plus a held source g_s Phi_{x_s}.  The exact contract (all places, no sector) is diagonalized near
the bottom of the bound band, where the bound pair sits in the weight well opposite the source.
Its levels are compared with the reduced description E_b(P) + W_nu(X) of Step 6 of the derivation
(E_b(P_k) exact sector levels at the allowed P_k, W_nu(X) the f_nu^2 average (6.11) of the exact
first-order weights of the held pair), and with the same description in which the pair band is
rescaled to the inertia mu_1 + mu_2 (the value that would make the fall factor equal to that of
the free bodies).
"""
import json
from pathlib import Path

import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as sla

from check_inertia import (OUT, J, SG, SETS, bidx, ground, field_hop, pair_block, band_data,
                           body_data, curvature)


def full_contract(L, tf, b1, b2, cpl, gs, xs, par):
    """Exact contract on all places, restricted to the block (-1)^(x2-x1) s1 s2 of the band G."""
    cc = 1.0 if cpl == "c" else 0.0
    ix = lambda x1, s1, x2, s2, y: (((x1 * 2 + s1) * L + x2) * 2 + s2) * L + y
    pi0 = (-1) ** par * b1["sig"] * b2["sig"]
    states = [(x1, s1, x2, s2, y) for x1 in range(L) for s1 in range(2) for x2 in range(L) for s2 in range(2)
              for y in range(L) if (-1) ** ((x2 - x1) % L) * SG[s1] * SG[s2] == pi0]
    pos = {ix(*s): i for i, s in enumerate(states)}
    rows, cols, vals = [], [], []
    def add(i, st, v):
        j = pos[ix(*st)]
        rows.append(j); cols.append(i); vals.append(v)
    for i, (x1, s1, x2, s2, y) in enumerate(states):
        add(i, (x1, s1, x2, s2, y), SG[s1] * b1["M"] * (1 + b1["gam"] * (y == x1))
            + SG[s2] * b2["M"] * (1 + b2["gam"] * (y == x2)) + gs * (y == xs))
        for dy in (1, -1):
            add(i, (x1, s1, x2, s2, (y + dy) % L), -tf)
        t1, t2 = 1 - s1, 1 - s2  # a motion term flips the branch (J has zero diagonal)
        for dx in (1, -1):
            # body hop x -> x+dx (bond between x and x+dx); J for right hops, J^T for left hops
            Jm = J[t1, s1] if dx == 1 else J[s1, t1]
            f = 1 + cc * b1["gam"] * 0.5 * ((y == x1) + (y == (x1 + dx) % L))
            add(i, ((x1 + dx) % L, t1, x2, s2, y), 0.5 * b1["tau"] * Jm * f)
            Jm = J[t2, s2] if dx == 1 else J[s2, t2]
            f = 1 + cc * b2["gam"] * 0.5 * ((y == x2) + (y == (x2 + dx) % L))
            add(i, (x1, s1, (x2 + dx) % L, t2, y), 0.5 * b2["tau"] * Jm * f)
    H = sp.csr_matrix((vals, (rows, cols)), shape=(len(states), len(states)))
    assert abs(H - H.T).max() < 1e-14
    return H, states, pos, ix


def sector_level(L, tf, b1, b2, cpl, par, mode, P):
    H0, B1, V2, U0, w0, gi, rs = pair_block(L, tf, b1, b2, cpl, par)
    G = U0[:, gi]
    w, v = np.linalg.eigh(H0 + V2 + np.exp(-1j * P) * B1 + np.exp(1j * P) * B1.T)
    c = np.where((np.abs(G.T @ v) ** 2).sum(0) > 0.5)[0]
    return w[c].min() if mode == "low" else w[c].max()


def run(L, tf, cpl, gs, nlev=4):
    b1, b2, par, mode = SETS["A"]
    xs = 0
    s1g, s2g = bidx(b1["sig"]), bidx(b2["sig"])
    # held weights (first order in g_s): W(j,l) = g_s |Omega_jl(x_s)|^2, single bodies W_i(x)
    hf = field_hop(L, tf)
    Om = {}
    Wpair = np.zeros((L, L))
    for j in range(L):
        for l in range(L):
            h = hf.copy(); h[j, j] += b1["sig"] * b1["gam"] * b1["M"]; h[l, l] += b2["sig"] * b2["gam"] * b2["M"]
            _, o = ground(h)
            Om[(j, l)] = o
            Wpair[j, l] = gs * o[xs] ** 2
    W1 = np.zeros(L); W2 = np.zeros(L)
    for x in range(L):
        h = hf.copy(); h[x, x] += b1["sig"] * b1["gam"] * b1["M"]; W1[x] = gs * ground(h)[1][xs] ** 2
        h = hf.copy(); h[x, x] += b2["sig"] * b2["gam"] * b2["M"]; W2[x] = gs * ground(h)[1][xs] ** 2
    # relative level f_nu (band contract, P = 0) and the pair weight W_nu(X), (6.11)
    bd = band_data(L, tf, b1, b2, cpl, par, mode)
    rsg = [((r + L // 2) % L) - L // 2 for r in bd["rs"]]  # signed separations
    Wnu = np.array([sum(bd["f"][k] ** 2 * Wpair[(X - r // 2) % L, (X + r // 2) % L] for k, r in enumerate(rsg))
                    for X in range(L)])
    # pair band at the allowed P_k (exact sector levels) and reduced description
    Ps = 2 * np.pi * np.arange(L) / L
    Eb = np.array([sector_level(L, tf, b1, b2, cpl, par, mode, P) for P in Ps])
    F = np.exp(1j * np.outer(np.arange(L), Ps)) / np.sqrt(L)  # <X|P_k>
    H0b, B1b, V2b = bd["H0"], bd["B1"], bd["V2"]
    _, Epp, _, _ = curvature(H0b + V2b, B1b, bd["U0"][:, bd["gi"]], mode)
    d1, d2 = body_data(L, tf, b1, cpl), body_data(L, tf, b2, cpl)
    mu = d1["mu"] + d2["mu"]
    s_free = 1 / (mu * Epp)  # rescales the band curvature to 1/(mu_1 + mu_2)
    def model(Eband):
        Hm = F @ np.diag(Eband) @ F.conj().T + np.diag(Wnu)
        return np.linalg.eigvalsh(Hm)[:nlev]
    Em = model(Eb)
    Ealt = model(Eb[0] + s_free * (Eb - Eb[0]))
    # exact contract with the source, levels near the bottom of the bound band, filtered by G-weight
    H, states, pos, ix = full_contract(L, tf, b1, b2, cpl, gs, xs, par)
    target = Em[0] - 0.3 * (Em[1] - Em[0])
    w, v = sla.eigsh(H, k=3 * nlev, sigma=target, which="LM")
    Gw = np.zeros(len(w))
    for (j, l), o in Om.items():
        if (l - j) % 2 != par:
            continue
        idx = [pos[ix(j, s1g, l, s2g, y)] for y in range(L)]
        Gw += np.abs(o @ v[idx, :]) ** 2
    ex = np.sort(w[Gw > 0.5])[:nlev]
    # fall factors at a place midway between the source and the well: Pi = E'' * (W(X+1)-W(X-1))/2
    X = L // 4
    dWnu = (Wnu[X + 1] - Wnu[X - 1]) / 2
    dW1, dW2 = (W1[X + 1] - W1[X - 1]) / 2, (W2[X + 1] - W2[X - 1]) / 2
    return dict(L=L, coupling=cpl, g_s=gs, exact_levels=ex.tolist(), model_levels=Em.tolist(),
                alt_levels=Ealt.tolist(), exact_spacings=np.diff(ex).tolist(), model_spacings=np.diff(Em).tolist(),
                alt_spacings=np.diff(Ealt).tolist(), beta=float(bd["b"].sum()), s_free=float(s_free),
                max_abs_dev_model=float(np.max(np.abs(ex - Em))), G_weights=np.sort(Gw)[::-1][:nlev].tolist(),
                dWnu_over_dW1_plus_dW2=float(dWnu / (dW1 + dW2)), Epp_times_mu_sum=float(Epp * mu),
                # Pi_pair / [(mu_1 Pi_1 + mu_2 Pi_2)/(mu_1+mu_2)] with Pi_i = dW_i / mu_i
                Pi_pair_over_weighted_single=float(Epp * dWnu * mu / (dW1 + dW2)))


def weight_ratio_scaling(L, tf, cpl, gs, scales=(1.0, 0.3, 0.1, 0.03)):
    """dW_nu/(dW_1+dW_2) at X = L/4 with the relative profile f_nu of set A kept fixed and the
    couplings gamma_i scaled: tends to 1 as the couplings go to zero (first order in g_i)."""
    b1, b2, par, mode = SETS["A"]
    bd = band_data(L, tf, b1, b2, cpl, par, mode)
    rsg = [((r + L // 2) % L) - L // 2 for r in bd["rs"]]
    hf, X, out = field_hop(L, tf), L // 4, []
    for sc in scales:
        g1 = sc * b1["sig"] * b1["gam"] * b1["M"]; g2 = sc * b2["sig"] * b2["gam"] * b2["M"]
        def w(pots):
            h = hf.copy()
            for x, g in pots:
                h[x % L, x % L] += g
            return gs * ground(h)[1][0] ** 2
        Wnu = lambda Y: sum(bd["f"][k] ** 2 * w([(Y - r // 2, g1), (Y + r // 2, g2)]) for k, r in enumerate(rsg))
        dWnu = Wnu(X + 1) - Wnu(X - 1)
        dWs = w([(X + 1, g1)]) - w([(X - 1, g1)]) + w([(X + 1, g2)]) - w([(X - 1, g2)])
        out.append(dict(scale=sc, ratio=float(dWnu / dWs)))
    return out


if __name__ == "__main__":
    OUT.mkdir(exist_ok=True)
    res = [run(L, 1.0, cpl, -0.01) for L in (16, 20) for cpl in ("a", "c")]
    res.append(run(16, 1.0, "a", -0.005))
    lines = []
    for r in res:
        lines.append(f"L={r['L']} coupling={r['coupling']} g_s={r['g_s']} beta={r['beta']:.5f} "
                     f"E''(mu1+mu2)={r['Epp_times_mu_sum']:.5f} s_free={r['s_free']:.5f}")
        lines.append("  exact spacings " + " ".join(f"{x:.6e}" for x in r["exact_spacings"]))
        lines.append("  model spacings " + " ".join(f"{x:.6e}" for x in r["model_spacings"]))
        lines.append("  alt   spacings " + " ".join(f"{x:.6e}" for x in r["alt_spacings"]))
        lines.append(f"  max |exact - model| level = {r['max_abs_dev_model']:.3e}   G-weights {np.round(r['G_weights'], 4).tolist()}")
        lines.append(f"  dW_nu/(dW_1+dW_2) = {r['dWnu_over_dW1_plus_dW2']:.5f}   "
                     f"Pi_pair / inertia-weighted Pi_i = {r['Pi_pair_over_weighted_single']:.5f}")
    sc = weight_ratio_scaling(16, 1.0, "a", -0.01)
    lines.append("dW_nu/(dW_1+dW_2) at X=L/4, L=16, f_nu of set A fixed, couplings scaled: "
                 + "  ".join(f"scale={x['scale']}: {x['ratio']:.5f}" for x in sc))
    txt = "\n".join(lines)
    print(txt)
    (OUT / "weight_check.txt").write_text(txt + "\n")
    (OUT / "weight_check.json").write_text(json.dumps(dict(cases=res, weight_ratio_scaling=sc), indent=1))
output/inertia_check.json12 KB · raw
{
 "cases": [
  {
   "L": 12,
   "coupling": "a",
   "parity": 0,
   "level": "low",
   "Gweight": 0.9997316819577194,
   "Eb0": 5.032130258807638,
   "inv_Epp_exact": 227.88034635627238,
   "inv_Epp_fd": 227.88103245814798,
   "inv_Epp_band_ring": 227.68333688928885,
   "inv_Epp_66": 254.73597240748586,
   "inv_Epp_66_plus_ring": 227.68286354416537,
   "ring_term_rel": 0.1188192578141604,
   "beta": 0.6931167961104955,
   "mu1": 75.90797762064429,
   "mu2": 101.11651860685852,
   "mu_sum": 177.02449622750282,
   "mubar_sum": 176.9974531366118,
   "mu_over_beta": 255.40355856458265,
   "rel_dev_band_ring_vs_exact": -0.0008645303122171155,
   "rel_dev_66ring_vs_exact": -0.000866607477409409,
   "rel_dev_mu_over_beta_vs_exact": 0.12077922755690373,
   "D_exact": 50.85585012876956,
   "D_lat": 78.37906233707983,
   "D_mark_formula": -0.4331611470836669,
   "D_lat_plus_mark": 77.94590118999616,
   "sigR_over_c2_mu": [
    0.9958662424874407,
    0.995076547674216
   ],
   "kappa_bar": [
    -0.0016470235800856714,
    -0.0012363632592047313
   ],
   "chi": 2.184930552554794,
   "participation": 1.8287817977065406,
   "dE_cost": -0.0035351408812820395,
   "D_over_dE_times_c1sq": -575.4322312645871,
   "D_over_dE_times_c2sq": -575.4322312645871,
   "set": "A"
  },
  {
   "L": 12,
   "coupling": "c",
   "parity": 0,
   "level": "low",
   "Gweight": 0.999732455709685,
   "Eb0": 5.032138864724078,
   "inv_Epp_exact": 224.66365495260808,
   "inv_Epp_fd": 224.66421971931516,
   "inv_Epp_band_ring": 224.48173094442217,
   "inv_Epp_66": 252.0198281430277,
   "inv_Epp_66_plus_ring": 224.48120987302204,
   "ring_term_rel": 0.12267671884690445,
   "beta": 0.6952051181791905,
   "mu1": 75.05362331484615,
   "mu2": 100.23769401409731,
   "mu_sum": 175.29131732894348,
   "mubar_sum": 175.27281742683454,
   "mu_over_beta": 252.143306694934,
   "rel_dev_band_ring_vs_exact": -0.0008097616333371249,
   "rel_dev_66ring_vs_exact": -0.0008120809733311862,
   "rel_dev_mu_over_beta_vs_exact": 0.12231462960986117,
   "D_exact": 49.372337623664606,
   "D_lat": 76.85198936599053,
   "D_mark_formula": 0.42524058386921865,
   "D_lat_plus_mark": 77.27722994985976,
   "sigR_over_c2_mu": [
    0.992262683825309,
    0.9921914590025449
   ],
   "kappa_bar": [
    -0.001665669539724246,
    -0.001247157480500305
   ],
   "chi": 2.1628472807541903,
   "participation": 1.8368603545145563,
   "dE_cost": -0.0035202097753757045,
   "D_over_dE_times_c1sq": -569.4626522836944,
   "D_over_dE_times_c2sq": -567.5801324070353,
   "set": "A"
  },
  {
   "L": 16,
   "coupling": "a",
   "parity": 0,
   "level": "low",
   "Gweight": 0.999816460689819,
   "Eb0": 5.021690174053908,
   "inv_Epp_exact": 215.78794724004405,
   "inv_Epp_fd": 215.78839565514255,
   "inv_Epp_band_ring": 215.58880206559022,
   "inv_Epp_66": 222.40514677342813,
   "inv_Epp_66_plus_ring": 215.58854245215807,
   "ring_term_rel": 0.031618583454094074,
   "beta": 0.7921296817355397,
   "mu1": 75.74297186313493,
   "mu2": 100.93194516097614,
   "mu_sum": 176.67491702411107,
   "mubar_sum": 176.62034422939382,
   "mu_over_beta": 223.03787005811978,
   "rel_dev_band_ring_vs_exact": -0.0009228744098126462,
   "rel_dev_66ring_vs_exact": -0.0009240775049598193,
   "rel_dev_mu_over_beta_vs_exact": 0.03359744096370165,
   "D_exact": 39.11303021593298,
   "D_lat": 46.36295303400871,
   "D_mark_formula": -0.44008065182471917,
   "D_lat_plus_mark": 45.92287238218399,
   "sigR_over_c2_mu": [
    0.9963290444466392,
    0.9955768224724135
   ],
   "kappa_bar": [
    -0.001650903997612696,
    -0.0012387981478858556
   ],
   "chi": 1.635116618285519,
   "participation": 2.405236029312165,
   "dE_cost": -0.0031284618691498345,
   "D_over_dE_times_c1sq": -500.09278491301575,
   "D_over_dE_times_c2sq": -500.09278491301575,
   "set": "A"
  },
  {
   "L": 16,
   "coupling": "c",
   "parity": 0,
   "level": "low",
   "Gweight": 0.9998168493739162,
   "Eb0": 5.021692962010054,
   "inv_Epp_exact": 214.41940921247726,
   "inv_Epp_fd": 214.41971397802288,
   "inv_Epp_band_ring": 214.22887954378967,
   "inv_Epp_66": 221.19575973886876,
   "inv_Epp_66_plus_ring": 214.2285383723253,
   "ring_term_rel": 0.03252237736148178,
   "beta": 0.7929028063341574,
   "mu1": 75.18830684938202,
   "mu2": 100.36442898611291,
   "mu_sum": 175.55273583549493,
   "mubar_sum": 175.50720764396937,
   "mu_over_beta": 221.40511350581696,
   "rel_dev_band_ring_vs_exact": -0.0008885840576996484,
   "rel_dev_66ring_vs_exact": -0.0008901751984720097,
   "rel_dev_mu_over_beta_vs_exact": 0.03257962662520564,
   "D_exact": 38.866673376982334,
   "D_lat": 45.85237767032203,
   "D_mark_formula": 0.43484136180731564,
   "D_lat_plus_mark": 46.28721903212934,
   "sigR_over_c2_mu": [
    0.9924821484649453,
    0.9925029681849555
   ],
   "kappa_bar": [
    -0.0016629753064722474,
    -0.001245755366233725
   ],
   "chi": 1.6244199039591263,
   "participation": 2.4107739764113174,
   "dE_cost": -0.0031214362607219215,
   "D_over_dE_times_c1sq": -503.68035654484606,
   "D_over_dE_times_c2sq": -502.4289772603999,
   "set": "A"
  },
  {
   "L": 12,
   "coupling": "a",
   "parity": 1,
   "level": "high",
   "Gweight": 0.9995810729459771,
   "Eb0": -6.505490483064844,
   "inv_Epp_exact": -182.8285720672684,
   "inv_Epp_fd": -182.828833832808,
   "inv_Epp_band_ring": -182.62016848331885,
   "inv_Epp_66": -193.47000047554596,
   "inv_Epp_66_plus_ring": -182.62000873150404,
   "ring_term_rel": 0.05941294067066898,
   "beta": 0.771790767958779,
   "mu1": -99.85857185583683,
   "mu2": -49.87389009551999,
   "mu_sum": -149.7324619513568,
   "mubar_sum": -149.746199291181,
   "mu_over_beta": -194.00654706892524,
   "rel_dev_band_ring_vs_exact": -0.0011398852028055018,
   "rel_dev_66ring_vs_exact": -0.001140758982067669,
   "rel_dev_mu_over_beta_vs_exact": 0.06113910356169128,
   "D_exact": -33.096110115911586,
   "D_lat": -44.274085117568426,
   "D_mark_formula": 0.48190240011250873,
   "D_lat_plus_mark": -43.792182717455916,
   "sigR_over_c2_mu": [
    0.9864888378890703,
    0.9901237633012977
   ],
   "kappa_bar": [
    0.0012516859871103403,
    0.0025059693904114777
   ],
   "chi": 1.5523864610438092,
   "participation": 2.4559544957387773,
   "dE_cost": 0.003643342813780759,
   "D_over_dE_times_c1sq": -232.55028754434449,
   "D_over_dE_times_c2sq": -363.35982428803834,
   "set": "B"
  },
  {
   "L": 12,
   "coupling": "c",
   "parity": 1,
   "level": "high",
   "Gweight": 0.9995800204607646,
   "Eb0": -6.505490360608185,
   "inv_Epp_exact": -182.0593171386413,
   "inv_Epp_fd": -182.05968997662993,
   "inv_Epp_band_ring": -181.86130870739612,
   "inv_Epp_66": -193.07892987459823,
   "inv_Epp_66_plus_ring": -181.8611116688006,
   "ring_term_rel": 0.06168343579812249,
   "beta": 0.7706027801413127,
   "mu1": -97.67360233823084,
   "mu2": -50.76503752675799,
   "mu_sum": -148.43863986498883,
   "mubar_sum": -148.46534641516735,
   "mu_over_beta": -192.62666018122624,
   "rel_dev_band_ring_vs_exact": -0.001087603943358606,
   "rel_dev_66ring_vs_exact": -0.001088686220270585,
   "rel_dev_mu_over_beta_vs_exact": 0.05804340699870769,
   "D_exact": -33.62067727365246,
   "D_lat": -44.18802031623741,
   "D_mark_formula": -0.48341759585822763,
   "D_lat_plus_mark": -44.67143791209564,
   "sigR_over_c2_mu": [
    0.9919552316531385,
    0.995843585367303
   ],
   "kappa_bar": [
    0.0012796045392062805,
    0.0024616516119971843
   ],
   "chi": 1.5591911105730898,
   "participation": 2.4506167651486175,
   "dE_cost": 0.003657444962462897,
   "D_over_dE_times_c1sq": -239.2637318081684,
   "D_over_dE_times_c2sq": -359.1662626639685,
   "set": "B"
  },
  {
   "L": 16,
   "coupling": "a",
   "parity": 1,
   "level": "high",
   "Gweight": 0.9995765501785667,
   "Eb0": -6.504825702831682,
   "inv_Epp_exact": -191.46218501500888,
   "inv_Epp_fd": -191.46244857052312,
   "inv_Epp_band_ring": -191.16537229626985,
   "inv_Epp_66": -192.3813854854839,
   "inv_Epp_66_plus_ring": -191.16523028819273,
   "ring_term_rel": 0.006361801230577977,
   "beta": 0.7769150844767718,
   "mu1": -99.95797709170733,
   "mu2": -49.998807187789545,
   "mu_sum": -149.95678427949687,
   "mubar_sum": -150.00619295223643,
   "mu_over_beta": -193.01566834744636,
   "rel_dev_band_ring_vs_exact": -0.0015502419901650688,
   "rel_dev_66ring_vs_exact": -0.0015509836931656418,
   "rel_dev_mu_over_beta_vs_exact": 0.008113786711019255,
   "D_exact": -41.50540073551201,
   "D_lat": -43.058884067949506,
   "D_mark_formula": 0.5789261124716636,
   "D_lat_plus_mark": -42.47995795547784,
   "sigR_over_c2_mu": [
    0.9836133378339756,
    0.9903135201746899
   ],
   "kappa_bar": [
    0.0012501676429936825,
    0.002499020254445816
   ],
   "chi": 1.166919375523403,
   "participation": 2.497592091002249,
   "dE_cost": 0.005099135048515446,
   "D_over_dE_times_c1sq": -208.37617531593972,
   "D_over_dE_times_c2sq": -325.58777393115594,
   "set": "B"
  },
  {
   "L": 16,
   "coupling": "c",
   "parity": 1,
   "level": "high",
   "Gweight": 0.9995742688449692,
   "Eb0": -6.50482719249405,
   "inv_Epp_exact": -191.06117755426297,
   "inv_Epp_fd": -191.06128824473632,
   "inv_Epp_band_ring": -190.77335768128833,
   "inv_Epp_66": -192.02986899241878,
   "inv_Epp_66_plus_ring": -190.7732008995874,
   "ring_term_rel": 0.0065872359791918945,
   "beta": 0.776063229538808,
   "mu1": -98.0089247080907,
   "mu2": -50.56954923883919,
   "mu_sum": -148.57847394692988,
   "mubar_sum": -148.64382375019335,
   "mu_over_beta": -191.4515058717906,
   "rel_dev_band_ring_vs_exact": -0.001506427818874334,
   "rel_dev_66ring_vs_exact": -0.0015072484026420474,
   "rel_dev_mu_over_beta_vs_exact": 0.0020429493972775603,
   "D_exact": -42.48270360733309,
   "D_lat": -42.87303192486072,
   "D_mark_formula": -0.5798688326182984,
   "D_lat_plus_mark": -43.452900757479014,
   "sigR_over_c2_mu": [
    0.9907508565137257,
    0.9964990034084412
   ],
   "kappa_bar": [
    0.001274912757096569,
    0.002470458299554501
   ],
   "chi": 1.1681085622293226,
   "participation": 2.4932159287747515,
   "dE_cost": 0.0051087735018979785,
   "D_over_dE_times_c1sq": -215.54961475519963,
   "D_over_dE_times_c2sq": -326.8299826617234,
   "set": "B"
  }
 ],
 "mark_check": [
  {
   "scale": 1.0,
   "coupling": "a",
   "ratio_contact": 1.400643091214988,
   "ratio_all": [
    1.400643091215232,
    -1.0654491181891712,
    2.2191205421886404,
    2.2191205421886404,
    -1.0654491181879528,
    1.4006430912147445
   ]
  },
  {
   "scale": 0.3,
   "coupling": "a",
   "ratio_contact": 1.3096894943591075,
   "ratio_all": [
    1.3096894943595587,
    0.4419096256653923,
    1.479130018902239,
    1.4791300189123895,
    0.4419096256924606,
    1.3096894943586563
   ]
  },
  {
   "scale": 0.1,
   "coupling": "a",
   "ratio_contact": 1.1320744440622226,
   "ratio_all": [
    1.1320744440662829,
    0.8407940132672468,
    1.171640696741504,
    1.1716406967415038,
    0.8407940133078493,
    1.1320744440581623
   ]
  },
  {
   "scale": 0.03,
   "coupling": "a",
   "ratio_contact": 1.0430236745237598,
   "ratio_all": [
    1.043023674704215,
    0.9559654934885242,
    1.0527707309231507,
    1.0527707310359349,
    0.9559654894282803,
    1.0430236743433043
   ]
  },
  {
   "scale": 1.0,
   "coupling": "c",
   "ratio_contact": -0.19056787784403584,
   "ratio_all": [
    -0.19056787784424156,
    1.5887107674244416,
    -0.7052324599387076,
    -0.7052324599386048,
    1.5887107674227956,
    -0.1905678778438301
   ]
  },
  {
   "scale": 0.3,
   "coupling": "c",
   "ratio_contact": 0.4155385432571559,
   "ratio_all": [
    0.4155385432571559,
    0.9827657101385622,
    0.3571010765738784,
    0.3571010765648195,
    0.9827657101023267,
    0.41553854325715595
   ]
  },
  {
   "scale": 0.1,
   "coupling": "c",
   "ratio_contact": 0.7735589554865692,
   "ratio_all": [
    0.7735589554987662,
    0.9527168902945641,
    0.7719115104531558,
    0.7719115104328275,
    0.9527168903352207,
    0.7735589554743723
   ]
  },
  {
   "scale": 0.03,
   "coupling": "c",
   "ratio_contact": 0.9284338858640722,
   "ratio_all": [
    0.9284338857286766,
    0.9804823779364585,
    0.9300956041252701,
    0.9300956040124403,
    0.9804823824496459,
    0.9284338859994677
   ]
  }
 ]
}
output/inertia_check.txt5 KB · raw
set=A  L=12  coupling=a  level=low  chi=2.18493  beta=0.693117  inv_Epp_exact=227.88  inv_Epp_fd=227.881  inv_Epp_band_ring=227.683  inv_Epp_66=254.736  inv_Epp_66_plus_ring=227.683  mu_sum=177.024  mu_over_beta=255.404  rel_dev_band_ring_vs_exact=-0.00086453  rel_dev_66ring_vs_exact=-0.000866607  rel_dev_mu_over_beta_vs_exact=0.120779  ring_term_rel=0.118819  D_exact=50.8559  D_lat=78.3791  D_mark_formula=-0.433161  D_lat_plus_mark=77.9459  dE_cost=-0.00353514  D_over_dE_times_c1sq=-575.432  D_over_dE_times_c2sq=-575.432
set=A  L=12  coupling=c  level=low  chi=2.16285  beta=0.695205  inv_Epp_exact=224.664  inv_Epp_fd=224.664  inv_Epp_band_ring=224.482  inv_Epp_66=252.02  inv_Epp_66_plus_ring=224.481  mu_sum=175.291  mu_over_beta=252.143  rel_dev_band_ring_vs_exact=-0.000809762  rel_dev_66ring_vs_exact=-0.000812081  rel_dev_mu_over_beta_vs_exact=0.122315  ring_term_rel=0.122677  D_exact=49.3723  D_lat=76.852  D_mark_formula=0.425241  D_lat_plus_mark=77.2772  dE_cost=-0.00352021  D_over_dE_times_c1sq=-569.463  D_over_dE_times_c2sq=-567.58
set=A  L=16  coupling=a  level=low  chi=1.63512  beta=0.79213  inv_Epp_exact=215.788  inv_Epp_fd=215.788  inv_Epp_band_ring=215.589  inv_Epp_66=222.405  inv_Epp_66_plus_ring=215.589  mu_sum=176.675  mu_over_beta=223.038  rel_dev_band_ring_vs_exact=-0.000922874  rel_dev_66ring_vs_exact=-0.000924078  rel_dev_mu_over_beta_vs_exact=0.0335974  ring_term_rel=0.0316186  D_exact=39.113  D_lat=46.363  D_mark_formula=-0.440081  D_lat_plus_mark=45.9229  dE_cost=-0.00312846  D_over_dE_times_c1sq=-500.093  D_over_dE_times_c2sq=-500.093
set=A  L=16  coupling=c  level=low  chi=1.62442  beta=0.792903  inv_Epp_exact=214.419  inv_Epp_fd=214.42  inv_Epp_band_ring=214.229  inv_Epp_66=221.196  inv_Epp_66_plus_ring=214.229  mu_sum=175.553  mu_over_beta=221.405  rel_dev_band_ring_vs_exact=-0.000888584  rel_dev_66ring_vs_exact=-0.000890175  rel_dev_mu_over_beta_vs_exact=0.0325796  ring_term_rel=0.0325224  D_exact=38.8667  D_lat=45.8524  D_mark_formula=0.434841  D_lat_plus_mark=46.2872  dE_cost=-0.00312144  D_over_dE_times_c1sq=-503.68  D_over_dE_times_c2sq=-502.429
set=B  L=12  coupling=a  level=high  chi=1.55239  beta=0.771791  inv_Epp_exact=-182.829  inv_Epp_fd=-182.829  inv_Epp_band_ring=-182.62  inv_Epp_66=-193.47  inv_Epp_66_plus_ring=-182.62  mu_sum=-149.732  mu_over_beta=-194.007  rel_dev_band_ring_vs_exact=-0.00113989  rel_dev_66ring_vs_exact=-0.00114076  rel_dev_mu_over_beta_vs_exact=0.0611391  ring_term_rel=0.0594129  D_exact=-33.0961  D_lat=-44.2741  D_mark_formula=0.481902  D_lat_plus_mark=-43.7922  dE_cost=0.00364334  D_over_dE_times_c1sq=-232.55  D_over_dE_times_c2sq=-363.36
set=B  L=12  coupling=c  level=high  chi=1.55919  beta=0.770603  inv_Epp_exact=-182.059  inv_Epp_fd=-182.06  inv_Epp_band_ring=-181.861  inv_Epp_66=-193.079  inv_Epp_66_plus_ring=-181.861  mu_sum=-148.439  mu_over_beta=-192.627  rel_dev_band_ring_vs_exact=-0.0010876  rel_dev_66ring_vs_exact=-0.00108869  rel_dev_mu_over_beta_vs_exact=0.0580434  ring_term_rel=0.0616834  D_exact=-33.6207  D_lat=-44.188  D_mark_formula=-0.483418  D_lat_plus_mark=-44.6714  dE_cost=0.00365744  D_over_dE_times_c1sq=-239.264  D_over_dE_times_c2sq=-359.166
set=B  L=16  coupling=a  level=high  chi=1.16692  beta=0.776915  inv_Epp_exact=-191.462  inv_Epp_fd=-191.462  inv_Epp_band_ring=-191.165  inv_Epp_66=-192.381  inv_Epp_66_plus_ring=-191.165  mu_sum=-149.957  mu_over_beta=-193.016  rel_dev_band_ring_vs_exact=-0.00155024  rel_dev_66ring_vs_exact=-0.00155098  rel_dev_mu_over_beta_vs_exact=0.00811379  ring_term_rel=0.0063618  D_exact=-41.5054  D_lat=-43.0589  D_mark_formula=0.578926  D_lat_plus_mark=-42.48  dE_cost=0.00509914  D_over_dE_times_c1sq=-208.376  D_over_dE_times_c2sq=-325.588
set=B  L=16  coupling=c  level=high  chi=1.16811  beta=0.776063  inv_Epp_exact=-191.061  inv_Epp_fd=-191.061  inv_Epp_band_ring=-190.773  inv_Epp_66=-192.03  inv_Epp_66_plus_ring=-190.773  mu_sum=-148.578  mu_over_beta=-191.452  rel_dev_band_ring_vs_exact=-0.00150643  rel_dev_66ring_vs_exact=-0.00150725  rel_dev_mu_over_beta_vs_exact=0.00204295  ring_term_rel=0.00658724  D_exact=-42.4827  D_lat=-42.873  D_mark_formula=-0.579869  D_lat_plus_mark=-43.4529  dE_cost=0.00510877  D_over_dE_times_c1sq=-215.55  D_over_dE_times_c2sq=-326.83
mark term check (set A, L=12): ratio of m(rho)-mubar_1-mubar_2 to the mark term of (6.7) at contact bonds
  coupling=a scale=1.0 ratio=1.4006
  coupling=a scale=0.3 ratio=1.3097
  coupling=a scale=0.1 ratio=1.1321
  coupling=a scale=0.03 ratio=1.0430
  coupling=c scale=1.0 ratio=-0.1906
  coupling=c scale=0.3 ratio=0.4155
  coupling=c scale=0.1 ratio=0.7736
  coupling=c scale=0.03 ratio=0.9284
output/weight_check.json6 KB · raw
{
 "cases": [
  {
   "L": 16,
   "coupling": "a",
   "g_s": -0.01,
   "exact_levels": [
    5.020932168593384,
    5.020932866817886,
    5.021348684865307,
    5.021348858838961
   ],
   "model_levels": [
    5.020942215972731,
    5.020942284482317,
    5.021357976664915,
    5.021358196156728
   ],
   "alt_levels": [
    5.020956775622159,
    5.020956886631699,
    5.021438226426289,
    5.0214384977549305
   ],
   "exact_spacings": [
    6.98224502215794e-07,
    0.00041581804742119033,
    1.7397365414950627e-07
   ],
   "model_spacings": [
    6.85095855601503e-08,
    0.00041569218259862595,
    2.1949181316927024e-07
   ],
   "alt_spacings": [
    1.1100953933862456e-07,
    0.00048133979459041853,
    2.7132864133250223e-07
   ],
   "beta": 0.7921296817355397,
   "s_free": 1.2213841719851786,
   "max_abs_dev_model": 1.004737934717781e-05,
   "G_weights": [
    0.9997602972025625,
    0.9997599923946251,
    0.9997345898016348,
    0.9997339105019545
   ],
   "dWnu_over_dW1_plus_dW2": 0.8656428389973512,
   "Epp_times_mu_sum": 0.8187432119532452,
   "Pi_pair_over_weighted_single": 0.7087391984050172
  },
  {
   "L": 16,
   "coupling": "c",
   "g_s": -0.01,
   "exact_levels": [
    5.0209353284530325,
    5.0209360355981385,
    5.021353540895545,
    5.021353716611133
   ],
   "model_levels": [
    5.020945405410213,
    5.020945474392154,
    5.021362851892422,
    5.021363071511625
   ],
   "alt_levels": [
    5.020959959943978,
    5.020960071495647,
    5.021443512569125,
    5.0214437837981345
   ],
   "exact_spacings": [
    7.071451060269851e-07,
    0.000417505297406251,
    1.757155878578942e-07
   ],
   "model_spacings": [
    6.898194104820732e-08,
    0.00041737750026804576,
    2.19619202823651e-07
   ],
   "alt_spacings": [
    1.115516692351548e-07,
    0.0004834410734773087,
    2.7122900991827237e-07
   ],
   "beta": 0.7929028063341574,
   "s_free": 1.2213959992819654,
   "max_abs_dev_model": 1.0076957180693569e-05,
   "G_weights": [
    0.9997605718416233,
    0.9997602644345301,
    0.9997347518875979,
    0.9997340780882467
   ],
   "dWnu_over_dW1_plus_dW2": 0.8658049959093594,
   "Epp_times_mu_sum": 0.8187352837146021,
   "Pi_pair_over_weighted_single": 0.7088650989673692
  },
  {
   "L": 20,
   "coupling": "a",
   "g_s": -0.01,
   "exact_levels": [
    5.015064543640122,
    5.0150647309652205,
    5.015384163929676,
    5.015384297038561
   ],
   "model_levels": [
    5.015074865280838,
    5.015074871242767,
    5.015393773958746,
    5.015393802894462
   ],
   "alt_levels": [
    5.015084908535669,
    5.015084917893332,
    5.015436261412303,
    5.015436296959991
   ],
   "exact_spacings": [
    1.8732509854402224e-07,
    0.00031943296445557934,
    1.331088848033346e-07
   ],
   "model_spacings": [
    5.96192872848178e-09,
    0.00031890271597934117,
    2.8935715157274444e-08
   ],
   "alt_spacings": [
    9.357663088849222e-09,
    0.00035134351897081473,
    3.554768834845845e-08
   ],
   "beta": 0.8502728307228149,
   "s_free": 1.162770654893976,
   "max_abs_dev_model": 1.0321640716348668e-05,
   "G_weights": [
    0.9997905069459917,
    0.9997899420588179,
    0.9997873770113694,
    0.9997872814839026
   ],
   "dWnu_over_dW1_plus_dW2": 0.8424523396756401,
   "Epp_times_mu_sum": 0.8600148238959318,
   "Pi_pair_over_weighted_single": 0.7245215005468614
  },
  {
   "L": 20,
   "coupling": "c",
   "g_s": -0.01,
   "exact_levels": [
    5.015065642557445,
    5.015065831536634,
    5.015385938235243,
    5.015386072033107
   ],
   "model_levels": [
    5.015075974154089,
    5.0150759801326625,
    5.015395555604398,
    5.015395584510388
   ],
   "alt_levels": [
    5.015086083848021,
    5.0150860932488905,
    5.015438439076667,
    5.015438474608169
   ],
   "exact_spacings": [
    1.8897918874216657e-07,
    0.00032010669860849106,
    1.3379786434342122e-07
   ],
   "model_spacings": [
    5.9785731920669605e-09,
    0.00031957547173533385,
    2.890599049010234e-08
   ],
   "alt_spacings": [
    9.400869416253954e-09,
    0.00035234582777654566,
    3.5531502184937835e-08
   ],
   "beta": 0.8506133722261092,
   "s_free": 1.1638485453374348,
   "max_abs_dev_model": 1.033159664398653e-05,
   "G_weights": [
    0.9997906825993009,
    0.9997901237475735,
    0.9997875511506646,
    0.9997874554038565
   ],
   "dWnu_over_dW1_plus_dW2": 0.842555458701851,
   "Epp_times_mu_sum": 0.8592183269946605,
   "Pi_pair_over_weighted_single": 0.7239390916260231
  },
  {
   "L": 16,
   "coupling": "a",
   "g_s": -0.005,
   "exact_levels": [
    5.021337220583934,
    5.021338354037674,
    5.021698984036591,
    5.021699076097222
   ],
   "model_levels": [
    5.021340034760037,
    5.021340172356756,
    5.021701270660474,
    5.021701466128361
   ],
   "alt_levels": [
    5.021345790940913,
    5.021345970406665,
    5.021778015067023,
    5.02177823154431
   ],
   "exact_spacings": [
    1.1334537397544864e-06,
    0.0003606299989167283,
    9.206063111832918e-08
   ],
   "model_spacings": [
    1.3759671890767322e-07,
    0.0003610983037178883,
    1.954678872095883e-07
   ],
   "alt_spacings": [
    1.7946575248117824e-07,
    0.00043204466035717815,
    2.1647728765117336e-07
   ],
   "beta": 0.7921296817355397,
   "s_free": 1.2213841719851786,
   "max_abs_dev_model": 2.8141761028166457e-06,
   "G_weights": [
    0.999800413265556,
    0.9998001375439844,
    0.9997523563835973,
    0.9997521759539569
   ],
   "dWnu_over_dW1_plus_dW2": 0.8656428389973512,
   "Epp_times_mu_sum": 0.8187432119532452,
   "Pi_pair_over_weighted_single": 0.7087391984050172
  }
 ],
 "weight_ratio_scaling": [
  {
   "scale": 1.0,
   "ratio": 0.8656428389973512
  },
  {
   "scale": 0.3,
   "ratio": 0.9615780236142013
  },
  {
   "scale": 0.1,
   "ratio": 0.9884318366569272
  },
  {
   "scale": 0.03,
   "ratio": 0.9965462956127407
  }
 ]
}
output/weight_check.txt2 KB · raw
L=16 coupling=a g_s=-0.01 beta=0.79213 E''(mu1+mu2)=0.81874 s_free=1.22138
  exact spacings 6.982245e-07 4.158180e-04 1.739737e-07
  model spacings 6.850959e-08 4.156922e-04 2.194918e-07
  alt   spacings 1.110095e-07 4.813398e-04 2.713286e-07
  max |exact - model| level = 1.005e-05   G-weights [0.9998, 0.9998, 0.9997, 0.9997]
  dW_nu/(dW_1+dW_2) = 0.86564   Pi_pair / inertia-weighted Pi_i = 0.70874
L=16 coupling=c g_s=-0.01 beta=0.79290 E''(mu1+mu2)=0.81874 s_free=1.22140
  exact spacings 7.071451e-07 4.175053e-04 1.757156e-07
  model spacings 6.898194e-08 4.173775e-04 2.196192e-07
  alt   spacings 1.115517e-07 4.834411e-04 2.712290e-07
  max |exact - model| level = 1.008e-05   G-weights [0.9998, 0.9998, 0.9997, 0.9997]
  dW_nu/(dW_1+dW_2) = 0.86580   Pi_pair / inertia-weighted Pi_i = 0.70887
L=20 coupling=a g_s=-0.01 beta=0.85027 E''(mu1+mu2)=0.86001 s_free=1.16277
  exact spacings 1.873251e-07 3.194330e-04 1.331089e-07
  model spacings 5.961929e-09 3.189027e-04 2.893572e-08
  alt   spacings 9.357663e-09 3.513435e-04 3.554769e-08
  max |exact - model| level = 1.032e-05   G-weights [0.9998, 0.9998, 0.9998, 0.9998]
  dW_nu/(dW_1+dW_2) = 0.84245   Pi_pair / inertia-weighted Pi_i = 0.72452
L=20 coupling=c g_s=-0.01 beta=0.85061 E''(mu1+mu2)=0.85922 s_free=1.16385
  exact spacings 1.889792e-07 3.201067e-04 1.337979e-07
  model spacings 5.978573e-09 3.195755e-04 2.890599e-08
  alt   spacings 9.400869e-09 3.523458e-04 3.553150e-08
  max |exact - model| level = 1.033e-05   G-weights [0.9998, 0.9998, 0.9998, 0.9998]
  dW_nu/(dW_1+dW_2) = 0.84256   Pi_pair / inertia-weighted Pi_i = 0.72394
L=16 coupling=a g_s=-0.005 beta=0.79213 E''(mu1+mu2)=0.81874 s_free=1.22138
  exact spacings 1.133454e-06 3.606300e-04 9.206063e-08
  model spacings 1.375967e-07 3.610983e-04 1.954679e-07
  alt   spacings 1.794658e-07 4.320447e-04 2.164773e-07
  max |exact - model| level = 2.814e-06   G-weights [0.9998, 0.9998, 0.9998, 0.9998]
  dW_nu/(dW_1+dW_2) = 0.86564   Pi_pair / inertia-weighted Pi_i = 0.70874
dW_nu/(dW_1+dW_2) at X=L/4, L=16, f_nu of set A fixed, couplings scaled: scale=1.0: 0.86564  scale=0.3: 0.96158  scale=0.1: 0.98843  scale=0.03: 0.99655

Interested in this research?

Join the readers' list and get an e-mail when a new stage or a correction is published. No password, and you can unsubscribe at any time.