Skip to content

Commit

Permalink
Delete duplicates.
Browse files Browse the repository at this point in the history
  • Loading branch information
[Harry Lane] committed Jul 26, 2023
1 parent 7f30bc8 commit 16c2b4a
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 171 deletions.

Large diffs are not rendered by default.

116 changes: 0 additions & 116 deletions src/SpinWaveTheory/Test_scripts/simple_AFM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,119 +113,3 @@ end

using PlotUtils
#savefig("20x20x1_LSWT_0p1.png")
import Pkg
Pkg.activate("Sunny")
#Pkg.add("SparseArrays")
using Plots
using GLMakie
using Sunny
using SparseArrays
using LinearAlgebra
################################################################################
# Model
################################################################################
begin
a, b, c = 1.0, 2.0, 3.0
latvecs = lattice_vectors(a, b, c, 90, 90, 90)
positions = [[0,0,0]]
cryst = Crystal(latvecs, positions)

dims = (20,20,1)
S = 1
sys = System(cryst, dims, [SpinInfo(1; S, g=1)], :SUN)

J = 1.0
D = -0.2
h = 0

set_exchange!(sys, J, Bond(1, 1, [1,0,0]))
set_anisotropy!(sys, D*𝒮[3]^2, 1)
set_external_field!(sys, [0.0, 0.0, h])

end
################################################################################
# Find ground state
################################################################################
begin
Δt = 0.02
λ = 0.1
langevin = Langevin(Δt; kT=0, λ)

randomize_spins!(sys)
for kT in range(5, 0, 30_000)
langevin.kT = kT
step!(sys, langevin)
end

end
langevin.kT = 0.0
for _ 1:20_000
step!(sys, langevin)
end

#plot_spins(sys)


################################################################################
# Calculate SWT
################################################################################
print_wrapped_intensities(sys)
#suggest_magnetic_supercell([[1/2, 0, 0]], sys.latsize)
#sys_swt_SUN = reshape_geometry(sys,[2 0 0; 0 1 0; 0 0 1])
sys_swt_SUN = sys
plot_spins(sys_swt_SUN)
swt_SUN = SpinWaveTheory(sys_swt_SUN);
#=
begin
qvals = 0.001:0.05:1.0
qs = [[q, 0, 0] for q in qvals]
lenq = length(qs)
disp_SUN = dispersion(swt_SUN, qs)
p=Plots.plot(qvals, disp_SUN[:,1], linecolor="blue", label="SUN",xlabel="[H,0,0]",ylabel="E (mev)",ylims=(0,4))
Plots.plot!(qvals, disp_SUN[:,2], linecolor="blue", label="SUN")
Plots.plot!(qvals, disp_SUN[:,3], linecolor="blue", label="SUN")
Plots.plot!(qvals, disp_SUN[:,4], linecolor="blue", label="SUN")
end
display(p)
@time begin
qvals = 0.0:0.005:1.0
qs = [(q, 0, 0) for q in qvals]
energies = 0.0:0.01:4.25
is = Sunny.intensities(swt_SUN, qs, energies, 0.1)
Plots.heatmap(qvals, energies, is'; clims=(0.0, 10), xlabel="[H,0,0]",ylabel="E (mev)")
end
=#

#####################################
# Old code without general Kernel
#=
@time begin
qvals = 0.:0.005:1.0
qs = [(q, 0, 0) for q in qvals]
energies = 0.0:0.01:4.25
is = Sunny.KPMintensities(swt_SUN, qs, energies, 200)
p=Plots.heatmap(qvals, energies, is'; clims=(0.0, 10), xlabel="[H,0,0]",ylabel="E (mev)")
end
=#

M = 200
kT = 0.5 * Sunny.meV_per_K
σ=0.1
function lorentzian(ω, x, σ)
return (1/π) */ ((x - ω)^2 + σ^2))
end

@time begin
qvals = 0.:0.005:1.0
qs = [(q, 0, 0) for q in qvals]
energies = 0.0:0.01:4.25
is = Sunny.KPMintensities(swt_SUN, qs, energies, M,kT,σ,lorentzian)
p=Plots.heatmap(qvals, energies, is'; clims=(0.0, 10), xlabel="[H,0,0]",ylabel="E (mev)")
end


using PlotUtils
#savefig("20x20x1_LSWT_0p1.png")

Plots.plot(energies,is[101,:],xlabel="E (meV)", ylabel = "Intensity",xlims=(0,1),title = "Cut at [0.5,0,0]",legend = false)

0 comments on commit 16c2b4a

Please sign in to comment.