Dyna is a simulation program for reflectivity and transmittance of x-rays and optics, aimed at determining structural, magnetic and electronic stackings in ultrathin multilayers.

Among so many programs in the field, Dyna has several specificities : it includes anomalous, magnetic and anisotropic components in the index of refraction; it simulates reflectivities either versus angle, or versus x-ray energy, with arbitrary incident and out-going polarizations; it simulates Kerr and Faraday spectra, and transmittance through thin layers.

All the simulations can be simultaneously fitted against one model.

The program integrates a toolbox to create charge and magnetic factors from tables.

Dyna was also designed for pedagogical aims, making easy to slide parameters for on-the-fly effects.

Dyna is an on-going free and open-source project, under Python + Qt, or Matlab environments. Dyna can also be freely downloaded, and support is offered to users upon reasonable request.


  • Parratt
  • Boundary-Propagation matrix (Elzo’s formalism for magnetic reflectivity)


  • magnetic-sensitive susceptibility, arbitrary magnetic moment direction described by Euler angles, with the limitation of neglictible spin-orbit coupling in the valence states
  • anisotropic susceptibility, in the limitation of an uniaxial symmetry along the depth of the film, for the simulation of oriented molecules or orbitally ordered films (not in python code yet)
  • structural and magnetic sensitive transmittance.
  • Angular/Q scans
  • Energy spectra at fix angle or fix Q
  • Polarization Analysis, in and out
  • Refinement in user-defined interval, with limits on parameters, and constrains between parameters
  • Multifit : one system is refined by simultaneous simulations of various data (angle and energy scans, of any polarization, energy or angle configurations).
  • Calculates Scattering Factors from Tables
  • (Python Only) Scriptable
  • (Matlab only) Genetic Algorithm (requires Optimization Toolbox)


In case of use, please cite the reference paper :

X-ray resonant magnetic reflectivity of stratified magnetic structures: Eigenwave formalism and application to a W/Fe/W trilayer

M. Elzo, et al., Journal of Magnetism and Magnetic Materials, 324 (2), pp. 105-112 (2012)

http://dx.doi.org/10.1016/j.jmmm.20… preprint


All in one GUI, experiment and sample description, optimization panel, sliders to play around with parameters.
Dyna integrates a GUI to plot and build charge and magnetic x-ray scattering factors.


Historically, Dyna was developped from Elza Bontempi‘s Reftool within Matlab environment. Reftool was using Zak’s formalism, which was revisited, and simplified, leading to Elzo’s fomalisms. Zak’s and Elzo’s formalisms are based on the usual matricial optical formalism.

We are now in the process of switching to Python entirely. Up to now the two codes are quite similar in functionalities, the Matlab version having been tested more thoroughly.

Top image: study of the sun reflection on water by Leonardo, from a codex in display at Da Vinci’s exhibition in 2019, Musée du Louvre. (S. G.)