where A i is the magnetic vector potential and ϕ ϕ ( q ) is the electric scalar potential. For each particle the components of the momentum p i and position r i are related by the equations of Hamiltonian mechanics :