adds gap integrator
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
198610ab7c
commit
c60c31d7e2
1
do.sh
1
do.sh
@ -10,6 +10,7 @@ build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test() {
|
test() {
|
||||||
|
echo "I am ${FUNCNAME[0]}ing"
|
||||||
poetry run flake8
|
poetry run flake8
|
||||||
poetry run pytest tests --cov pysuperconductor
|
poetry run pytest tests --cov pysuperconductor
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import numpy
|
import numpy
|
||||||
|
import scipy.integrate as integrate
|
||||||
|
|
||||||
|
|
||||||
def energy(freq, delta):
|
def energy(freq, delta):
|
||||||
@ -8,3 +9,11 @@ def energy(freq, delta):
|
|||||||
def gap_integrand_function(xi, temp, delta, mu_star):
|
def gap_integrand_function(xi, temp, delta, mu_star):
|
||||||
big_e = energy(xi, delta)
|
big_e = energy(xi, delta)
|
||||||
return numpy.tanh((big_e - mu_star) / (2 * temp)) / (2 * big_e)
|
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]
|
||||||
|
@ -8,3 +8,11 @@ def test_gap_integrand_function():
|
|||||||
actual, 0.04471214382962651,
|
actual, 0.04471214382962651,
|
||||||
decimal=7, err_msg='gap integrand function is off', verbose=True
|
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
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user