adds n integral and tests for warnings for overflows
All checks were successful
gitea-physics/pysuperconductor/pipeline/head This commit looks good
All checks were successful
gitea-physics/pysuperconductor/pipeline/head This commit looks good
This commit is contained in:
parent
abe17baaf1
commit
85968f881f
@ -35,8 +35,19 @@ def find_gap(temp, mu_star, debye_frequency, nv):
|
||||
return sol.x
|
||||
|
||||
|
||||
# this is n * Delta_0, calling it n in this file for brevity
|
||||
def n_integrand_function(xi, temp, delta, mu_star):
|
||||
big_e = energy(xi, delta)
|
||||
left = 1 / (1 + numpy.exp((big_e - mu_star) / temp))
|
||||
right = 1 / (1 + numpy.exp(big_e / temp))
|
||||
return left - right
|
||||
|
||||
|
||||
# as above, this is brevity n * Delta_0
|
||||
def n_integral(temp, delta, mu_star):
|
||||
def integrand(xi):
|
||||
return n_integrand_function(xi, temp, delta, mu_star)
|
||||
intermediate = 20 * numpy.sqrt(delta ** 2 + mu_star ** 2)
|
||||
lower = integrate.quad(integrand, 0, intermediate)[0]
|
||||
upper = integrate.quad(integrand, intermediate, numpy.inf)[0]
|
||||
return lower + upper
|
||||
|
@ -55,3 +55,15 @@ def test_n_integrand_function():
|
||||
decimal=7, err_msg='did not find correct n integrand value',
|
||||
verbose=True
|
||||
)
|
||||
|
||||
|
||||
def test_n_integral():
|
||||
actual = None
|
||||
with pytest.warns(None) as record:
|
||||
actual = pysuperconductor.os_gap_calc.n_integral(2, 2, 1)
|
||||
numpy.testing.assert_almost_equal(
|
||||
actual, 0.478130649727604,
|
||||
decimal=7, err_msg='did not find correct n integral value',
|
||||
verbose=True
|
||||
)
|
||||
assert not record
|
||||
|
Loading…
x
Reference in New Issue
Block a user