The Lagrangian of a charged particle of charge $e$ moving in an electromagnetic field is given by $$L=\frac{1}{2}m\dot{\textbf{r}}^2-e\phi-e\textbf{A}\cdot \textbf{v}$$ where $\phi(\textbf{r},t)$ is the scalar potential and $\textbf{A}(\textbf{r},t)$ is the vector potential. Here the "potential" $U=e(\phi-\textbf{A}\cdot \textbf{v})$ is velocity dependent. The corresponding Hamiltonian is given by $$H=\frac{(\textbf{p}-e\textbf{A})^2}{2m}+e\phi$$
Is it possible to define a total energy for the the charged particle? If yes, what is the expression for total energy and is that a constant of motion?
Does the expression for the Hamiltonian coincide with that of the total energy? My guess is that the Hamiltonian cannot represent the total energy because it is not gauge invariant.