The energetics of polytypic structures: a computer simulation of magnesium silicate spinelloids