Empirical intermolecular potentials for N2 and CO2 from crystal data