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.
Dyna performs x-ray reflectivity simulation and fits.
It includes anomalous, magnetic and anisotropic components in the index of refraction. Dyna simulates reflectivities either versus angle, or versus x-ray energy, with arbitrary incident and outgoing polarizations; it simulates Kerr and Faraday spectra, and transmittance.
Simulations of angular or energy scans can be simultaneously fitted against one model.
The program integrates a toolbox to create charge and magnetic scattering factors from the tables bundled with the code.
Dyna was also designed for pedagogical aims, making easy to slide parameters for on-the-fly calculations.
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.
🔬 Dyna at a Glance
| Description | Simulation and refinement of X-ray/optical reflectivity, transmittance, Kerr, and Faraday effects for ultrathin multilayers. |
| Developed by | Institut Néel, CNRS, Grenoble, France |
| License | GPL-2.0-or-later (Free & Open Source) |
| Latest Version | 6.8.3 (August 2026) |
✨ Key Features
| Category | Capabilities |
|---|---|
| Physics | Anomalous, magnetic, and anisotropic index of refraction (Spin-orbit coupling in valence states negligible) |
| Scan Types | Angular (θ), Q-space, Energy (E), or fixed Q (Arbitrary incident & outgoing polarizations: σ, π, circ±) |
| Magnetism | Magnetic-sensitive susceptibility, arbitrary magnetization direction (Euler angles: φ, γ), Kerr & Faraday rotation/ellipticity (small-angle approximation) |
| Anisotropy | Uniaxial symmetry along film depth (Oriented molecules, orbitally ordered films) |
| Fitting | Multi-fit: simultaneous refinement against multiple datasets (angle/energy scans, any polarization, constraints, parameter limits) |
🧮 Calculation Formalisms
| Type | Methods |
|---|---|
| Scalar | Parratt (fast analytical) |
| Magnetic | Magnetic Parratt (transverse), Elzo, Stepanov (fast analytical), Berreman-Elzo, Berreman-Stepanov (exact 4×4 tensor validation) |
| Transmission | Structural & magnetic-sensitive transmittance (Parratt, Elzo, Stepanov) |
🎯 Typical Use Cases
| Application | Details |
|---|---|
| Structural | Layer thickness, density, roughness in multilayers |
| Magnetic | Magnetization profiles, domain structures, magnetic depth profiling |
| Electronic | Anomalous dispersion (f’, f”) from atomic tables |
| Pedagogy | Interactive parameter sliding for on-the-fly effects |
⚙️ Technical Details
| Field | Details |
|---|---|
| Language | Python ≥ 3.10 + Qt5 (GUI) or headless API |
| Dependencies | NumPy, SciPy, Matplotlib, PyYAML, PyQt5 |
| Installation | pip install DynaRef (GUI: dyna | Headless: dyna-sim) |
| Platforms | Linux, macOS, Windows |
🔗 Resources
| Resource | Link |
|---|---|
| Documentation | pydyna.readthedocs.io |
| Source Code | gitlab.com/dynadevgroup/Dyna |
| Contact | Stéphane Grenier – stephane.grenier@neel.cnrs.fr |
Features
- 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
- GUI workflows
- Scriptable simulations
- Scriptable fitting
- JSON/YAML config files
- YAML GUI project persistence
- Scientific regression tests
API (Application Programming Interface)
Users can script or automate Dyna’s functionality without using the GUI. It is designed for developers or advanced users who want to integrate Dyna into their own workflows or scripts.
from dyna import Experiment, Formalism, run_reflectivity
from dyna.Samples.Samples import SampleIni
experiment = Experiment()
experiment.Formalism = Formalism.STEPANOV_ANGLE
result = run_reflectivity(SampleIni(), experiment)
CLI (Command Line Interface)
Run Dyna simulations, fits, or other tasks directly from the command line (e.g., Terminal on Linux/macOS or Command Prompt/PowerShell on Windows).
dyna-sim examples/stepanov-angle.json --output reflectivity.csv
Reference
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
Screenshots


Provenance
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 formalisms. Both formalisms are based on the usual matricial optical formalism. The scattering formalism, by Stepanov and Sinha, was coded in order to better treat thick systems, notably for transmissivity (or “transmittance”).
We swiched to Python since 2020 for portability.
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.)