A Julia library implementing SU(N) classical spin dynamics simulations for arbitrary crystal geometries and a broad class of Hamiltonians.
Author SunnySuite
27 Stars
Updated Last
11 Months Ago
Started In
July 2021

Dev Build Status

A package for simulating classical spin systems, including the Landau-Lifshitz dynamics of spin dipoles and its generalization to multipolar spin components. In the latter case, Sunny resolves the local quantum structure of individual spins, making it particularly suited for modeling magnetic compounds with strong single-ion anisotropy, e.g., due to crystal field splitting.

Sunny additionally provides Monte Carlo algorithms for sampling from thermal equilibrium, as well as tools for measuring dynamical structure factors that can be compared with experimental neutron scattering data. Symmetry analyses are available to facilitate the design and specification of model Hamiltonians. Some interactive 3D visualization tools are available, with more planned.

Sunny is currently under heavy development with many breaking changes. See the version history for details.


To see Sunny in action, we recommend browsing the FeI2 case study. This example uses SU(3) spin dynamics to measure the dynamical structure factor. The SU(3) formalism is essential to model the single-ion bound-state, which has been observed experimentally.

In addition to the examples in the official documentation, a number of tutorials are available as Jupyter notebooks at the SunnyTutorials repo.

Technical description of SU(N) spin dynamics.

A quantum spin of magnitude S has N = 2 S + 1 distinct angular momentum eigenstates. The traditional classical approximation effectively replaces each spin operator with a dipole expectation value, producing the Landau-Lifshitz spin-dipole dynamics. Alternatively, one can derive a dynamics that retains all multipolar expectation values (dipoles, quadrupoles, etc.) [Zhang and Batista, Phys. Rev. B 104, 104409 (2021)]. This formalism can be understood as a dynamics of SU(N) coherent states, and coincides with the usual Laudau-Lifshitz dynamics when N=2.

Sunny uses recently developed algorithms to simulate this SU(N) spin dynamics in a highly efficient way:

  • D. Dahlbom et al., Geometric integration of classical spin dynamics via a mean-field Schr√∂dinger equation, Phys. Rev. B 106, 054423 (2022) [arXiv:2204.07563].
  • D. Dahlbom et al., Langevin dynamics of generalized spins as SU(N) coherent states, Phys. Rev. B 106, 235154 (2022) [arXiv:2209.01265].

Comparison with other tools

In addition to the generalized SU(N) spin dynamics, Sunny can also simulate spins in the dipole-only approximation. When running in this mode, the capabilities of Sunny are similar to SpinW, which was an inspiration for this project. Sunny supports general single-ion anisotropies, and currently has a focus on classical spin dynamics. The classical spin dynamics allows for simulations at finite temperatures, and (soon) the application of chemical inhomogeneities. Support for the SU(N) version of linear spin wave theory is coming soon; this approach will be faster, and enables arbitrary k-space resolution.


Sunny is implemented in the Julia programming language. New Julia users may wish to read our Getting Started wiki page.

From the Julia prompt, one can install the latest Sunny using the built-in package manager:

julia> ]
pkg> add Sunny

New point-releases will include breaking changes. To install a specific version of Sunny, say v0.x, use the command add Sunny@0.x.

Contact us

If you're using Sunny, we'd like to interact with you. Please join our Slack User Community and say hello! If you find an unexpected behavior in Sunny, you can also start a Github discussion or file an issue. If you write a paper using Sunny, please add it to our Wiki.