Akm[k_,m_]:=Piecewise[{{(Ea + Eby + Ebz)/3, k == 0 && m == 0}, {0, k != 2 || (m != -2 && m != -1 && m != 0 && m != 1 && m != 2)}, {(5*(Ea - Eby))/(2*Sqrt[6]), k == 2 && (m == -2 || m == 2)}, {((5*I)*Mb)/Sqrt[6], k == 2 && (m == -1 || m == 1)}}, (-5*(Ea + Eby - 2*Ebz))/6]