feat: adds a lindhard tranverse function
All checks were successful
gitea-physics/pyewjn/pipeline/head This commit looks good

This commit is contained in:
Deepak Mallubhotla 2022-06-07 21:07:44 -05:00
parent 68f3451531
commit cd887e59bb
2 changed files with 73 additions and 0 deletions

View File

@ -3,9 +3,13 @@ from pyewjn.dielectric.nam_dielectric_coefficient_approximator import (
get_unapproximated_nam_dielectric, get_unapproximated_nam_dielectric,
) )
from pyewjn.dielectric.lindhard_dielectric import get_lindhard_dielectric from pyewjn.dielectric.lindhard_dielectric import get_lindhard_dielectric
from pyewjn.dielectric.lindhard_dielectric_transverse import (
get_lindhard_dielectric_transverse,
)
__all__ = [ __all__ = [
"get_nam_dielectric", "get_nam_dielectric",
"get_lindhard_dielectric", "get_lindhard_dielectric",
"get_lindhard_dielectric_transverse",
"get_unapproximated_nam_dielectric", "get_unapproximated_nam_dielectric",
] ]

View File

@ -0,0 +1,69 @@
import numpy as np
from pyewjn.baskets import CalculationConstants, CalculationParams
TRANSVERSE_THRESHOLD = 1e4
class LindhardDielectricTransverse(object):
def __init__(
self,
params: CalculationParams,
constants: CalculationConstants = CalculationConstants(),
thres=TRANSVERSE_THRESHOLD,
):
self.series_threshold = thres
self.omega = params.omega
self.v_f = params.v_f
self.omega_p = params.omega_p
self.tau = params.tau
self.c_light = constants.c_light
self.s = 1 / (self.tau * self.omega)
self.prefactor = 3 * (self.omega_p**2) / (self.omega**2)
def get_eps(self):
def eps_lindhard(u_inverse_wavelength: float) -> complex:
"""the lindhard dielectric function
:param u_inverse_wavelength: u is in units of the reciprocal vacuum wavelength (omega / c_light)
:return: returns the value of epsilon, dimensionless
"""
# converts u from inverse vacuum wavelength to inverse mean free path
# want to convert to q = vf k, where k is wavevector in SI units
q = u_inverse_wavelength * (self.v_f * self.omega) / (self.c_light)
if u_inverse_wavelength < self.series_threshold * self.v_f / self.omega:
return eps_series(q)
else:
return eps_full_lindhard(q)
def eps_series(q: float) -> complex:
pass
def eps_full_lindhard(q: float) -> complex:
return internal_eps_t_full(q, 1 / self.tau, self.omega_p, self.omega)
return eps_lindhard
def internal_eps_t_full(
q: float,
nu: float,
wp: float,
w: float,
):
s = nu / w
qtw = q / w
log_val = np.log((1 + qtw + 1j * s) / (1 - qtw + 1j * s))
parens = 1 + 1j * s - (((1 + 1j * s) ** 2 - qtw**2) / (2 * qtw)) * log_val
return 1 - (3 / 2) * ((wp) / (w)) ** 2 * (1 / (qtw**2)) * parens
def get_lindhard_dielectric_transverse(
params: CalculationParams, constants: CalculationConstants = CalculationConstants()
):
return LindhardDielectricTransverse(params, constants).get_eps()