  A deformed relativistic Hartree Bogoliubov (RHB) theory in continuum is
developed aiming at a proper description of exotic nuclei, particularly those
with a large spatial extension. In order to give an adequate consideration of
both the contribution of the continuum and the large spatial distribution in
exotic nuclei, the deformed RHB equations are solved in a Woods-Saxon (WS)
basis in which the radial wave functions have a proper asymptotic behavior at
large distance from the nuclear center. This is crucial for the proper
description of a possible halo. The formalism of deformed RHB theory in
continuum is presented. A stable nucleus, 20Mg and a weakly-bound nucleus,
42Mg, are taken as examples to present numerical details and to carry out
necessary numerical checks. In addition, the ground state properties of
even-even magnesium isotopes are investigated. The generic conditions of the
formation of a halo in weakly bound deformed systems and the shape of the halo
in deformed nuclei are discussed. We show that the existence and the
deformation of a possible neutron halo depend essentially on the quantum
numbers of the main components of the single particle orbitals in the vicinity
of the Fermi surface.
