Compute projected hamiltonian