tdep-developers / tdep-tutorials

TDEP Tutorials
Creative Commons Zero v1.0 Universal
20 stars 18 forks source link

proposal to change code to sum mode 3+4 #52

Open pzeiger opened 1 year ago

pzeiger commented 1 year ago

https://github.com/tdep-developers/tdep-tutorials/blob/5cb55c44c622c32e7f6e638fd9b3ed75fec7a6e9/06_Infrared/example_MgO/IR/notebook_get_ir.ipynb#L66

# spectral function = imaginary part of G:

epsilon = eps_inf

# Which mode are we interested in?
for s_mode in (3, 4):

    # angular frequency:
    ws = df_intensity.frequency.iloc[s_mode]

    Z = df_intensity.Z_x.iloc[s_mode]

    S = Z ** 2 * df_intensity.prefactor.iloc[s_mode]

    G_imag = np.pi * ds.spectralfunction_per_mode[s_mode]

    # KK to get real
    G_real = get_kk_real(xs=ds.frequency, ys=G_imag)

    # the full G
    G = G_real + 1.0j * G_imag

    pref = ws / 2  # makes G(0) -> ~1

    # full dielectric function
    epsilon += S * pref * G
flokno commented 1 year ago

yes, all modes should be summed