Suppose we have an idealized rigid sphere with some (spherically symmetric) charge and mass distribution so that it has isotropic moment of inertia $I$ and gyromagnetic ratio $\gamma$. Suppose further that it is not subjected to any external electric or gravitational fields, but is subjected to a uniform magnetic field, $B$.
I am trying to find the Lagrangian and Hamiltonian for this system, and the equations of motion. It seems it should have kinetic energy: $$T=\frac{1}{2}I\omega\cdot\omega$$ Where $\omega$ is the angular velocity of the rotator, and potential energy: $$U=-m\cdot B$$ Where $m=\gamma I\omega$ its magnetic dipole moment. So if $L$ has the form $T-U$ we get: $$L=\frac{1}{2}I\omega\cdot\omega + \gamma I\omega\cdot B$$ Now, if you use a geometric algebra rotor, or a unit quaternion, to parameterize the orientation of the rotator and write the angular velocity in those terms, you end up with the following equation of motion: $$I\dot\omega=m\times B - \gamma I\dot B$$ This has the usual magnetic torque and generates Larmor precession when $B$ is constant, but I'm not sure if the term involving the time derivative of $B$ is correct - I haven't seen it anywhere else.
Moreover, when I calculate the Hamiltonian, I end up with:
$$H=\frac{1}{2I}(M-\gamma IB)\cdot(M-\gamma IB)=\frac{1}{2}I\omega\cdot\omega$$
Where $M$ is a canonical angular momentum (related to the conjugate momenta of the angular coordinates in the same way that the that the angular velocity is related to their time derivatives). I.e. the potential energy seems to have disappeared.
Is this correct?