Markov chain Monte Carlo solver for finite temperature problem of lattie spin system implemented by Julia language.
julia> Pkg.add("SpinMonteCarlo")
The following program calculates temperature v.s. specific heat of the ferromagnetic Ising model on a 16x16 square lattice by Swendsen-Wang algorithm.
using SpinMonteCarlo
const model = Ising
const lat = square_lattice
const L = 16
const update = SW_update!
const Tc = 2.0/log1p(sqrt(2))
const Ts = Tc*linspace(0.85, 1.15, 31)
const MCS = 8192
const Therm = MCS >> 3
for T in Ts
params = Dict{String,Any}( "Model"=>model, "Lattice"=>lat,
"L"=>L, "T"=>T, "J"=>1.0,
"UpdateMethod"=>update,
"MCS"=>MCS, "Thermalization"=>Therm,
)
result = runMC(params)
println(@sprintf("%f %.15f %.15f",
T, mean(result["Specific Heat"]), stderror(result["Specific Heat"])))
end
- Classical spin model
Ising
modelQ
statePotts
model- order parameter defined as
M = (Q-1)/Q * n_1 - (1-n_1)/Q
, wheren_1
is the number density ofq=1
spins andN
is the number of all spins.
- order parameter defined as
XY
modelQ
stateClock
model
- Quantum spin model
- spin-
S
QuantumXXZ
model\mathcal{H} = \sum_{ij} [ Jz_{ij} S_i^z S_j^z + Jxy_{ij} (S_i^+ S_j^- + S_i^-S_j^+) ] - \sum_i Gamma_i S_i^x
- spin-
chain_lattice
L
square_lattice
L * W
triangular_lattice
L * W
cubic_lattice
L * W * H
fully_connected_lattice
N
- Classical spin
local_update!
SW_update!
Wolff_update!
- Quantum spin
loop_update!
Ising
,Potts
Magnetization
:= < M_total/N_site >
|Magnetization|
:= < |M_total/N_site| >
Magnetization^2
:= < (M_total/N_site)^2 >
Magnetization^4
:= < (M_total/N_site)^4 >
Binder Ratio
:= "Magnetization^4")/"Magnetization^2"^2
Susceptibility
:= \partial_h "Magnetization" = (N/T) * ("Magnetization^2" - "Magnetization"^2)
Connected Susceptibility
:= (N_site/T) * ("Magnetization^2"- "|Magnetization|"^2)
Energy
:= < E_total/N_site >
Energy^2
:= < (E_total/N_site)^2 >
Specific Heat
:= \partial_beta "Energy" = (N/T^2)*("Energy^2" - "Energy"^2)
XY
,Clock
|Magnetization|
|Magnetization|^2
|Magnetization|^4
Binder Ratio
Susceptibility
Connected Susceptibility
Magnetization x
|Magnetization x|
Magnetization x^2
Magnetization x^4
Binder Ratio x
Susceptibility x
Connected Susceptibility x
Magnetization y
|Magnetization y|
Magnetization y^2
Magnetization y^4
Binder Ratio y
Susceptibility y
Connected Susceptibility y
Helicity Modulus x
Helicity Modulus y
Energy
Energy^2
Specific Heat
QuantumXXZ
Magnetization
:= < \sum_i S_i^z > / Nsite
Magnetization^2
:= < (\sum_i S_i^z)^2 > / Nsite^2
Magnetization^4
:= < (\sum_i S_i^z)^4 > / Nsite^4
Binder Ratio
:= "Magnetization^4")/"Magnetization^2"^2
Susceptibility
:= \partial_h "Magnetization" = (N/T) * ("Magnetization^2" - "Magnetization"^2)
Energy
:= < \mathcal{H} > / Nsite
Energy^2
:= < \mathcal{H}^2 > / Nsite^2
Specific Heat
:= \partial_beta "Energy" = (N/T^2)*("Energy^2" - "Energy"^2)
Model
- Classical model
- Heisenberg model
- antiferro interaction
- magnetic field
- Quantum model
- SU(N) model
- Classical model
Lattice
- ladder
- tube
UpdateMethod
- worm algorithm
- Others
- resume and restart
- random number parallelization
- NOTE: parameter parallelization can be realized simply by using
@parallel for
orpmap
.
- NOTE: parameter parallelization can be realized simply by using
- write algorithmic note
- especially, Foutuin-Kasteleyn representaion and improved estimators
Yuichi Motoyama, the University of Tokyo, 2016-2017
This package distributed under the MIT license.