"""lambda needed at given mode energies, megabar efficiencies from the tables of Quan et al., Allen-Dynes checks of their rows, and requirement ranges. Used in the section on what 300 K costs. Run with the project environment: .venv/bin/python numerics/derived/pairing_megabar.py The printed output is stored beside this file as pairing_megabar.out.txt. """ import pathlib import sys, math sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from eliashberg import tc, allen_dynes from scipy.optimize import brentq K=11.6045; MH=1.7904 for w in (113,130,158,160,163,100,150,200): lam=brentq(lambda l: tc([(l,1.0)],0.13,10.0)-300/(w*K),0.8,8) print(w,'meV -> lambda',round(lam,2)) # Quan megabar rows: Allen-Dynes mu*=0.13 total rows check, and Phi (H-only Tc / asymptote) rows=[('MgH6',300,13.5,280),('YH10',300,13.4,270),('SH3',220,10.1,222),('LaH10',250,8.9,217),('CaH6',150,6.7,204)] for n,p,eta,t in rows: asy=136.54*math.sqrt(eta) print(n,p,eta,'asym',round(asy),'Phi',round(t/asy,3),'eta for 300K',round(eta*(300/t)**2,1)) # total rows Allen-Dynes check for CaH6 150 and 300 GPa and SH3 for n,lam,wl,w2,t in [('CaH6 150',2.53,1044.4,1218.5,200),('CaH6 300',1.59,1415.8,1763.9,175),('SH3 220',2.08,1415.8,1671.1,229),('SH3 280',1.61,1589.8,1938.0,199),('LaH10 250',2.46,1067.6,1415.8,206),('LaH10 300',1.8,1334.5,1682.7,189)]: print(n,'AD(0.13)=',round(allen_dynes(lam,wl,w2,0.13),1),'printed',t,'k=M w2^2',round(MH*(w2/1000)**2,2),'S',round(lam*MH*(w2/1000)**2,2)) # requirement ranges for phi in (0.35,0.52,0.51,0.58,0.21,0.41): print('Phi',phi,'eta300',round((300/(136.54*phi))**2,1)) # shortfall for a in (1.6,5.2,0.42): print(a, 8.7/a, 12.0/a) # two-mode S print('S two-mode', 2*2.411e-4*150**2, 2*2.411e-4*15**2) # asymptotes for table for e in (13.5,13.4,10.1,8.9,6.7,2.3,3.7,5.2,3.6,2.9,2.2,2.7,1.9,2.0,1.6,0.42): print(e, round(136.54*math.sqrt(e)))