  The electronic structure and magnetic coupling properties of rare-earth
metals (Gd, Nd) doped ZnO have been investigated using first-principles
methods. We show that the magnetic coupling between Gd or Nd ions in the
nearest neighbor sites is ferromagnetic. The stability of the ferromagnetic
coupling between Gd ions can be enhanced by appropriate electron doping into
ZnO:Gd system and the room-temperature ferromagnetism can be achieved. However,
for ZnO:Nd system, the ferromagnetism between Nd ions can be enhanced by
appropriate holes doping into the sample. The room-temperature ferromagnetism
can also be achieved in the \emph{n}-conducting ZnO:Nd sample. Our calculated
results are in good agreement with the conclusions of the recent experiments.
The effect of native defects (V$_{\rm{Zn}}$, V$_{\rm{O}}$) on the
ferromagnetism is also discussed.
