Calculation of the electromagnetic penetration depth requires calculation of the imaginary part of the dielectric constant of the system of interest. For simple metals, for this purpose use can be made of the analytic expressions calculated by K. Sturm, the link to the relevant publication I present below.
One important point deserves mentioning here. Considering a periodic crystal, the square of the (complex) refractive index is equal to the reciprocal of the head element of the inverse of the dielectric matrix of the system in the momentum representation (more about this shortly). If the latter dielectric matrix were diagonal (which is the case for uniform ground states), then the square of the refractive index would be equal to the dielectric constant. In crystals, this is not the case due to Umklapp processes, arising from the fact that in periodic crystals momentum is conserved only up to a reciprocal-lattice vector. Therefore, it is important that in practice one calculates the dielectric matrix, inverts it and then takes the reciprocal of the head element of this matrix. Neglecting the inversion, that is just by taking the head element of the dielectric matrix, amounts to neglecting the so-called local-field effects, the fact that light upon entering a crystal undergoes multiple scattering, in each of which it can take up and give up momentum associated with the reciprocal-lattice vectors (the 'local' electromagnetic field configuration inside a crystal is not the same as that of the incident light).
In the momentum representation, the dielectric matrix ε is a matrix whose indices are those of the underlying reciprocal-lattice vectors; in εl,l' the indices l and l' refer to the reciprocal-lattice vectors Kl and Kl' respectively. The head element of the matrix ε, as well as that of the inverse of the dielectric matrix ε-1, corresponds to Kl = Kl' = 0.
Lastly, the matrix ε depends on the wave vector q and the frequency ω, which in the relevant calculations are to be identified with the wave vector and the frequency of the incident light (here X ray). The above-mentioned Umklapp processes account for the off-diagonal elements of ε to be in general non-vanishing.
For completeness, below I also present a link to a relevant publication (see in particular Eqs. (26) and (27) herein).
You can also download the program XOP which can calculate and plot absorption vs energy for any material. It also has a lot of other useful functionality for x-ray optics ray tracing, heat load calculation, x-ray source spectra, etc...