From 156b187b6ea8b02c58fc17d30028f8445c953818 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Tue, 12 Nov 2024 15:53:45 -0700 Subject: [PATCH 1/8] Add KPM to README and update links. --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 65b237b7e..88c3a2e47 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,12 @@ Sunny is inspired by SpinW, especially regarding symmetry analysis and tradition | -- | -- | -- | -- | | Symmetry-guided modeling | ❌ | ✅ | ✅ | | Interactive graphics | ❌ | ✅ | ✅ | -| [Incommensurate spiral order](https://arxiv.org/abs/1402.6069) | ❌ | ✅ | ✅ | +| [Incommensurate spiral order](https://sunnysuite.github.io/Sunny.jl/stable/examples/spinw/SW15_Ba3NbFe3Si2O14.html) | ❌ | ✅ | ✅ | | Arbitrary couplings of quantum operators | ✅ | ❌ | ✅ | -| [Interaction renormalization corrections](https://arxiv.org/abs/2304.03874) | ❌ | ❌ | ✅ | -| [Multi-flavor spin wave theory](https://arxiv.org/abs/1307.7731) | ✅ | ❌ | ✅ | -| [Classical SU(_N_) spin dynamics](https://arxiv.org/abs/2209.01265) | ❌ | ❌ | ✅ | +| [Interaction renormalization corrections](https://sunnysuite.github.io/Sunny.jl/stable/renormalization.html) | ❌ | ❌ | ✅ | +| [Multi-flavor spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/03_LSWT_SU3_FeI2.html) | ✅ | ❌ | ✅ | +| [Linear-scaling spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/09_Disorder_KPM.html) | ❌ | ❌ | ✅ | +| [Classical SU(_N_) spin dynamics](https://sunnysuite.github.io/Sunny.jl/stable/examples/04_GSD_FeI2.html) | ❌ | ❌ | ✅ | | [Fast long-range dipole interactions](https://sunnysuite.github.io/Sunny.jl/stable/examples/07_Dipole_Dipole.html) | ❌ | ❌ | ✅ | | Programming language | C++ | Matlab | [Julia](https://julialang.org/) | From c744de17e073134b87f45920f819513f17bbf022 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Tue, 12 Nov 2024 15:55:33 -0700 Subject: [PATCH 2/8] Tweak --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88c3a2e47..558978d84 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Sunny is inspired by SpinW, especially regarding symmetry analysis and tradition | Symmetry-guided modeling | ❌ | ✅ | ✅ | | Interactive graphics | ❌ | ✅ | ✅ | | [Incommensurate spiral order](https://sunnysuite.github.io/Sunny.jl/stable/examples/spinw/SW15_Ba3NbFe3Si2O14.html) | ❌ | ✅ | ✅ | -| Arbitrary couplings of quantum operators | ✅ | ❌ | ✅ | +| Arbitrary coupling of quantum operators | ✅ | ❌ | ✅ | | [Interaction renormalization corrections](https://sunnysuite.github.io/Sunny.jl/stable/renormalization.html) | ❌ | ❌ | ✅ | | [Multi-flavor spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/03_LSWT_SU3_FeI2.html) | ✅ | ❌ | ✅ | | [Linear-scaling spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/09_Disorder_KPM.html) | ❌ | ❌ | ✅ | From bc9703179100add44dff942485a48a9c4f851edb Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Tue, 12 Nov 2024 16:16:10 -0700 Subject: [PATCH 3/8] More links in tutorials --- examples/09_Disorder_KPM.jl | 18 +++++++++--------- .../spinw_tutorials/SW15_Ba3NbFe3Si2O14.jl | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/examples/09_Disorder_KPM.jl b/examples/09_Disorder_KPM.jl index 6b4b36b6d..bfc9e7759 100644 --- a/examples/09_Disorder_KPM.jl +++ b/examples/09_Disorder_KPM.jl @@ -1,14 +1,14 @@ # # 9. Disordered system with KPM # -# This example uses the kernel polynomial method (KPM) to efficiently calculate -# the neutron scattering spectrum of a disordered triangular antiferromagnet. -# The model is inspired by YbMgGaO4, as studied in [Paddison et al, Nature -# Phys., **13**, 117–122 (2017)](https://doi.org/10.1038/nphys3971) and [Zhu et -# al, Phys. Rev. Lett. **119**, 157201 -# (2017)](https://doi.org/10.1103/PhysRevLett.119.157201). Disordered occupancy -# of non-magnetic Mg/Ga sites can be modeled as a stochastic distribution of -# exchange constants and ``g``-factors. Including this disorder introduces -# broadening of the spin wave spectrum. +# This example uses the [kernel polynomial method](@ref SpinWaveTheoryKPM) to +# efficiently calculate the neutron scattering spectrum of a disordered +# triangular antiferromagnet. The model is inspired by YbMgGaO4, as studied in +# [Paddison et al, Nature Phys., **13**, 117–122 +# (2017)](https://doi.org/10.1038/nphys3971) and [Zhu et al, Phys. Rev. Lett. +# **119**, 157201 (2017)](https://doi.org/10.1103/PhysRevLett.119.157201). +# Disordered occupancy of non-magnetic Mg/Ga sites can be modeled as a +# stochastic distribution of exchange constants and ``g``-factors. Including +# this disorder introduces broadening of the spin wave spectrum. using Sunny, GLMakie diff --git a/examples/spinw_tutorials/SW15_Ba3NbFe3Si2O14.jl b/examples/spinw_tutorials/SW15_Ba3NbFe3Si2O14.jl index 11c398b47..7242fbd03 100644 --- a/examples/spinw_tutorials/SW15_Ba3NbFe3Si2O14.jl +++ b/examples/spinw_tutorials/SW15_Ba3NbFe3Si2O14.jl @@ -3,6 +3,9 @@ # This is a Sunny port of [SpinW Tutorial # 15](https://spinw.org/tutorials/15tutorial), originally authored by Sandor # Toth. It calculates the linear spin wave theory spectrum of Ba₃NbFe₃Si₂O₁₄. +# The ground state is an incommensurate spiral, which can be directly studied +# using the functions [`minimize_spiral_energy!`](@ref) and +# [`SpinWaveTheorySpiral`](@ref). # Load packages From 3636faaed0c19e27f63d595a873674e4a5119662 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Tue, 12 Nov 2024 17:51:01 -0700 Subject: [PATCH 4/8] Dipole-dipole comments --- examples/07_Dipole_Dipole.jl | 11 ++++++----- src/System/Interactions.jl | 11 ++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/07_Dipole_Dipole.jl b/examples/07_Dipole_Dipole.jl index 41b09e44e..6a084cc95 100644 --- a/examples/07_Dipole_Dipole.jl +++ b/examples/07_Dipole_Dipole.jl @@ -1,10 +1,11 @@ # # 7. Long-range dipole interactions # -# This example shows how long-range dipole-dipole interactions can affect a spin -# wave calculation. These interactions can be included two ways: Ewald summation -# or in real-space with a distance cutoff. The study follows [Del Maestro and -# Gingras, J. Phys.: Cond. Matter, **16**, 3339 -# (2004)](https://arxiv.org/abs/cond-mat/0403494). +# This example demonstrates long-range dipole-dipole interactions in the context +# of a spin wave calculation. These interactions can be included two ways: with +# infinite-range [Ewald summation](@ref enable_dipole_dipole!) or in [real-space +# with a distance cutoff](@ref modify_exchange_with_truncated_dipole_dipole!). +# The study follows [Del Maestro and Gingras, J. Phys.: Cond. Matter, **16**, +# 3339 (2004)](https://arxiv.org/abs/cond-mat/0403494). using Sunny, GLMakie diff --git a/src/System/Interactions.jl b/src/System/Interactions.jl index b37439a66..f838e5f3c 100644 --- a/src/System/Interactions.jl +++ b/src/System/Interactions.jl @@ -69,7 +69,7 @@ end Enables long-range interactions between magnetic dipole moments, ```math - -(μ_0/4π) ∑_{⟨ij⟩} [3 (μ_i⋅𝐫̂_{ij})(μ_j⋅𝐫̂_{ij}) - μ_i⋅μ_j] / r_{ij}^3 + -(μ_0/4π) ∑_{⟨ij⟩} [3 (μ_i⋅𝐫̂_{ij})(μ_j⋅𝐫̂_{ij}) - μ_i⋅μ_j] / r_{ij}^3, ``` where the sum is over all pairs of sites (singly counted), including periodic @@ -79,6 +79,15 @@ parameter `μ0_μB²` specifies the physical constant ``μ_0 μ_B^2``, which has dimensions of length³-energy. Obtain this constant for a given system of [`Units`](@ref) via its `vacuum_permeability` property. +Dipole-dipole interactions can be incorporated into spin dynamics simulations +with very high efficiency. The key observation is that dipole-dipole +interactions are translation invariant and diagonalize in Fourier space. To +calculate these interactions, Sunny will perform a fast Fourier transform (FFT) +on the spins of each Bravais sublattice, and then account for the relative +displacement of the sublattices. With this approach, the computational cost of +an integration time-step scales like ``M^2 N \\ln N``, where ``N`` is the number +of unit cells in the system and ``M`` is the number of atoms per cell. + # Example ```julia From 2340462da7cc2d3457fa785386f0cf4817201435 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Tue, 12 Nov 2024 21:27:24 -0700 Subject: [PATCH 5/8] Tweak --- examples/07_Dipole_Dipole.jl | 9 +++++---- src/System/Interactions.jl | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/examples/07_Dipole_Dipole.jl b/examples/07_Dipole_Dipole.jl index 6a084cc95..845dcb614 100644 --- a/examples/07_Dipole_Dipole.jl +++ b/examples/07_Dipole_Dipole.jl @@ -2,10 +2,11 @@ # # This example demonstrates long-range dipole-dipole interactions in the context # of a spin wave calculation. These interactions can be included two ways: with -# infinite-range [Ewald summation](@ref enable_dipole_dipole!) or in [real-space -# with a distance cutoff](@ref modify_exchange_with_truncated_dipole_dipole!). -# The study follows [Del Maestro and Gingras, J. Phys.: Cond. Matter, **16**, -# 3339 (2004)](https://arxiv.org/abs/cond-mat/0403494). +# infinite-range [Ewald summation](@ref enable_dipole_dipole!) or with a +# [real-space distance cutoff](@ref +# modify_exchange_with_truncated_dipole_dipole!). The study follows [Del Maestro +# and Gingras, J. Phys.: Cond. Matter, **16**, 3339 +# (2004)](https://arxiv.org/abs/cond-mat/0403494). using Sunny, GLMakie diff --git a/src/System/Interactions.jl b/src/System/Interactions.jl index f838e5f3c..9b0c1b429 100644 --- a/src/System/Interactions.jl +++ b/src/System/Interactions.jl @@ -79,15 +79,6 @@ parameter `μ0_μB²` specifies the physical constant ``μ_0 μ_B^2``, which has dimensions of length³-energy. Obtain this constant for a given system of [`Units`](@ref) via its `vacuum_permeability` property. -Dipole-dipole interactions can be incorporated into spin dynamics simulations -with very high efficiency. The key observation is that dipole-dipole -interactions are translation invariant and diagonalize in Fourier space. To -calculate these interactions, Sunny will perform a fast Fourier transform (FFT) -on the spins of each Bravais sublattice, and then account for the relative -displacement of the sublattices. With this approach, the computational cost of -an integration time-step scales like ``M^2 N \\ln N``, where ``N`` is the number -of unit cells in the system and ``M`` is the number of atoms per cell. - # Example ```julia @@ -95,6 +86,16 @@ units = Units(:meV, :angstrom) enable_dipole_dipole!(sys, units.vacuum_permeability) ``` +!!! tip "Efficiency considerations" + Dipole-dipole interactions are very efficient in combination with spin + dynamics simulation, e.g. [`Langevin`](@ref). With the fast Fourier + transform (FFT) applied to Bravais sublattices, the computational cost to + integrate one time-step scales like ``M^2 N \\ln N``, where ``N`` is the + number of cells in the system and ``M`` is the number of sublattices per + cell. Conversely, dipole-dipole interactions are very slow in combination + with a [`LocalSampler`](@ref). Here, ``N`` local spin updates will cost + order ``N^2`` computational operations. + See also [`modify_exchange_with_truncated_dipole_dipole!`](@ref). """ function enable_dipole_dipole!(sys::System{N}, μ0_μB²=nothing) where N From 47e4dc8377f85db47682b06580aca0a749af2d35 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Tue, 12 Nov 2024 21:33:20 -0700 Subject: [PATCH 6/8] Another link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 558978d84..1bd75136c 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ Sunny is inspired by SpinW, especially regarding symmetry analysis and tradition | Symmetry-guided modeling | ❌ | ✅ | ✅ | | Interactive graphics | ❌ | ✅ | ✅ | | [Incommensurate spiral order](https://sunnysuite.github.io/Sunny.jl/stable/examples/spinw/SW15_Ba3NbFe3Si2O14.html) | ❌ | ✅ | ✅ | -| Arbitrary coupling of quantum operators | ✅ | ❌ | ✅ | -| [Interaction renormalization corrections](https://sunnysuite.github.io/Sunny.jl/stable/renormalization.html) | ❌ | ❌ | ✅ | +| [Arbitrary coupling of spin multipoles](https://sunnysuite.github.io/Sunny.jl/stable/library.html#Sunny.set_pair_coupling!-Union{Tuple{N},%20Tuple{System{N},%20AbstractMatrix,%20Any}}%20where%20N) | ✅ | ❌ | ✅ | +| [Interaction renormalization](https://sunnysuite.github.io/Sunny.jl/stable/renormalization.html) | ❌ | ❌ | ✅ | | [Multi-flavor spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/03_LSWT_SU3_FeI2.html) | ✅ | ❌ | ✅ | | [Linear-scaling spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/09_Disorder_KPM.html) | ❌ | ❌ | ✅ | | [Classical SU(_N_) spin dynamics](https://sunnysuite.github.io/Sunny.jl/stable/examples/04_GSD_FeI2.html) | ❌ | ❌ | ✅ | From ed9c3689a5f5fb2ac0b30851e9a30c24a6bc61e4 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Wed, 13 Nov 2024 07:26:47 -0700 Subject: [PATCH 7/8] Tweaks --- README.md | 4 ++-- docs/src/renormalization.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1bd75136c..e49010ff9 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,11 @@ Sunny is inspired by SpinW, especially regarding symmetry analysis and tradition | Symmetry-guided modeling | ❌ | ✅ | ✅ | | Interactive graphics | ❌ | ✅ | ✅ | | [Incommensurate spiral order](https://sunnysuite.github.io/Sunny.jl/stable/examples/spinw/SW15_Ba3NbFe3Si2O14.html) | ❌ | ✅ | ✅ | -| [Arbitrary coupling of spin multipoles](https://sunnysuite.github.io/Sunny.jl/stable/library.html#Sunny.set_pair_coupling!-Union{Tuple{N},%20Tuple{System{N},%20AbstractMatrix,%20Any}}%20where%20N) | ✅ | ❌ | ✅ | | [Interaction renormalization](https://sunnysuite.github.io/Sunny.jl/stable/renormalization.html) | ❌ | ❌ | ✅ | | [Multi-flavor spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/03_LSWT_SU3_FeI2.html) | ✅ | ❌ | ✅ | -| [Linear-scaling spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/09_Disorder_KPM.html) | ❌ | ❌ | ✅ | +| [Arbitrary spin-multipole couplings](https://sunnysuite.github.io/Sunny.jl/stable/library.html#Sunny.set_pair_coupling!-Union{Tuple{N},%20Tuple{System{N},%20AbstractMatrix,%20Any}}%20where%20N) | ✅ | ❌ | ✅ | | [Classical SU(_N_) spin dynamics](https://sunnysuite.github.io/Sunny.jl/stable/examples/04_GSD_FeI2.html) | ❌ | ❌ | ✅ | +| [Linear-scaling spin wave theory](https://sunnysuite.github.io/Sunny.jl/stable/examples/09_Disorder_KPM.html) | ❌ | ❌ | ✅ | | [Fast long-range dipole interactions](https://sunnysuite.github.io/Sunny.jl/stable/examples/07_Dipole_Dipole.html) | ❌ | ❌ | ✅ | | Programming language | C++ | Matlab | [Julia](https://julialang.org/) | diff --git a/docs/src/renormalization.md b/docs/src/renormalization.md index caa91f8ea..ea5a0bc29 100644 --- a/docs/src/renormalization.md +++ b/docs/src/renormalization.md @@ -6,7 +6,7 @@ dipole. This generalization can be important when modeling quantum spin Hamiltonians that include, e.g., a single-ion anisotropy, or a biquadratic coupling between sites. Sunny also supports constraining quantum spin to the space of pure dipoles; in this case, Sunny will automatically perform an -interaction strength renormalization that maximizes accuracy. +interaction strength renormalization that enhances accuracy. ## Local operators From 9cc6f99c63ceecc037c40a2c8a0f40d29130a439 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Thu, 14 Nov 2024 08:02:57 -0700 Subject: [PATCH 8/8] A bit better docs --- src/System/Interactions.jl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/System/Interactions.jl b/src/System/Interactions.jl index 9b0c1b429..409212fb5 100644 --- a/src/System/Interactions.jl +++ b/src/System/Interactions.jl @@ -87,14 +87,15 @@ enable_dipole_dipole!(sys, units.vacuum_permeability) ``` !!! tip "Efficiency considerations" - Dipole-dipole interactions are very efficient in combination with spin - dynamics simulation, e.g. [`Langevin`](@ref). With the fast Fourier - transform (FFT) applied to Bravais sublattices, the computational cost to - integrate one time-step scales like ``M^2 N \\ln N``, where ``N`` is the - number of cells in the system and ``M`` is the number of sublattices per - cell. Conversely, dipole-dipole interactions are very slow in combination - with a [`LocalSampler`](@ref). Here, ``N`` local spin updates will cost - order ``N^2`` computational operations. + Dipole-dipole interactions are very efficient in the context of spin + dynamics simulation, e.g. [`Langevin`](@ref). Sunny applies the fast Fourier + transform (FFT) to spins on each Bravais sublattice, such that the + computational cost to integrate one time-step scales like ``M^2 N \\ln N``, + where ``N`` is the number of cells in the system and ``M`` is the number of + Bravais sublattices per cell. Conversely, dipole-dipole interactions are + highly _inefficient_ in the context of a [`LocalSampler`](@ref). Each Monte + Carlo update of a single spin currently requires scanning over all other + spins in the system. See also [`modify_exchange_with_truncated_dipole_dipole!`](@ref). """