  Using first-principles calculations, we study the magnetism of 5d
transition-metal atomic junctions including structural relaxations and
spin-orbit coupling. Upon stretching monatomic chains of W, Ir, and Pt
suspended between two leads, we find the development of strong magnetism and
large values of the magnetocrystalline anisotropy energy (MAE) of up to 30 meV
per chain atom. We predict that switches of the easy magnetization axis of the
nanocontacts upon elongation should be observable by ballistic anisotropic
magnetoresistance measurements. Due to the different local symmetry, the
contributions to the MAE of the central chain atoms and chain atoms in the
vicinity of the leads can have opposite signs which reduces the total MAE. We
demonstrate that this effect occurs independent of the chain length or geometry
of the electrodes.
