Amorphization and recrystallization of covalent tetrahedral networks