  Using a first-principles band-structure method and a special quasirandom
structure (SQS) approach, we systematically calculate the band gap bowing
parameters and \emph{p}-type doping properties of (Zn, Mg, Be)O related random
ternary and quaternary alloys. We show that the bowing parameters for ZnBeO and
MgBeO alloys are large and dependent on composition. This is due to the size
difference and chemical mismatch between Be and Zn(Mg) atoms. We also
demonstrate that adding a small amount of Be into MgO reduces the band gap
indicating that the bowing parameter is larger than the band-gap difference. We
select an ideal N atom with lower \emph{p} atomic energy level as dopant to
perform \emph{p}-type doping of ZnBeO and ZnMgBeO alloys. For N doped in ZnBeO
alloy, we show that the acceptor transition energies become shallower as the
number of the nearest neighbor Be atoms increases. This is thought to be
because of the reduction of \emph{p}-\emph{d} repulsion. The N$_{\rm{O}}$
acceptor transition energies are deep in the ZnMgBeO quaternary alloy
lattice-matched to GaN substrate due to the lower valence band maximum. These
decrease slightly as there are more nearest neighbor Mg atoms surrounding the N
dopant. The important natural valence band alignment between ZnO, MgO, BeO,
ZnBeO, and ZnMgBeO quaternary alloy is also investigated.
