On numerical methods for Hamiltonian PDEs and a collocation method for the Vlasov-Maxwell equations