  We present a methodology based on the calculation of the inelastic scattering
from magnons via the spin scattering function in confined geometries such as
thin films using a second quantization formalism, for both ferromagnetic and
antiferromagnetic materials. The case studies are chosen with an aim to
demonstrate the effects of film thickness and crystal orientation on magnon
modes, using bcc Fe(100) and NiO with (100) and (111) crystallographic
orientations as prototypical systems. Due to the quantization of the
quasi-momentum we observe a granularity in the inelastic spectra in the
reciprocal space path reflecting the orientation of the thin film. This
approach also allows to capture softer modes that appear due to the partial
interaction of magnetic moments close to the surface in a thin film geometry,
in addition to bulk modes. The softer modes are also affected by
crystallographic orientations as illustrated by the different surface-related
peaks of NiO magnon density of states at approximately ~ 65 meV for (100) and ~
42 meV for (111). Additionally, we explore the role of anisotropy on magnon
modes, revealing that introducing anisotropy to both Fe and NiO films increases
the overall hardness of the magnon modes. The introduction of a surface
anisotropy produces a shift of the surface-related magnon DOS peak to higher
energies with increased surface anisotropy, and in some cases leading to
surface confined mode.
