Simulation of uniaxial deformation of hexagonal crystals (Mg, Be)