adds general find_gap function for arbitrary mu_star
All checks were successful
gitea-physics/pysuperconductor/pipeline/head This commit looks good

This commit is contained in:
Deepak Mallubhotla 2020-11-22 19:13:54 -06:00
parent 8455e4f982
commit aea431cd2d
Signed by: deepak
GPG Key ID: 64BF53A3369104E7
2 changed files with 14 additions and 1 deletions

View File

@ -24,9 +24,13 @@ def gap_integral(temp, delta, mu_star, debye_frequency):
def equilibrium_gap(temp, debye_frequency, nv):
return find_gap(temp, 0, debye_frequency, nv)
def find_gap(temp, mu_star, debye_frequency, nv):
nv_inv = 1 / nv
sol = scipy.optimize.root(
lambda d: gap_integral(temp, d, 0, debye_frequency) - nv_inv,
lambda d: gap_integral(temp, d, mu_star, debye_frequency) - nv_inv,
x0=debye_frequency / (numpy.sinh(nv_inv))
)
logging.info(sol)

View File

@ -37,3 +37,12 @@ def test_equilibrium_gap_zero_temp():
decimal=7, err_msg='gap finding at zero temp equilibrium is wrong',
verbose=True
)
def test_gap():
actual = pysuperconductor.os_gap_calc.find_gap(.5, .1, 100, .2)
numpy.testing.assert_almost_equal(
actual, 1.108996409216592,
decimal=7, err_msg='had trouble with gap at non-zero temp and mustar',
verbose=True
)