Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions modelA2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ NNm_a[1] = L
# for performance
NNp=@SVector [NNp_a[i] for i in 1:L]
NNm=@SVector [NNm_a[i] for i in 1:L]
const even_sites = [(i,j) for i in 1:L for j in 1:L if (i+j) % 2 == 0]
const odd_sites = [(i,j) for i in 1:L for j in 1:L if (i+j) % 2 != 0]
###

function hotstart(n)
Expand Down Expand Up @@ -77,21 +79,13 @@ function MCstep(m², ϕ, x)
end
end


function sweep(m², ϕ, L)
Threads.@threads for i in 1:L
for j in 1:L
if (i+j) % 2 == 0
MCstep(m², ϕ, (i,j))
end
end
Threads.@threads for k in eachindex(even_sites)
MCstep(m², ϕ, even_sites[k])
end

Threads.@threads for i in 1:L
for j in 1:L
if (i+j) % 2 != 0
MCstep(m², ϕ, (i,j))
end
end
Threads.@threads for k in eachindex(odd_sites)
MCstep(m², ϕ, odd_sites[k])
end
end

Expand Down