Lattice Boltzmann simulation of thermal nonideal fluids