Brief layout of strategy: 1. Write down [Lorentz force](http://en.wikipedia.org/wiki/Lorentz_force) ${\bf F}$. 2. Find (velocity-dependent) potential $U$ for ${\bf F}$. 3. Write down [Lagrangian](http://en.wikipedia.org/wiki/Lagrangian) $L=T-U$. 4. Define the canonical (as opposed to kinetic/mechanical) [momentum](http://en.wikipedia.org/wiki/Momentum) ${\bf p}:=\frac{\partial L}{\partial{\bf v}}$. 4. Perform [Legendre transformation](http://en.wikipedia.org/wiki/Legendre_transformation) ${\bf v}\to {\bf p}$. 5. Write down Hamiltonian $H={\bf v}\cdot{\bf p}-L$.