Effect of dispersion corrections on ab initio predictions of graphite and diamond properties under pressure