"""Monotonic fall of the response per unit S with frequency, and finite transfers of 10% of S. Used in the section on what 300 K costs. Run with the project environment: .venv/bin/python numerics/derived/pairing_transfer.py The printed output is stored beside this file as pairing_transfer.out.txt. """ import pathlib import sys, math sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) import numpy as np from eliashberg import tc, functional_derivative t0, fd = functional_derivative([(2.0,1.0)],0.13,np.arange(0.03,3.0,0.01)) r=[d['dtc_dalpha2f']/(2*d['omega_over_tc']*t0) for d in fd] x=[d['omega_over_tc'] for d in fd] mono=all(r[i+1]<=r[i]*(1+1e-4) for i in range(len(r)-1)) print('monotone decreasing per-S from',x[0],'to',x[-1],':',mono, 'first', r[0], 'max idx', int(np.argmax(r)), x[int(np.argmax(r))]) # finite transfer of 10% of S lam=2.0; S=lam*1.0 base=tc([(lam,1.0)],0.13,10.0) for xk in (2,13): om=xk*base # move 10% of S to frequency om l1=0.9*lam; l2=0.1*S/om**2 wmax=max(1.0,om) t=tc([(l1,1.0),(l2,om)],0.13,10.0/wmax if wmax>1 else 10.0) print('move 10% S to',xk,'kTc:', (t/base-1)*100) # lambda*hbar*omega_E per row K=11.6045 for l in (1,1.5,2,2.5,3,4,5): f=tc([(l,1.0)],0.13,10.0); wE=300/f/K print(l, round(l*wE))