Ising2D

In [1]:
if isfile("Project.toml")
    using Pkg
    Pkg.activate(".")
    using Revise
end
  Activating environment at `C:\Users\genkuroki\OneDrive\work\Ising2D.jl\Project.toml`
┌ Warning: no Manifest.toml file found, static paths used
└ @ Revise C:\Users\genkuroki\.julia\packages\Revise\moD4B\src\packagedef.jl:1361
In [2]:
using Ising2D, Plots, Random

Benchmarks

In [3]:
using Ising2D, Random
Random.seed!(464937337564)
print("IfElse() on v$VERSION:")
@time s = ising2d!(rand_ising2d(), β_ising2d, 10^5; algorithm=IfElse())
plot_ising2d(s)
IfElse() on v1.6.0-beta1.0:  8.496836 seconds (3 allocations: 25.781 KiB)
Out[3]:
In [4]:
using Ising2D, Random
Random.seed!(464937337564)
print("MultiFor() on v$VERSION:")
@time s = ising2d!(rand_ising2d(), β_ising2d, 10^5; algorithm=MultiFor())
plot_ising2d(s)
MultiFor() on v1.6.0-beta1.0:  8.961295 seconds (2 allocations: 10.031 KiB)
Out[4]:
In [5]:
using Ising2D, BenchmarkTools, Random
Random.seed!(464937337564)
s = rand_ising2d()
print("IfElse() on v$VERSION:")
@btime ising2d!($s; algorithm=IfElse());
IfElse() on v1.6.0-beta1.0:  83.516 ms (0 allocations: 0 bytes)
In [6]:
using Ising2D, BenchmarkTools, Random
Random.seed!(464937337564)
s = rand_ising2d()
print("MultiFor() on v$VERSION:")
@btime ising2d!($s; algorithm=MultiFor());
MultiFor() on v1.6.0-beta1.0:  83.045 ms (0 allocations: 0 bytes)

Examples

In [7]:
Random.seed!(464937337564);
In [8]:
s = rand_ising2d(200)
P0 = plot_ising2d(s)
Out[8]:
In [9]:
ising2d!(s, β_ising2d, 500)
P1 = plot_ising2d(s)
Out[9]:
In [10]:
png(P0, "images/s0.png")
png(P1, "images/s1.png")
In [11]:
s = rand_ising2d(200)
gif_ising2d(s=s, k=1.0, nwarmups=0, nskips=1, niters=500, fps=15,
    gifname="images/ising2d.gif")
Progress: 100%|█████████████████████████████████████████| Time: 0:01:11
┌ Info: Saved animation to 
│   fn = C:\Users\genkuroki\OneDrive\work\Ising2D.jl\images\ising2d.gif
└ @ Plots C:\Users\genkuroki\.julia\packages\Plots\oZheM\src\animation.jl:104
Out[11]: