Determination of the effect of lattice expansion and vibration on the spin Hamiltonian parameters of Mn2+ and Cr3+ in MgO