Invertibility of nonnegative Hamiltonian operator with unbounded entries