  We report first-principles investigations of magnetocrystalline anisotropy
energy (MCAE) oscillations as a function of capping layer thickness in Heusler
alloy Co\textsubscript{2}FeAl/Ta heterostructures. Substantial oscillation is
observed in FeAl-interface structure. According to $k$-space and
band-decomposed charge density analyses, this oscillation is mainly attributed
to the Fermi-energy-vicinal quantum well states (QWS) which are confined
between Co\textsubscript{2}FeAl/Ta interface and Ta/vacuum surface. The smaller
oscillation magnitude in the Co-interface structure can be explained by the
smooth potential transition at the interface. These findings clarify that MCAE
in Co\textsubscript{2}FeAl/Ta is not a local property of the interface and that
the quantum well effect plays a dominant role in MCAE oscillations of the
heterostructures. This work presents the possibility of tuning MCAE by QWS in
capping layers, and paves the way for artificially controlling magnetic
anisotropy energy in magnetic tunnel junctions.
