Ab initiocalculation of the phonon dispersion relation: Application to Si