Geometric interpretation of magnetic fields and the motion of charged particles