Open-boundary Hamiltonian adaptive resolution: from grand canonical to non-equilibrium molecular dynamics simulations