  The cross-slip process of a screw $<$a$>$ dislocation from the basal to the
prismatic plane in magnesium was studied using the density functional theory
and the molecular dynamics calculations. An atomistic method for calculating
the total Peierls energy map has been devised to track the transition path of a
dissociated and/or constricted screw $<$a$>$ dislocation in the cross-slip
process. The barrier of a screw $<$a$>$ dislocation from the basal to the
prismatic plane is estimated by the density functional theory for the first
time to be $61.4\pm 2.0$ meV per Burgers vector length. The activation enthalpy
for the cross slip is calculated using a line tension model based on the
density functional theory to be $1.4$ to $1.7$ eV, which is in reasonable
agreement with experiments. On the basis of the results, the effect of
temperature on the cross-slip process of the dissociated screw $<$a$>$
dislocation on the basal plane is studied in detail using the molecular
dynamics method with the embedded-atom-method (EAM) interatomic potential, in
which the critical resolved shear stress for the cross slip is evaluated. It is
confirmed that the bowed-out dislocation line on the prismatic plane consists
of slightly dissociated rectilinear segments with connecting jogs at low
temperatures and, as the temperature rises, the curved dislocation line becomes
smooth with many segments. The motion of an $<$a$>$ dislocation on the
prismatic plane is jerky in the low temperature region, while it is retarded by
the formation of the largely dissociated plateau segment above the room
temperature. A large reduction of the critical shear stress for the cross slip
is obtained when the $<$a$>$ screw dislocation interacts with a hard-sphere
particle placed on the basal plane in the low temperature region
