When an ideal dipole with constant current $\vec{m}$ is in a magnetic field, its "potential" energy is $-\vec{m}\cdot\vec{B}$, which may be used to derive the magnetic force acting on the dipole as $-\nabla U$. Yet at the same time there's the energy needed to establish currents as $1/2 ~ ~\Sigma I\phi$. If I apply this expression, I get a different result, since there's a $1/2$ factor.
Do these energies represent different concepts? I don't know when to apply each one, since I thought they were equivalent expressions.