Here is a question about the canonical momentum that I had asked some days ago, but I still have one point that I am not understand.
Considering a particle moves in a magnetic field with charge $q$ and mass $m$, its hamiltonian is $$H=\frac{\vec{P}^2}{2m}=\frac{(\vec{p}+q\vec{A})^2}{2m}$$ where $\vec{p}$ is the momentum of the particle, $\vec{A}$ is the vector potential of the magnetic field and $\vec{P}$ is the canonical momentum of the particle.
I think, because of the expression of the hamiltonian, the canonical momentum $\vec{P}$ is a conserved quantity.
But by the answer in the previous link, it seems that the canonical momentum is not conserved even in a simple example that a particle moves in a homogeneous magnetic field.
I am confused about this question. Is the canonical momentum conserved when a particle moves in magnetic field?