The atomic cluster models of α-Mg,liquid Mg and the interface between liquid/solid have been founded. The environment-sensitive embedding energy of Ca and Be in α-Mg,liquid Mg,liquid/solid interface has been calculated by recursion method. The atomic affinity energy between Mg,Ca,Be with O has been defined and calculated. The calculated results show that the solid solubility of Ca and Be is very small in α-Mg,because of their higher environment-sensitive embedding energy leads to instability in α-Mg crystal. The Ca and Be diffuse in to the liquid Mg, which has lower environment-sensitive embedding energy than the solid,and congregate on the surface of liquid Mg as the alloys solidify. Because the atomic affinity energy of Ca-O and Be-O is lower than Mg-O,The Ca and Be aggregating on the surface of liquid Mg will priorly combined with O,forming compact oxides of Ca,Be and alloys of elements,which prevent Mg alloys from burning.