-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SpinW tutorials 12, 13, 14 (#296)
Co-authored-by: BhushanThipe <[email protected]>
- Loading branch information
Showing
10 changed files
with
243 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# # 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, as needed for | ||
# consistency with the original fits. | ||
|
||
S = 3/2 | ||
sys = System(cryst, (1,1,1), [SpinInfo(1, S=1, 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)) | ||
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); | ||
|
||
# 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= >(1e-12)) | ||
ax = Axis(fig[1, 2], xlabel="Momentum (r.l.u.)", ylabel="Intensity", | ||
xticks=res.qpts.xticks, xticklabelrotation=π/6) | ||
lines!(ax, data_sorted[end, :]; label="Lower band") | ||
lines!(ax, data_sorted[end-1, :]; label="Upper band") | ||
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[end, :]; label="Lower band") | ||
lines!(ax, data_sorted[end-1, :]; label="Upper band") | ||
axislegend(ax) | ||
fig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# # 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 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. | ||
|
||
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, there is no symmetry-propagation of interactions | ||
# 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) | ||
|
||
# Energy minimization yields a Néel order with canting | ||
|
||
randomize_spins!(sys) | ||
minimize_energy!(sys) | ||
plot_spins(sys) | ||
|
||
# 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) | ||
plot_intensities(res; units) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters