Structural and electronic properties of wurtzite MgZnO and BeMgZnO alloys and their thermodynamic stability