From 50302fc7781d84710d5bcca73004acb4b8941b94 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Thu, 22 Aug 2024 11:43:41 -0600 Subject: [PATCH 1/5] SpinW tutorials 12, 13, 14 --- examples/spinw_tutorials/SW11_La2CuO4.jl | 10 +- .../SW12_Triangular_easy_plane.jl | 67 ++++++++++++++ examples/spinw_tutorials/SW13_LiNiPO4.jl | 92 +++++++++++++++++++ examples/spinw_tutorials/SW14_YVO3.jl | 66 +++++++++++++ 4 files changed, 231 insertions(+), 4 deletions(-) create mode 100644 examples/spinw_tutorials/SW12_Triangular_easy_plane.jl create mode 100644 examples/spinw_tutorials/SW13_LiNiPO4.jl create mode 100644 examples/spinw_tutorials/SW14_YVO3.jl diff --git a/examples/spinw_tutorials/SW11_La2CuO4.jl b/examples/spinw_tutorials/SW11_La2CuO4.jl index 5e096580a..d56723964 100644 --- a/examples/spinw_tutorials/SW11_La2CuO4.jl +++ b/examples/spinw_tutorials/SW11_La2CuO4.jl @@ -2,7 +2,7 @@ # # SW11 - La₂CuO₄ # # This is a Sunny port of [SpinW Tutorial -# 11](https://spinw.org/tutorials/15tutorial), originally authored by Sandor +# 11](https://spinw.org/tutorials/11tutorial), originally authored by Sandor # Toth. It calculates the spin wave spectrum of La₂CuO₄. # Load packages @@ -14,7 +14,9 @@ using Sunny, GLMakie units = Units(:meV, :angstrom) latvecs = lattice_vectors(1, 1, 10, 90, 90, 90) -cryst = Crystal(latvecs, [[0, 0, 0]]) +positions = [[0, 0, 0]] +types = ["Cu"] +cryst = Crystal(latvecs, positions; types) view_crystal(cryst; dims=2) # Build a spin system using the exchange parameters from [R. Coldea, Phys. Rev. @@ -45,9 +47,9 @@ energies = range(0, 320, 400) swt = SpinWaveTheory(sys; measure=ssf_perp(sys)) res = intensities(swt, path; energies, kernel=gaussian(fwhm=35)) res.energies .*= 1.18 -plot_intensities(res) +plot_intensities(res; units) # Plot instantaneous itensities, integrated over ω. res = intensities_instant(swt, path) -plot_intensities(res; colorrange=(0,20)) +plot_intensities(res; colorrange=(0,20), units) diff --git a/examples/spinw_tutorials/SW12_Triangular_easy_plane.jl b/examples/spinw_tutorials/SW12_Triangular_easy_plane.jl new file mode 100644 index 000000000..daecf7479 --- /dev/null +++ b/examples/spinw_tutorials/SW12_Triangular_easy_plane.jl @@ -0,0 +1,67 @@ +# # SW12 - Triangular lattice with easy plane +# +# This is a Sunny port of [SpinW Tutorial +# 12](https://spinw.org/tutorials/12tutorial), originally authored by Sandor +# Toth. It calculates the spin wave dispersion of a triangular lattice model +# with antiferromagnetic interactions and easy-plane single-ion anisotropy. + +# Load packages + +using Sunny, GLMakie + +# Build a triangular lattice with arbitrary lattice constant of 3 Å. + +latvecs = lattice_vectors(3, 3, 4, 90, 90, 120) +cryst = Crystal(latvecs, [[0, 0, 0]]) + +# Build a system with exchange +1 meV along nearest neighbor bonds. + +S = 3/2 +J1 = +1.0 +sys = System(cryst, (3,3,1), [SpinInfo(1; S, g=2)], :dipole) +set_exchange!(sys, J1, Bond(1, 1, [1, 0, 0])) + +# Set an easy-axis anisotropy operator ``+D S_z^2`` using +# [`set_onsite_coupling!`](@ref). **Important note**: When introducing a +# single-ion anisotropy in `:dipole` mode, Sunny will automatically include a +# classical-to-quantum correction factor, as described in the document +# ["Interaction Strength Renormalization"](@ref). The present single-ion +# anisotropy is quadratic in the spin operators, so the prescription is to +# rescale the interaction strength as ``D → (1 - 1/2S) D``. For purposes of this +# tutorial, our aim is to reproduce the SpinW result, which requires to "undo" +# Sunny's classical-to-quantum rescaling factor. Another way to achieve the same +# thing is to select system mode `:dipole_large_S` instead of `:dipole`. + +undo_classical_to_quantum_rescaling = 1 / (1 - 1/2S) +D = 0.2 * undo_classical_to_quantum_rescaling +set_onsite_coupling!(sys, S -> D*S[3]^2, 1) +randomize_spins!(sys) +minimize_energy!(sys) +plot_spins(sys; dims=2) + +# Plot the spin wave spectrum for a path through ``𝐪``-space. + +qs = [[0, 0, 0], [1, 1, 0]] +path = q_space_path(cryst, qs, 400) +swt = SpinWaveTheory(sys; measure=ssf_perp(sys)) +res = intensities_bands(swt, path) +plot_intensities(res) + +# To select a specific linear combination of spin structure factor (SSF) +# components in global Cartesian coordinates, one can use [`ssf_custom`](@ref). +# Here we calculate and plot the real part of ``\mathcal{S}^{zz}(𝐪, ω)``. + +measure = ssf_custom(sys) do q, ssf + return real(ssf[3, 3]) +end +swt = SpinWaveTheory(sys; measure) +res = intensities_bands(swt, path) +plot_intensities(res) + +# It's also possible to get data for the full 3×3 SSF. For example, this is the +# SSF for the 7th energy band, at the 10th ``𝐪``-point along the path. + +measure = ssf_custom((q, ssf) -> ssf, sys) +swt = SpinWaveTheory(sys; measure) +res = intensities_bands(swt, path) +res.data[7, 10] diff --git a/examples/spinw_tutorials/SW13_LiNiPO4.jl b/examples/spinw_tutorials/SW13_LiNiPO4.jl new file mode 100644 index 000000000..d75388d36 --- /dev/null +++ b/examples/spinw_tutorials/SW13_LiNiPO4.jl @@ -0,0 +1,92 @@ +# # SW13 - LiNiPO₄ +# +# This is a Sunny port of [SpinW Tutorial +# 13](https://spinw.org/tutorials/13tutorial), originally authored by Sandor +# Toth. It calculates the spin wave spectrum of LiNiPO₄. + +# Load packages + +using Sunny, GLMakie + +# Build an orthorhombic lattice and populate the Ni atoms according to +# spacegroup 62 (Pnma). + +units = Units(:meV, :angstrom) +a = 10.02 +b = 5.86 +c = 4.68 +latvecs = lattice_vectors(a, b, c, 90, 90, 90) +positions = [[1/4, 1/4, 0]] +types = ["Ni"] +cryst = Crystal(latvecs, positions, 62, setting=""; types) +view_crystal(cryst) + +# Create a system with exchange parameters taken from [T. Jensen, et al., PRB +# **79**, 092413 (2009)](https://doi.org/10.1103/PhysRevB.79.092413). The +# corrected anisotropy values are taken from the thesis of T. Jensen. The mode +# `:dipole_large_S` avoids a [classical-to-quantum rescaling factor](@ref +# "Interaction Strength Renormalization") of anisotropy strengths. + +S = 3/2 +sys = System(cryst, (1,1,1), [SpinInfo(1, S=3/2, g=2)], :dipole_large_S) +Jbc = 1.036 +Jb = 0.6701 +Jc = -0.0469 +Jac = -0.1121 +Jab = 0.2977 +Da = 0.1969 +Db = 0.9097 +set_exchange!(sys, Jbc, Bond(2, 3, [0, 0, 0])) +set_exchange!(sys, Jc, Bond(1, 1, [0, 0, -1])) +set_exchange!(sys, Jb, Bond(1, 1, [0, 1, 0])) +set_exchange!(sys, Jab, Bond(1, 2, [0, 0, 0])) +set_exchange!(sys, Jab, Bond(3, 4, [0, 0, 0])) +set_exchange!(sys, Jac, Bond(3, 1, [0, 0, 0])) +set_exchange!(sys, Jac, Bond(4, 2, [0, 0, 0])) +set_onsite_coupling!(sys, S -> Da*S[1]^2 + Db*S[2]^2, 1) + +# Energy minimization yields a co-linear order along the ``c`` axis. + +randomize_spins!(sys) +minimize_energy!(sys) +plot_spins(sys; color=[s[3] for s in sys.dipoles]) + +# Calculate the spectrum along path [ξ, 1, 0] + +swt = SpinWaveTheory(sys; measure=ssf_perp(sys; apply_g=false)) +qs = [[0, 1, 0], [2, 1, 0]] +path = q_space_path(cryst, qs, 400) +res = intensities_bands(swt, path) +fig = Figure(size=(768, 300)) +plot_intensities!(fig[1, 1], res; units); + +# Plotting intensity curves for individual bands needs code that is customized +# to each situation. Here we filter out zero intensity "ghost" modes by sorting +# the data along dimension 1 (band energy) according to the condition "is +# intensity nonzero". Call the [Makie `lines!` +# function](https://docs.makie.org/stable/reference/plots/lines) to make a +# custom plot. + +data_sorted = sort(res.data; dims=1, by=x->abs(x)>1e-12) +ax = Axis(fig[1, 2], xlabel="Momentum (r.l.u.)", ylabel="Intensity", + xticks=res.qpts.xticks, xticklabelrotation=π/6) +lines!(ax, data_sorted[4, :]; label="Band 2") +lines!(ax, data_sorted[3, :]; label="Band 1") +axislegend(ax) +fig + +# Make the same plots along path [0, 1, ξ] + +qs = [[0, 1, 0], [0, 1, 2]] +path = q_space_path(cryst, qs, 400) +res = intensities_bands(swt, path) +fig = Figure(size=(768, 300)) +plot_intensities!(fig[1, 1], res; units) + +data_sorted = sort(res.data; dims=1, by=x->abs(x)>1e-12) +ax = Axis(fig[1, 2], xlabel="Momentum (r.l.u.)", ylabel="Intensity", + xticks=res.qpts.xticks, xticklabelrotation=π/6) +lines!(ax, data_sorted[4, :]; label="Band 2") +lines!(ax, data_sorted[3, :]; label="Band 1") +axislegend(ax) +fig diff --git a/examples/spinw_tutorials/SW14_YVO3.jl b/examples/spinw_tutorials/SW14_YVO3.jl new file mode 100644 index 000000000..49ad1e7b4 --- /dev/null +++ b/examples/spinw_tutorials/SW14_YVO3.jl @@ -0,0 +1,66 @@ +# # SW14 - YVO₃ +# +# This is a Sunny port of [SpinW Tutorial +# 14](https://spinw.org/tutorials/14tutorial), originally authored by Sandor +# Toth. It calculates the spin wave spectrum of YVO₃. + +# Load packages + +using Sunny, GLMakie + +# Build an orthorhombic lattice and populate the V atoms according to the +# pseudocubic unit cell, doubled along the c-axis. The listed spacegroup of the +# YVO₃ chemical cell is international number 62. It has been observed, however, +# that the exchange interactions break this symmetry. For this reason, disable +# all symmetry analysis by selecting spacegroup 1 (P1). + +units = Units(:meV, :angstrom) +a = 5.2821 / sqrt(2) +b = 5.6144 / sqrt(2) +c = 7.5283 +latvecs = lattice_vectors(a, b, c, 90, 90, 90) +positions = [[0, 0, 0], [0, 0, 1/2]] +types = ["V", "V"] +cryst = Crystal(latvecs, positions, 1; types) + +# Create a system with exchange parameters taken from [C. Ulrich, et al. PRL +# **91**, 257202 (2003).](https://doi.org/10.1103/PhysRevLett.91.257202). Use +# the mode `:dipole_large_S` to avoid a [classical-to-quantum rescaling +# factor](@ref "Interaction Strength Renormalization") of anisotropy strengths, +# for consistency with the original fits. + +sys = System(cryst, (2,2,1), [SpinInfo(1, S=1/2, g=2), SpinInfo(2, S=1/2, g=2)], :dipole_large_S) +Jab = 2.6 +Jc = 3.1 +δ = 0.35 +K1 = 0.90 +K2 = 0.97 +d = 1.15 +Jc1 = [-Jc*(1+δ)+K2 0 -d; 0 -Jc*(1+δ) 0; +d 0 -Jc*(1+δ)] +Jc2 = [-Jc*(1-δ)+K2 0 +d; 0 -Jc*(1-δ) 0; -d 0 -Jc*(1-δ)] +set_exchange!(sys, Jab, Bond(1, 1, [1, 0, 0])) +set_exchange!(sys, Jab, Bond(2, 2, [1, 0, 0])) +set_exchange!(sys, Jc1, Bond(1, 2, [0, 0, 0])) +set_exchange!(sys, Jc2, Bond(2, 1, [0, 0, 1])) +set_exchange!(sys, Jab, Bond(1, 1, [0, 1, 0])) +set_exchange!(sys, Jab, Bond(2, 2, [0, 1, 0])) +set_onsite_coupling!(sys, S -> -K1*S[1]^2, 1) +set_onsite_coupling!(sys, S -> -K1*S[1]^2, 2) + +# When using spacegroup P1, it is a good idea to interactively check whether all +# intended interactions are present. + +view_crystal(sys) + +# Energy minimization yields a Néel order with canting + +randomize_spins!(sys) +minimize_energy!(sys) +plot_spins(sys) + +# Plot spin wave dispersion along a path + +qs = [[0.75, 0.75, 0], [0.5, 0.5, 0], [0.5, 0.5, 1]] +path = q_space_path(cryst, qs, 400) +res = intensities_bands(swt, path) +plot_intensities(res; units) From fedefb14da269c84462b9e44fc37b9debc2f74a1 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Thu, 22 Aug 2024 12:00:18 -0600 Subject: [PATCH 2/5] Tweaks --- examples/spinw_tutorials/SW12_Triangular_easy_plane.jl | 2 +- examples/spinw_tutorials/SW13_LiNiPO4.jl | 10 +++++----- examples/spinw_tutorials/SW14_YVO3.jl | 9 ++++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/examples/spinw_tutorials/SW12_Triangular_easy_plane.jl b/examples/spinw_tutorials/SW12_Triangular_easy_plane.jl index daecf7479..07a5dfa7c 100644 --- a/examples/spinw_tutorials/SW12_Triangular_easy_plane.jl +++ b/examples/spinw_tutorials/SW12_Triangular_easy_plane.jl @@ -25,7 +25,7 @@ set_exchange!(sys, J1, Bond(1, 1, [1, 0, 0])) # [`set_onsite_coupling!`](@ref). **Important note**: When introducing a # single-ion anisotropy in `:dipole` mode, Sunny will automatically include a # classical-to-quantum correction factor, as described in the document -# ["Interaction Strength Renormalization"](@ref). The present single-ion +# [Interaction Strength Renormalization](@ref). The present single-ion # anisotropy is quadratic in the spin operators, so the prescription is to # rescale the interaction strength as ``D → (1 - 1/2S) D``. For purposes of this # tutorial, our aim is to reproduce the SpinW result, which requires to "undo" diff --git a/examples/spinw_tutorials/SW13_LiNiPO4.jl b/examples/spinw_tutorials/SW13_LiNiPO4.jl index d75388d36..ad93d7e26 100644 --- a/examples/spinw_tutorials/SW13_LiNiPO4.jl +++ b/examples/spinw_tutorials/SW13_LiNiPO4.jl @@ -53,17 +53,17 @@ plot_spins(sys; color=[s[3] for s in sys.dipoles]) # Calculate the spectrum along path [ξ, 1, 0] -swt = SpinWaveTheory(sys; measure=ssf_perp(sys; apply_g=false)) +swt = SpinWaveTheory(sys; measure=ssf_perp(sys)) qs = [[0, 1, 0], [2, 1, 0]] path = q_space_path(cryst, qs, 400) res = intensities_bands(swt, path) fig = Figure(size=(768, 300)) plot_intensities!(fig[1, 1], res; units); -# Plotting intensity curves for individual bands needs code that is customized -# to each situation. Here we filter out zero intensity "ghost" modes by sorting -# the data along dimension 1 (band energy) according to the condition "is -# intensity nonzero". Call the [Makie `lines!` +# Plotting intensity curves for individual bands needs code customized to the +# situation. Here we filter out zero intensity "ghost" modes by sorting the data +# along dimension 1 (band energy) according to the condition "is intensity +# nonzero". Call the [Makie `lines!` # function](https://docs.makie.org/stable/reference/plots/lines) to make a # custom plot. diff --git a/examples/spinw_tutorials/SW14_YVO3.jl b/examples/spinw_tutorials/SW14_YVO3.jl index 49ad1e7b4..c647b1d47 100644 --- a/examples/spinw_tutorials/SW14_YVO3.jl +++ b/examples/spinw_tutorials/SW14_YVO3.jl @@ -47,8 +47,10 @@ set_exchange!(sys, Jab, Bond(2, 2, [0, 1, 0])) set_onsite_coupling!(sys, S -> -K1*S[1]^2, 1) set_onsite_coupling!(sys, S -> -K1*S[1]^2, 2) -# When using spacegroup P1, it is a good idea to interactively check whether all -# intended interactions are present. +# When using spacegroup P1, there is no symmetry-propagation of interactions +# because all bonds are considered inequivalent. It is therefore a good idea to +# check in the [`view_crystal`](@ref) GUI whether all the intended interactions +# are really present. view_crystal(sys) @@ -58,8 +60,9 @@ randomize_spins!(sys) minimize_energy!(sys) plot_spins(sys) -# Plot spin wave dispersion along a path +# Plot the spin wave spectrum along a path +swt = SpinWaveTheory(sys; measure=ssf_perp(sys)) qs = [[0.75, 0.75, 0], [0.5, 0.5, 0], [0.5, 0.5, 1]] path = q_space_path(cryst, qs, 400) res = intensities_bands(swt, path) From ae80ec39a413f93fbfc768972e38a55047b4e25f Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Thu, 22 Aug 2024 17:07:15 -0600 Subject: [PATCH 3/5] Fixes --- examples/spinw_tutorials/SW13_LiNiPO4.jl | 5 +++-- examples/spinw_tutorials/SW14_YVO3.jl | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/spinw_tutorials/SW13_LiNiPO4.jl b/examples/spinw_tutorials/SW13_LiNiPO4.jl index ad93d7e26..225441a8a 100644 --- a/examples/spinw_tutorials/SW13_LiNiPO4.jl +++ b/examples/spinw_tutorials/SW13_LiNiPO4.jl @@ -25,10 +25,11 @@ view_crystal(cryst) # **79**, 092413 (2009)](https://doi.org/10.1103/PhysRevB.79.092413). The # corrected anisotropy values are taken from the thesis of T. Jensen. The mode # `:dipole_large_S` avoids a [classical-to-quantum rescaling factor](@ref -# "Interaction Strength Renormalization") of anisotropy strengths. +# "Interaction Strength Renormalization") of anisotropy strengths, as needed for +# consistency with the original fits. S = 3/2 -sys = System(cryst, (1,1,1), [SpinInfo(1, S=3/2, g=2)], :dipole_large_S) +sys = System(cryst, (1,1,1), [SpinInfo(1, S=1, g=2)], :dipole_large_S) Jbc = 1.036 Jb = 0.6701 Jc = -0.0469 diff --git a/examples/spinw_tutorials/SW14_YVO3.jl b/examples/spinw_tutorials/SW14_YVO3.jl index c647b1d47..892707ed9 100644 --- a/examples/spinw_tutorials/SW14_YVO3.jl +++ b/examples/spinw_tutorials/SW14_YVO3.jl @@ -24,10 +24,10 @@ types = ["V", "V"] cryst = Crystal(latvecs, positions, 1; types) # Create a system with exchange parameters taken from [C. Ulrich, et al. PRL -# **91**, 257202 (2003).](https://doi.org/10.1103/PhysRevLett.91.257202). Use -# the mode `:dipole_large_S` to avoid a [classical-to-quantum rescaling -# factor](@ref "Interaction Strength Renormalization") of anisotropy strengths, -# for consistency with the original fits. +# **91**, 257202 (2003)](https://doi.org/10.1103/PhysRevLett.91.257202). Use the +# mode `:dipole_large_S` to avoid a [classical-to-quantum rescaling factor](@ref +# "Interaction Strength Renormalization") of anisotropy strengths, as needed for +# consistency with the original fits. sys = System(cryst, (2,2,1), [SpinInfo(1, S=1/2, g=2), SpinInfo(2, S=1/2, g=2)], :dipole_large_S) Jab = 2.6 @@ -49,8 +49,8 @@ set_onsite_coupling!(sys, S -> -K1*S[1]^2, 2) # When using spacegroup P1, there is no symmetry-propagation of interactions # because all bonds are considered inequivalent. It is therefore a good idea to -# check in the [`view_crystal`](@ref) GUI whether all the intended interactions -# are really present. +# launch the [`view_crystal`](@ref) GUI with `sys`, activate all toggles, and +# check whether all the intended interactions are present. view_crystal(sys) From 813c8fb792c42e6f336638919e5b175b4fb4e14f Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Thu, 22 Aug 2024 18:22:23 -0600 Subject: [PATCH 4/5] Tweak --- examples/spinw_tutorials/SW14_YVO3.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/spinw_tutorials/SW14_YVO3.jl b/examples/spinw_tutorials/SW14_YVO3.jl index 892707ed9..b7b41b64c 100644 --- a/examples/spinw_tutorials/SW14_YVO3.jl +++ b/examples/spinw_tutorials/SW14_YVO3.jl @@ -23,9 +23,9 @@ positions = [[0, 0, 0], [0, 0, 1/2]] types = ["V", "V"] cryst = Crystal(latvecs, positions, 1; types) -# Create a system with exchange parameters taken from [C. Ulrich, et al. PRL -# **91**, 257202 (2003)](https://doi.org/10.1103/PhysRevLett.91.257202). Use the -# mode `:dipole_large_S` to avoid a [classical-to-quantum rescaling factor](@ref +# Create a system following the model of [C. Ulrich, et al. PRL **91**, 257202 +# (2003)](https://doi.org/10.1103/PhysRevLett.91.257202). The mode +# `:dipole_large_S` avoids a [classical-to-quantum rescaling factor](@ref # "Interaction Strength Renormalization") of anisotropy strengths, as needed for # consistency with the original fits. @@ -48,9 +48,9 @@ set_onsite_coupling!(sys, S -> -K1*S[1]^2, 1) set_onsite_coupling!(sys, S -> -K1*S[1]^2, 2) # When using spacegroup P1, there is no symmetry-propagation of interactions -# because all bonds are considered inequivalent. It is therefore a good idea to -# launch the [`view_crystal`](@ref) GUI with `sys`, activate all toggles, and -# check whether all the intended interactions are present. +# because all bonds are considered inequivalent. One can visualize the +# interactions in the system by clicking the toggles in the +# [`view_crystal`](@ref) GUI. view_crystal(sys) From bdce95f5cceafa542962dad4e2e652564a00d994 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Fri, 23 Aug 2024 07:15:55 -0600 Subject: [PATCH 5/5] Tweaks --- examples/02_LSWT_CoRh2O4.jl | 2 +- examples/03_LLD_CoRh2O4.jl | 2 +- examples/07_Dipole_Dipole.jl | 2 +- examples/08_Momentum_Conventions.jl | 3 +-- examples/spinw_tutorials/SW13_LiNiPO4.jl | 19 ++++++++++--------- .../spinw_tutorials/SW18_Distorted_kagome.jl | 4 ++-- .../spinw_tutorials/SW19_Different_Ions.jl | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/02_LSWT_CoRh2O4.jl b/examples/02_LSWT_CoRh2O4.jl index 40026653d..6520a8269 100644 --- a/examples/02_LSWT_CoRh2O4.jl +++ b/examples/02_LSWT_CoRh2O4.jl @@ -74,7 +74,7 @@ swt = SpinWaveTheory(sys_prim; measure=ssf_perp(sys_prim)) # path that connects high-symmetry points in reciprocal space. qs = [[0, 0, 0], [1/2, 0, 0], [1/2, 1/2, 0], [0, 0, 0]] -path = q_space_path(cryst, qs, 400) +path = q_space_path(cryst, qs, 500) # Select [`lorentzian`](@ref) broadening with a full-width at half-maximum # (FWHM) of 0.8 meV. Use [`ssf_perp`](@ref) to calculate unpolarized scattering diff --git a/examples/03_LLD_CoRh2O4.jl b/examples/03_LLD_CoRh2O4.jl index af691484f..86baf3da4 100644 --- a/examples/03_LLD_CoRh2O4.jl +++ b/examples/03_LLD_CoRh2O4.jl @@ -138,7 +138,7 @@ qs = [[3/4, 3/4, 0], [1/4, 1, 1/4], [ 0, 1, 0], [ 0, -4, 0]] -qpts = q_space_path(cryst, qs, 1000) +qpts = q_space_path(cryst, qs, 500) # Calculate ``I(𝐪, ω)`` intensities along this path and plot. diff --git a/examples/07_Dipole_Dipole.jl b/examples/07_Dipole_Dipole.jl index 3f8f2bc4e..01c9917b6 100644 --- a/examples/07_Dipole_Dipole.jl +++ b/examples/07_Dipole_Dipole.jl @@ -38,7 +38,7 @@ plot_spins(sys_prim; ghost_radius=8, color=[:red, :blue, :yellow, :purple]) qs = [[0,0,0], [0,1,0], [1,1/2,0], [1/2,1/2,1/2], [3/4,3/4,0], [0,0,0]] labels = ["Γ", "X", "W", "L", "K", "Γ"] -path = q_space_path(cryst, qs, 400; labels) +path = q_space_path(cryst, qs, 500; labels) measure = ssf_trace(sys_prim) swt = SpinWaveTheory(sys_prim; measure) diff --git a/examples/08_Momentum_Conventions.jl b/examples/08_Momentum_Conventions.jl index 9298d06c1..6c0babdbd 100644 --- a/examples/08_Momentum_Conventions.jl +++ b/examples/08_Momentum_Conventions.jl @@ -66,7 +66,7 @@ for _ in 1:nsamples end add_sample!(sc, sys) end -path = q_space_path(cryst, [[0,0,-1/2], [0,0,+1/2]], 300) +path = q_space_path(cryst, [[0,0,-1/2], [0,0,+1/2]], 400) res1 = intensities(sc, path; energies=:available, kT) # Calculate the same quantity with linear spin wave theory at ``T = 0``. Because @@ -76,7 +76,6 @@ res1 = intensities(sc, path; energies=:available, kT) sys_small = resize_supercell(sys, (1,1,1)) minimize_energy!(sys_small) swt = SpinWaveTheory(sys_small; measure=ssf_trace(sys_small)) -path = q_space_path(cryst, [[0,0,-1/2], [0,0,+1/2]], 400) res2 = intensities_bands(swt, path) # This model system has a single magnon band with dispersion ``ϵ(𝐪) = 1 - D/B diff --git a/examples/spinw_tutorials/SW13_LiNiPO4.jl b/examples/spinw_tutorials/SW13_LiNiPO4.jl index 225441a8a..53575c807 100644 --- a/examples/spinw_tutorials/SW13_LiNiPO4.jl +++ b/examples/spinw_tutorials/SW13_LiNiPO4.jl @@ -61,18 +61,19 @@ res = intensities_bands(swt, path) fig = Figure(size=(768, 300)) plot_intensities!(fig[1, 1], res; units); -# Plotting intensity curves for individual bands needs code customized to the -# situation. Here we filter out zero intensity "ghost" modes by sorting the data -# along dimension 1 (band energy) according to the condition "is intensity -# nonzero". Call the [Makie `lines!` +# There are two physical bands with nonvanishing intensity. To extract these +# intensity curves, we must filter out the additional bands with zero intensity. +# One way is to sort the data along dimension 1 (the band index) with the +# comparison operator "is intensity less than ``10^{-12}``". Doing so moves the +# physical bands to the end of the array axis. Call the [Makie `lines!` # function](https://docs.makie.org/stable/reference/plots/lines) to make a # custom plot. -data_sorted = sort(res.data; dims=1, by=x->abs(x)>1e-12) +data_sorted = sort(res.data; dims=1, by= >(1e-12)) ax = Axis(fig[1, 2], xlabel="Momentum (r.l.u.)", ylabel="Intensity", xticks=res.qpts.xticks, xticklabelrotation=π/6) -lines!(ax, data_sorted[4, :]; label="Band 2") -lines!(ax, data_sorted[3, :]; label="Band 1") +lines!(ax, data_sorted[end, :]; label="Lower band") +lines!(ax, data_sorted[end-1, :]; label="Upper band") axislegend(ax) fig @@ -87,7 +88,7 @@ plot_intensities!(fig[1, 1], res; units) data_sorted = sort(res.data; dims=1, by=x->abs(x)>1e-12) ax = Axis(fig[1, 2], xlabel="Momentum (r.l.u.)", ylabel="Intensity", xticks=res.qpts.xticks, xticklabelrotation=π/6) -lines!(ax, data_sorted[4, :]; label="Band 2") -lines!(ax, data_sorted[3, :]; label="Band 1") +lines!(ax, data_sorted[end, :]; label="Lower band") +lines!(ax, data_sorted[end-1, :]; label="Upper band") axislegend(ax) fig diff --git a/examples/spinw_tutorials/SW18_Distorted_kagome.jl b/examples/spinw_tutorials/SW18_Distorted_kagome.jl index 4e1befae6..bc3966c99 100644 --- a/examples/spinw_tutorials/SW18_Distorted_kagome.jl +++ b/examples/spinw_tutorials/SW18_Distorted_kagome.jl @@ -77,7 +77,7 @@ energy_per_site(sys2) # < -0.7834 meV # Define a path in q-space qs = [[0,0,0], [1,0,0]] -path = q_space_path(cryst, qs, 512) +path = q_space_path(cryst, qs, 400) # Calculate intensities for the incommensurate spiral phase using # [`SpiralSpinWaveTheory`](@ref). It is necessary to provide the original `sys`, @@ -93,7 +93,7 @@ plot_intensities(res; units) radii = range(0, 2, 100) # (1/Å) energies = range(0, 6, 200) kernel = gaussian(fwhm=0.05) -res = powder_average(cryst, radii, 200) do qs +res = powder_average(cryst, radii, 400) do qs intensities(swt, qs; energies, kernel) end plot_intensities(res; units) diff --git a/examples/spinw_tutorials/SW19_Different_Ions.jl b/examples/spinw_tutorials/SW19_Different_Ions.jl index dd3d2353c..0c9538063 100644 --- a/examples/spinw_tutorials/SW19_Different_Ions.jl +++ b/examples/spinw_tutorials/SW19_Different_Ions.jl @@ -39,7 +39,7 @@ plot_spins(sys) swt = SpinWaveTheory(sys; measure=ssf_perp(sys)) qs = [[0,0,0], [1,0,0]] -path = q_space_path(cryst, qs, 512) +path = q_space_path(cryst, qs, 400) # Plot three types of pair correlation intensities