  The effects of Li doping in MgH$_2$ on H-diffusion process are investigated,
using first-principles calculations. We have identified two key effects: (1)
The concentration of H vacancy in the $+1$ charge state (V$_H^{+1}$) can
increase by several orders of magnitude upon Li doping, which significantly
increases the vacancy mediated H diffusion rate. It is caused by the preferred
charge states of substitutional Li in the $-1$ state (Li$_{Mg}^{-1}$) and of
interstitial Li in the $+1$ state (Li$_i^{+1}$), which indirectly reduce the
formation energy of V$_H^{+1}$ by up to 0.39 eV depending on the position of
Fermi energy. (2) The interaction between V$_H^{+1}$ and Li$_{Mg}^{-1}$ is
found to be attractive with a binding energy of 0.55 eV, which immobilizes the
V$_H^{+1}$ next to Li$_{Mg}^{-1}$ at high Li doping concentration. As a result,
the competition between these two effects leads to large enhancement of H
diffusion at low Li doping concentration due to the increased H-vacancy
concentration, but only limited enhancement at high Li concentration due to the
immobilization of H vacancies by too many Li.
