Skip to content

Commit

Permalink
Merge remote-tracking branch 'modelB/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
joott committed May 19, 2022
2 parents 79d14b7 + 5db874d commit ac6c208
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 14 deletions.
34 changes: 34 additions & 0 deletions corr.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cd(@__DIR__)

using Plots
using DelimitedFiles
using LaTeXStrings


function autocor_loc_2(x, beg, max, n=2)
C = zeros(Complex{Float64},max+1)
N = zeros(Int64,max+1)
Threads.@threads for tau in 0:max
for i in beg:length(x)-max
j = i + tau
@inbounds @fastmath C[tau+1] = C[tau+1] + (x[i]*conj(x[j]))^n
@inbounds @fastmath N[tau+1] = N[tau+1] + 1
end
end
(collect(1:max+1), C ./ N)
end


df_16=readdlm("output_16.dat",' ')
df_8=readdlm("output_8.dat",' ')


(t_8,c_8) = autocor_loc_2(df_8[:,7].+df_8[:,8].*1.0im, 1, 8, 1)


plot(t_8/8^2,real(c_8)/real(c_8[1]),label=L"L=8",xlabel = L"t/L^2")




savefig("c.pdf")
39 changes: 25 additions & 14 deletions modelB.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ const T = 1.0f0

const Δt = 0.04f0/Γ
const Rate = Float32(sqrt(2.0*Δt*Γ))
ξ = Normal(0.0f0, 1.0f0)


function hotstart(n)
rand(Normal(), n, n, n)
rand(ξ, n, n, n)
end

function ΔH(x, ϕ, q, m²)
Expand All @@ -32,15 +34,16 @@ function ΔH(x, ϕ, q, m²)
end

function step(m², ϕ, x1, x2)
q = Rate*rand(Normal())
q = Rate*rand(ξ)

@inbounds ϕ1 = ϕ[x1[1], x1[2], x1[3]]
@inbounds ϕ2 = ϕ[x2[1], x2[2], x2[3]]

δH = ΔH(x1, ϕ, q, m²) + ΔH(x2, ϕ, -q, m²) + q^2
P = min(1.0f0, exp(-δH))
r = rand(Float32)
if (r < P)

if (r < P)
@inbounds ϕ[x1[1], x1[2], x1[3]] += q
@inbounds ϕ[x2[1], x2[2], x2[3]] -= q
end
Expand All @@ -56,7 +59,7 @@ function sweep(m², ϕ)
x1 = transition[idx]
x1[idx[1]] += m%2
x1[idx[2]] += m<3
x2 = copy(x1)
x2 = copy(x1)
x2[n+1] += 1

step(m², ϕ, x1.%L.+1, x2.%L.+1)
Expand All @@ -81,18 +84,26 @@ m² = -2.285

ϕ = hotstart(L)

thermalize(m², ϕ, 100*L^2)
thermalize(m², ϕ, 100*L^4)

maxt = L^4*25

maxt = L^2
skip=20

ϕk = fft(ϕ)

open("output_$L.dat","w") do io
for i in 0:maxt
(M, ϕk) = op(ϕ, L)
Printf.@printf(io, "%i %f", 20i, M)
for kx in 1:L
Printf.@printf(io, " %f %f", real(ϕk[kx]), imag(ϕk[kx]))
end
Printf.@printf(io, "\n")
thermalize(m², ϕ, 20)
Mt = M(ϕ)

ϕk = fft(ϕ)

Printf.@printf(io, "%i %f", skip*i, Mt)
for kx in 1:L
Printf.@printf(io, " %f %f", real(ϕk[1,kx,1]), imag(ϕk[1,kx,1]))
end

Printf.@printf(io, "\n")
thermalize(m², ϕ, skip)
end
end
end

0 comments on commit ac6c208

Please sign in to comment.