Grand canonical transition matrix Monte Carlo method