Total energy calculations of the lattice properties of cubic and hexagonal diamond