The divacancy in silicon and diamond