Skip to content

Commit

Permalink
build based on d8ad5e7
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Sep 20, 2024
1 parent c0607ba commit 8ca19fe
Show file tree
Hide file tree
Showing 153 changed files with 540 additions and 175 deletions.
2 changes: 1 addition & 1 deletion previews/PR319/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-19T01:02:01","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-20T16:59:54","documenter_version":"1.7.0"}}
8 changes: 4 additions & 4 deletions previews/PR319/assets/notebooks/01_LSWT_CoRh2O4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@
{
"cell_type": "markdown",
"source": [
"### Units"
"### Units system"
],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"The `Units` object selects reference energy and length\n",
"scales, and uses these to provide physical constants. For example, `units.K`\n",
"returns one kelvin as 0.086 meV, where the Boltzmann constant is implicit."
"The `Units` object selects reference energy and length scales,\n",
"and uses these to provide physical constants. For example, `units.K` returns\n",
"one kelvin as 0.086 meV, where the Boltzmann constant is implicit."
],
"metadata": {}
},
Expand Down
261 changes: 261 additions & 0 deletions previews/PR319/assets/notebooks/09_Disorder_KPM.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
{
"cells": [
{
"cell_type": "markdown",
"source": [
"# 9. Disordered system with KPM\n",
"\n",
"This example uses the kernel polynomial method (KPM) to efficiently calculate\n",
"the neutron scattering spectrum of a disordered triangular antiferromagnet.\n",
"The model is inspired by YbMgGaO4, as studied in [Paddison et al, Nature\n",
"Phys., **13**, 117–122 (2017)](https://doi.org/10.1038/nphys3971) and [Zhu et\n",
"al, Phys. Rev. Lett. **119**, 157201\n",
"(2017)](https://doi.org/10.1103/PhysRevLett.119.157201). Disordered occupancy\n",
"of non-magnetic Mg/Ga sites can be modeled as a stochastic distribution of\n",
"exchange constants and $g$-factors. Including this disorder introduces\n",
"broadening of the spin wave spectrum."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"using Sunny, GLMakie"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Set up minimal triangular lattice system. Include antiferromagnetic exchange\n",
"interactions between nearest neighbor bonds. Energy minimization yields the\n",
"magnetic ground state with 120° angles between spins in triangular plaquettes."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"latvecs = lattice_vectors(1, 1, 10, 90, 90, 120)\n",
"cryst = Crystal(latvecs, [[0, 0, 0]])\n",
"sys = System(cryst, [1 => Moment(s=1/2, g=1)], :dipole; dims=(3, 3, 1))\n",
"set_exchange!(sys, +1.0, Bond(1, 1, [1,0,0]))\n",
"\n",
"randomize_spins!(sys)\n",
"minimize_energy!(sys)\n",
"plot_spins(sys; color=[S[3] for S in sys.dipoles], ndims=2)"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Select a $𝐪$-space path for the spin wave calculations."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"qs = [[0, 0, 0], [1/3, 1/3, 0], [1/2, 0, 0], [0, 0, 0]]\n",
"labels = [\"Γ\", \"K\", \"M\", \"Γ\"]\n",
"path = q_space_path(cryst, qs, 150; labels)\n",
"kernel = lorentzian(fwhm=0.4);"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Perform a traditional spin wave calculation. The spectrum shows sharp modes\n",
"associated with coherent excitations about the K-point ordering wavevector,\n",
"$𝐪 = [1/3, 1/3, 0]$."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"energies = range(0.0, 3.0, 150)\n",
"swt = SpinWaveTheory(sys; measure=ssf_perp(sys))\n",
"res = intensities(swt, path; energies, kernel)\n",
"plot_intensities(res)"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Use `repeat_periodically` to enlarge the system by a factor of 10 in\n",
"each dimension. Use `to_inhomogeneous` to disable symmetry\n",
"constraints, and allow for the addition of disordered interactions."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"sys_inhom = to_inhomogeneous(repeat_periodically(sys, (10, 10, 1)))"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Use `symmetry_equivalent_bonds` to iterate over all nearest neighbor\n",
"bonds of the inhomogeneous system. Modify each AFM exchange with a noise term\n",
"that has variance of 1/3. The newly minimized energy configuration allows for\n",
"long wavelength modulations on top of the original 120° order."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"for (site1, site2, offset) in symmetry_equivalent_bonds(sys_inhom, Bond(1,1,[1,0,0]))\n",
" noise = randn()/3\n",
" set_exchange_at!(sys_inhom, 1.0 + noise, site1, site2; offset)\n",
"end\n",
"\n",
"minimize_energy!(sys_inhom, maxiters=5_000)\n",
"plot_spins(sys_inhom; color=[S[3] for S in sys_inhom.dipoles], ndims=2)"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Traditional spin wave theory calculations become impractical for large system\n",
"sizes. Significant acceleration is possible with the [kernel polynomial\n",
"method](https://arxiv.org/abs/2312.08349). Enable it by selecting\n",
"`SpinWaveTheoryKPM` in place of the traditional\n",
"`SpinWaveTheory`. Using KPM, the cost of an `intensities`\n",
"calculation becomes linear in system size and scales inversely with the width\n",
"of the line broadening `kernel`. Error tolerance is controlled through the\n",
"dimensionless `tol` parameter. A relatively small value, `tol = 0.01`, helps\n",
"to resolve the large intensities near the ordering wavevector. The alternative\n",
"choice `tol = 0.1` would be twice faster, but would introduce significant\n",
"numerical artifacts.\n",
"\n",
"Observe from the KPM calculation that disorder in the nearest-neighbor\n",
"exchange serves to broaden the discrete excitation bands into a continuum."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"swt = SpinWaveTheoryKPM(sys_inhom; measure=ssf_perp(sys_inhom), tol=0.01)\n",
"res = intensities(swt, path; energies, kernel)\n",
"plot_intensities(res)"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Now apply a magnetic field of magnitude 7.5 (energy units) along the global\n",
"$ẑ$ axis. This field fully polarizes the spins. Because gap opens, a larger\n",
"tolerance of `tol = 0.1` can be used to accelerate the KPM calculation without\n",
"sacrificing much accuracy. The resulting spin wave spectrum shows a sharp mode\n",
"at the Γ-point (zone center) that broadens into a continuum along the K and M\n",
"points (zone boundary)."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"set_field!(sys_inhom, [0, 0, 7.5])\n",
"randomize_spins!(sys_inhom)\n",
"minimize_energy!(sys_inhom)\n",
"\n",
"energies = range(0.0, 9.0, 150)\n",
"swt = SpinWaveTheoryKPM(sys_inhom; measure=ssf_perp(sys_inhom), tol=0.1)\n",
"res = intensities(swt, path; energies, kernel)\n",
"plot_intensities(res)"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"Add disorder to the $z$-component of each magnetic moment $g$-tensor. This\n",
"further broadens intensities, now across the entire path. Some intensity\n",
"modulation within the continuum is also apparent. This modulation is a\n",
"finite-size effect, and would be mitigated by enlarging the system beyond\n",
"30×30 chemical cells."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"for site in eachsite(sys_inhom)\n",
" noise = randn()/6\n",
" sys_inhom.gs[site] = [1 0 0; 0 1 0; 0 0 1+noise]\n",
"end\n",
"\n",
"swt = SpinWaveTheoryKPM(sys_inhom; measure=ssf_perp(sys_inhom), tol=0.1)\n",
"res = intensities(swt, path; energies, kernel)\n",
"plot_intensities(res)"
],
"metadata": {},
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"For reference, the equivalent non-disordered system shows a single coherent\n",
"mode."
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"set_field!(sys, [0, 0, 7.5])\n",
"randomize_spins!(sys)\n",
"minimize_energy!(sys)\n",
"swt = SpinWaveTheory(sys; measure=ssf_perp(sys))\n",
"res = intensities(swt, path; energies, kernel)\n",
"plot_intensities(res)"
],
"metadata": {},
"execution_count": null
}
],
"nbformat_minor": 3,
"metadata": {
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.5"
},
"kernelspec": {
"name": "julia-1.10",
"display_name": "Julia 1.10.5",
"language": "julia"
}
},
"nbformat": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"source": [
"swt = SpinWaveTheory(sys; measure=ssf_perp(sys))\n",
"qs = [[0,0,0], [1,0,0]]\n",
"path = q_space_path(cryst, qs, 400)\n",
"path = q_space_path(cryst, qs, 401)\n",
"res = intensities_bands(swt, path)\n",
"plot_intensities(res; units)"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"source": [
"swt = SpinWaveTheorySpiral(sys; measure=ssf_perp(sys), k, axis)\n",
"qs = [[0,0,0], [1,0,0]]\n",
"path = q_space_path(cryst, qs, 400)\n",
"path = q_space_path(cryst, qs, 401)\n",
"res = intensities_bands(swt, path)\n",
"plot_intensities(res; units)"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"source": [
"swt = SpinWaveTheory(sys; measure=ssf_perp(sys))\n",
"qs = [[0, 0, 0], [1/2, 0, 0], [1/2, 1/2, 0], [0, 0, 0]]\n",
"path = q_space_path(cryst, qs, 400);\n",
"path = q_space_path(cryst, qs, 400)\n",
"res = intensities_bands(swt, path)\n",
"plot_intensities(res; units)"
],
Expand Down
59 changes: 59 additions & 0 deletions previews/PR319/assets/scripts/09_Disorder_KPM.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using Sunny, GLMakie

latvecs = lattice_vectors(1, 1, 10, 90, 90, 120)
cryst = Crystal(latvecs, [[0, 0, 0]])
sys = System(cryst, [1 => Moment(s=1/2, g=1)], :dipole; dims=(3, 3, 1))
set_exchange!(sys, +1.0, Bond(1, 1, [1,0,0]))

randomize_spins!(sys)
minimize_energy!(sys)
plot_spins(sys; color=[S[3] for S in sys.dipoles], ndims=2)

qs = [[0, 0, 0], [1/3, 1/3, 0], [1/2, 0, 0], [0, 0, 0]]
labels = ["Γ", "K", "M", "Γ"]
path = q_space_path(cryst, qs, 150; labels)
kernel = lorentzian(fwhm=0.4);

energies = range(0.0, 3.0, 150)
swt = SpinWaveTheory(sys; measure=ssf_perp(sys))
res = intensities(swt, path; energies, kernel)
plot_intensities(res)

sys_inhom = to_inhomogeneous(repeat_periodically(sys, (10, 10, 1)))

for (site1, site2, offset) in symmetry_equivalent_bonds(sys_inhom, Bond(1,1,[1,0,0]))
noise = randn()/3
set_exchange_at!(sys_inhom, 1.0 + noise, site1, site2; offset)
end

minimize_energy!(sys_inhom, maxiters=5_000)
plot_spins(sys_inhom; color=[S[3] for S in sys_inhom.dipoles], ndims=2)

swt = SpinWaveTheoryKPM(sys_inhom; measure=ssf_perp(sys_inhom), tol=0.01)
res = intensities(swt, path; energies, kernel)
plot_intensities(res)

set_field!(sys_inhom, [0, 0, 7.5])
randomize_spins!(sys_inhom)
minimize_energy!(sys_inhom)

energies = range(0.0, 9.0, 150)
swt = SpinWaveTheoryKPM(sys_inhom; measure=ssf_perp(sys_inhom), tol=0.1)
res = intensities(swt, path; energies, kernel)
plot_intensities(res)

for site in eachsite(sys_inhom)
noise = randn()/6
sys_inhom.gs[site] = [1 0 0; 0 1 0; 0 0 1+noise]
end

swt = SpinWaveTheoryKPM(sys_inhom; measure=ssf_perp(sys_inhom), tol=0.1)
res = intensities(swt, path; energies, kernel)
plot_intensities(res)

set_field!(sys, [0, 0, 7.5])
randomize_spins!(sys)
minimize_energy!(sys)
swt = SpinWaveTheory(sys; measure=ssf_perp(sys))
res = intensities(swt, path; energies, kernel)
plot_intensities(res)
2 changes: 1 addition & 1 deletion previews/PR319/assets/scripts/SW02_AFM_Heisenberg_chain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plot_spins(sys; ndims=2, ghost_radius=8)

swt = SpinWaveTheory(sys; measure=ssf_perp(sys))
qs = [[0,0,0], [1,0,0]]
path = q_space_path(cryst, qs, 400)
path = q_space_path(cryst, qs, 401)
res = intensities_bands(swt, path)
plot_intensities(res; units)

Expand Down
2 changes: 1 addition & 1 deletion previews/PR319/assets/scripts/SW03_Frustrated_chain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ plot_spins(sys_enlarged; ndims=2)

swt = SpinWaveTheorySpiral(sys; measure=ssf_perp(sys), k, axis)
qs = [[0,0,0], [1,0,0]]
path = q_space_path(cryst, qs, 400)
path = q_space_path(cryst, qs, 401)
res = intensities_bands(swt, path)
plot_intensities(res; units)
2 changes: 1 addition & 1 deletion previews/PR319/assets/scripts/SW04_Frustrated_square.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ plot_spins(sys)

swt = SpinWaveTheory(sys; measure=ssf_perp(sys))
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, 400)
res = intensities_bands(swt, path)
plot_intensities(res; units)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed previews/PR319/examples/01_LSWT_CoRh2O4-3a447150.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed previews/PR319/examples/01_LSWT_CoRh2O4-e74f7712.png
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 8ca19fe

Please sign in to comment.