diff --git a/pysuperconductor/os_gap_calc.py b/pysuperconductor/os_gap_calc.py index 12aa692..828d519 100644 --- a/pysuperconductor/os_gap_calc.py +++ b/pysuperconductor/os_gap_calc.py @@ -1,6 +1,7 @@ import numpy # type: ignore import scipy.integrate as integrate # type: ignore import scipy.optimize # type: ignore +import scipy.special # type: ignore import logging import warnings @@ -59,8 +60,8 @@ def n_integrand_function( xi: float, temp: float, delta: float, mu_star: float ) -> float: big_e = energy(xi, delta) - left = 1 / (1 + numpy.exp((big_e - mu_star) / temp)) - right = 1 / (1 + numpy.exp(big_e / temp)) + left = scipy.special.expit((mu_star - big_e) / temp) + right = scipy.special.expit(- big_e / temp) return left - right @@ -70,10 +71,8 @@ def n_integral(temp: float, delta: float, mu_star: float) -> float: 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] - # This upper portion of the integral will typically be completely - # negligible, because we're 20x the relevant scale here. - return lower + upper = integrate.quad(integrand, intermediate, numpy.inf)[0] + return lower + upper def find_gap_for_n(