Let me explain the principle of the resonant X-ray diffraction.
First of all, The Hamiltonian is described by an electron in the electromagnetic field.
The transition propability is presented by a braket,
\begin{align}
&\langle \lambda ‘ |H| \lambda \rangle \\
H &= \frac{1}{2m}\left(\mathbf{p}-\frac{e\mathbf{A}}{c}\right)^2. \\
\end{align}
\begin{align}
\nabla \cdot \mathbf{B} &= 0 \\
\nabla \times \mathbf{E} &= -\frac{\partial B}{\partial t}\\
\nabla \cdot \mathbf{D} &= \rho \\
\nabla \times \mathbf{H} &= \mathbf{J} + \frac{\partial \mathbf{D}}{\partial t} \\
\end{align}