adding zeta stuff

This commit is contained in:
2020-07-14 08:22:18 -05:00
parent 8b8a06490a
commit ab61ba5713
7 changed files with 51 additions and 21 deletions

View File

@@ -14,10 +14,10 @@ def zeta_p_integrand_lindhard():
@pytest.mark.parametrize("test_input,expected", [
# u y zeta_p_i(u, y)
# y u zeta_p_i(u, y)
((100, 100), -6.891930153028566e-13 - 7.957747045025948e-9j),
((100, 1e5), -1.0057257267146669e-10 - 4.0591966623027983e-13j),
((1e5, 100), 1.1789175285399862e-8 - 7.957833322596519e-9j)
((1e5, 100), -1.0057257267146669e-10 - 4.0591966623027983e-13j),
((100, 1e5), 1.1789175285399862e-8 - 7.957833322596519e-9j)
])
def test_zeta_p_integrand_lindhard(zeta_p_integrand_lindhard, test_input, expected):
actual = zeta_p_integrand_lindhard(*test_input)
@@ -26,3 +26,23 @@ def test_zeta_p_integrand_lindhard(zeta_p_integrand_lindhard, test_input, expect
actual, expected,
rtol=1e-7, err_msg='Zeta_p is inaccurate for Lindhard case', verbose=True
)
@pytest.fixture
def zeta_p_lindhard():
params = CalculationParams(omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14)
eps_l = pynam.dielectric.get_lindhard_dielectric(params)
return pynam.noise.zeta.get_zeta_p_function(eps_l)
@pytest.mark.parametrize("test_input,expected", [
# u zeta_p(u)
(1, 0.000199609 - 0.000199608j),
])
def test_zeta_p(zeta_p_lindhard, test_input, expected):
actual = zeta_p_lindhard(test_input)
np.testing.assert_allclose(
actual, expected,
rtol=1e-7, err_msg='Zeta_p is inaccurate for Lindhard case', verbose=True
)

View File

@@ -9,3 +9,12 @@ def test_complex_quad():
actual, (6**3)/3 + 1j*(6**4)/4,
decimal=7, err_msg='complex quadrature is broken', verbose=True
)
def test_complex_quadrature():
actual = pynam.util.complex_integrate.complex_quadrature(lambda x: x ** 2 + 1j * x ** 3, 0, 6)[0]
# int_1^6 dx x^2 + i x^3 should equal (1/3)6^3 + (i/4)6^4
np.testing.assert_almost_equal(
actual, (6**3)/3 + 1j*(6**4)/4,
decimal=7, err_msg='complex quadrature is broken', verbose=True
)