The answer to the question will not be straightforward as the conventional Hamiltonian in the EM field. As it is difficult to write equations here, I am attaching the link to the question.
Question link: https://physics.stackexchange.com/q/749166/147579