adds gap integrator
All checks were successful
gitea-physics/pysuperconductor/pipeline/head This commit looks good

This commit is contained in:
Deepak Mallubhotla 2020-11-22 14:33:40 -06:00
parent 198610ab7c
commit c60c31d7e2
3 changed files with 18 additions and 0 deletions

1
do.sh
View File

@ -10,6 +10,7 @@ build() {
}
test() {
echo "I am ${FUNCNAME[0]}ing"
poetry run flake8
poetry run pytest tests --cov pysuperconductor
}

View File

@ -1,4 +1,5 @@
import numpy
import scipy.integrate as integrate
def energy(freq, delta):
@ -8,3 +9,11 @@ def energy(freq, delta):
def gap_integrand_function(xi, temp, delta, mu_star):
big_e = energy(xi, delta)
return numpy.tanh((big_e - mu_star) / (2 * temp)) / (2 * big_e)
def gap_integral(temp, delta, mu_star, debye_frequency):
def integrand(xi):
# the 2 here is to account for the symmetry in the integration range
# to cut the integral to zero to omega_debyeh
return 2 * gap_integrand_function(xi, temp, delta, mu_star)
return integrate.quad(integrand, 0, debye_frequency)[0]

View File

@ -8,3 +8,11 @@ def test_gap_integrand_function():
actual, 0.04471214382962651,
decimal=7, err_msg='gap integrand function is off', verbose=True
)
def test_gap_integral():
actual = pysuperconductor.os_gap_calc.gap_integral(1, 5, 2, 10)
numpy.testing.assert_almost_equal(
actual, 1.390972295468881,
decimal=7, err_msg='gap integral is off', verbose=True
)