# Converting a complex index of refraction to a complex dielectric constant

I have a material's $n,k$ file, containing the complex index of refraction for every wavelength: $n(\omega)+ i\ k(\omega)$.

Now I would like to convert it to the dielectric constants: $\epsilon_{\mathrm{real}} + i\ \epsilon_{\mathrm{im}}$

How can I do it?

You don't mention anything about $\mu_r$, the material's relative permeability, so I'll assume you're dealing with optical frequencies, in which case we can treat $\mu_r=1$, due to most materials of interest being non-magnetic at optical frequencies. In that case, the relationship between the complex relative permittivity (also known as the complex dialectric constant) and the complex refractive index is given by
$$\epsilon_{\mathrm{real}} + i\ \epsilon_{\mathrm{im}}=(n+i\ k)^2\ \ ,$$
$$\epsilon_{\mathrm{real}}=n^2-k^2$$ and $$\epsilon_{\mathrm{im}}=2nk\ \ .$$