Electronic structure, optical and thermodynamic properties of ternary hydrides MBeH3 (M = Li, Na, and K)