Ab initio studies of phonons in MgO by the direct method including LO mode