Solution (source code)

= Solution

Interpret $\mathbf P=0$ as the zero-pseudomomentum sector, rather than assuming the mechanical <centre of mass> is at rest. Define $\mathbf u=\mathbf p+e^*\mathbf B\times\mathbf r$. <Hamilton's equations> are
$$
\boxed{\dot{\mathbf R}=\frac eM\mathbf B\times\mathbf r,\quad
\dot{\mathbf P}=0,\quad
\dot{\mathbf r}=\frac{\mathbf u}{\mu},\quad
\dot{\mathbf p}=\frac{e^*}{\mu}\mathbf B\times\mathbf u
-\left(\frac{e^2B^2}{M}+\frac{e^2}{r^3}\right)\mathbf r.}
$$
For example, differentiating the relative kinetic term with respect to $\mathbf r$ gives $-e^*\mathbf B\times\mathbf u/\mu$ because the cross-product matrix is antisymmetric. Hamilton's minus sign then gives the positive cross-product term in $\dot{\mathbf p}$. The <Coulomb force> is attractive. A change to a moving frame need not preserve a pure magnetic external field, so setting $\mathbf P=0$ is a restriction on the chosen solution family.