.. _spin-waves example: Example: Spin-waves in periodic system -------------------------------------- Starting from a magnetisation out of equilibrium, we study the time development of the magnetisation, and track -visually- the spin waves. The geometry is a thin film with dimensions 30 nm x 9 nm x 0.2 nm along the x,y and z axes, respectively. The mesh is centered at (0,0,0) and periodic along the x direction, so that the nodes with coordinates (15.0,y,z) will be considered as equivalent to the nodes with coordinates (-15.0,y,z). .. image:: /example_periodic_spinwaves/periodic_mesh.png :align: center :width: 629 :height: 376 The mesh is contained in :download:`periodic.nmesh ` and has been produced using `Netgen`_ (from :download:`periodic.geo `) and the :ref:`nmeshmirror` command to create required periodic structure :: $ nmeshmirror netgen.nmesh 1e-6 1e-6 -1,0,0 periodic.nmesh .. _Relaxation script: Relaxation script ~~~~~~~~~~~~~~~~~ To see how the system relaxes, we use the following script (:download:`spinwaves.py `): .. include:: spinwaves.py :literal: To execute this script, we call the :ref:`nsim` executable, for example (on linux):: $ nsim spinwaves.py As in the previous examples, we first need to import the modules necessary for the simulation, define the material of the magnetic object, load the mesh and set the initial configuration of the magnetisation. Here, we start from a spatially non-homogeneous configuration in order to excite spin waves. |Nmag| allows us to provide a function to be sampled on the mesh that defines a particular magnetisation configuration. .. image:: /example_periodic_spinwaves/initial_magn.png :align: center :width: 552 :height: 389 In our case, we use the function :: def perturbed_magnetisation(pos): x,y,z = pos newx = x*1e9 newy = y*1e9 if 8