Ab initio calculation of the thermodynamic properties and phase diagram of gallium nitride