Magnetic dipole Hamiltonian from current-current interaction In the Coulomb gauge, we can write the electromagnetic Hamiltonian as
\begin{equation}
\label{eq:em-hamiltonian}\tag{1}
  H_\mathrm{EM} = - \int d^3 x \, \mathbf{j}(\mathbf{x}) \cdot \mathbf{A}(\mathbf{x})
  + \frac{1}{2} \int d^3 x \, d^3 x' \, \frac{\rho(\mathbf{x}) \rho(\mathbf{x}')}{4\pi \vert \mathbf{x} - \mathbf{x}' \vert},
\end{equation}
where $\mathbf{j}(\mathbf{x})$ is a current density, $\mathbf{A}(\mathbf{x})$ is the vector current, and $\rho(\mathbf{x})$ is a charge density.
For a magnetic dipole in a uniform magnetic field, we can write the interaction Hamiltonian as
$$
\label{eq:dipole-hamiltonian}\tag{2}
H_\mathrm{dipole} = - \mathbf{\mu}\cdot\mathbf{B}
$$
where we can express the dipole moment $\mathbf{\mu}$ in terms of the current density via
$$
  \mathbf{\mu} = \frac{1}{2} \int_{\mathbb{R}^3} d^3 x \, \mathbf{x} \times \mathbf{j}(\vec{x}).
$$
How can we recover \eqref{eq:dipole-hamiltonian} from \eqref{eq:em-hamiltonian}? We know that $\mathbf{B}(\mathbf{x}) = \mathbf{\nabla} \times \mathbf{A}(\mathbf{x})$, and can assume that $\mathbf{j}(\mathbf{x})$ is localized in space.
 A: Start with the (particular choice) of $\mathbf{A}(\mathbf{x})$ for a uniform field,
$$
\mathbf{A}(\mathbf{x}) = -\frac{1}{2} \mathbf{x} \times \mathbf{B},
$$
and set $\rho(\mathbf{x}) = 0$. Then $H_\mathrm{EM}$ reduces to
$$
H_\mathrm{EM} = \frac{1}{2} \int d^3 x \, \mathbf{j}(\mathbf{x}) \cdot \big( \mathbf{x} \times \mathbf{B} \big).
$$
Using the scalar triple-product identity $\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) = - (\mathbf{b} \times \mathbf{a}) \cdot \mathbf{c}$, we can rewrite $H_\mathrm{EM}$ as
$$
H_\mathrm{EM} = -\frac{1}{2} \int d^3 x \, \big( \mathbf{x} \times \mathbf{j}(\mathbf{x}) \big) \cdot  \mathbf{B}.
$$
Because $\mathbf{B}$ is independent of $\mathbf{x}$, we can pull it out of the integration, writing
$$
H_\mathrm{EM} = -\left(\frac{1}{2} \int d^3 x \, \mathbf{x} \times \mathbf{j}(\mathbf{x}) \right) \cdot  \mathbf{B}.
$$
We then recognize the term inside the brackets as $\mathbf{\mu}$, and recover
$$
H_\mathrm{EM} = - \mathbf{\mu} \cdot \mathbf{B} = H_\mathrm{dipole}.
$$
