6 MonteCarlo Ising

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

The Ising model within

the Monte Carlo method

Katarzyna Sznajd-Weron
Department of Theoretical Physics
Stanisław Ulam and the Monte Carlo method

„The idea for what was later called the Monte Carlo method
occurred to me when I was playing solitaire during my illness.
I noticed that it may be much more practical to get an idea
of the probability of the successful outcome of a solitaire game
(like Canfield or some other where the skill of the player is not
important) by laying down the cards, or experimenting with the
process and merely noticing what
proportion comes out successfully,
rather than to try to compute all
the combinatorial possibilities…”

2
The basic idea of the Monte Carlo method

• Canfield (solitaire): What is the


chance of winning with a ?

properly shuffled deck?


• Hard to compute analytically –
You lose
the outcome depends on many
moves You lose

• What if we play a few hands and You win


see empirically how many do in
fact win You lose

Chance of winning = ¼ !

3
Historical accounts: coin tosses

• First documented experiment performed by


a French scientist and writer in the 18th cent.
• He tossed a coin 4040 times!
• The mean value was 0.5069 (heads = 1, tails = 0)
• In the 20th century the experiment
was repeated by a Russian statistician
Romanowski
• He tossed a coin 80640 times!
• The mean value was 0.4923
hr. Georges-Louis
Leclerc Buffon
4 (1707-1788)
Computer experiments

5
Monte Carlo method – why does it work?

• Let 𝑚𝑚 be the value we want to calculate and it can be


represented as the expected value 𝑚𝑚 = 𝐸𝐸𝑋𝑋 of a
random variable 𝑋𝑋.
• If we are able to generate independent values
𝑚𝑚1 , 𝑚𝑚2 , … from the distribution of the variable 𝑋𝑋,
then the strong law of large numbers indicates that:
1
lim 𝑚𝑚1 + 𝑚𝑚2 + ⋯ + 𝑚𝑚𝑛𝑛 = 𝑚𝑚
𝑛𝑛→∞ 𝑛𝑛

6
Phase transition

Strong magnet

Ferromagnet
(Nickel)

Material 𝑻𝑻𝒄𝒄 [𝑲𝑲] 𝑻𝑻𝒄𝒄 [℃]


• Ferromagnet 𝑇𝑇 ≤ 𝑇𝑇𝑐𝑐 Cobalt (Co) 1388 1115
Iron (Fe) 1034 760
• Paramagnet 𝑇𝑇 > 𝑇𝑇𝑐𝑐
Nickel (Ni) 627 354
• Why? Gadolinium (Gd) 292 19
7
What we can measure?

Source: T. Hickel et al. J. Phys.: Condens. matter 24 (2012) p. 1 – 17

Reduced magnetization:
𝑀𝑀
𝑀𝑀0
Magnetisation in the
8 ground state (max)
The Ising model (Lenz-Ising?)

• 1920 Lenz proposed a simple model


• 1925 Ising – PhD thesis
• There is no phase transition in 1D
• Wrong conclusion: model does not show
phase transition in 2D and 3D
• The only paper by Ising, yet …
𝐿𝐿

𝐸𝐸 = −𝐽𝐽 � 𝑆𝑆𝑖𝑖 𝑆𝑆𝑗𝑗 − ℎ � 𝑆𝑆𝑖𝑖


<𝑖𝑖,𝑗𝑗> 𝑖𝑖

9
Why such an Energy?

𝐿𝐿

𝐸𝐸 = −𝐽𝐽 � 𝑆𝑆𝑖𝑖 𝑆𝑆𝑖𝑖+1 𝑇𝑇 = 0


𝑖𝑖=1

• 𝐹𝐹 = 𝐸𝐸 − 𝑇𝑇𝑇𝑇 the system minimizes the free energy


• For 𝑇𝑇 = 0 the system minimizes the internal energy
𝐿𝐿

𝐸𝐸 = −𝐽𝐽 � 𝑆𝑆𝑖𝑖 𝑆𝑆𝑖𝑖+1 = −𝐽𝐽 3 � 1 + 4 � (−1)


𝑖𝑖=1

𝐿𝐿 𝐿𝐿

𝐸𝐸 = −𝐽𝐽 � 𝑆𝑆𝑖𝑖 𝑆𝑆𝑖𝑖+1 = −𝐽𝐽 � 1 = −𝐽𝐽𝐽𝐽


𝑖𝑖=1 𝑖𝑖=1
10
The Ising model (1920-25)

𝑻𝑻 < 𝑻𝑻𝒄𝒄

𝑻𝑻 > 𝑻𝑻𝒄𝒄

• Interaction between particles – introduces order


• Temperature disorders: 𝐹𝐹 = 𝐸𝐸 − 𝑇𝑇𝑇𝑇
• How to calculate it? Monte Carlo
11
What will we measure?

• An average value of spin (phase diagram - in equilibrium):


𝐿𝐿2
1
𝑚𝑚 = 2 � 𝑆𝑆𝑖𝑖𝑖𝑖 , 𝑁𝑁 = 𝐿𝐿2
𝐿𝐿
𝑖𝑖,𝑗𝑗=1
• Magnetization (averaging over 𝑙𝑙𝑠𝑠𝑠𝑠𝑠𝑠 equilibrium 𝑖𝑖
configurations):

1
1 𝑙𝑙𝑠𝑠𝑠𝑠𝑠𝑠
• 𝑚𝑚 = ∑ |𝑚𝑚𝑗𝑗 |
𝑙𝑙𝑠𝑠𝑠𝑠𝑠𝑠 𝑗𝑗=1

2 ……
𝑗𝑗
• Susceptibility:
𝑁𝑁
𝜒𝜒 = 𝑚𝑚2 − 𝑚𝑚 2
𝑘𝑘𝐵𝐵 𝑇𝑇

𝐿𝐿
12
1 2……………L
Simulation for the fixed temperature T

1) Initialization: prepare the initial state of the system


– Ordered (𝑇𝑇 = 0): 𝑆𝑆𝑖𝑖𝑗𝑗 = 1
– Random (high temperature): 𝑆𝑆𝑖𝑖𝑖𝑖 = ±1 with probability 1/2
2) Let it evolve - how?
3) Wait for the stationary state (thermalization) → 𝑚𝑚(𝑡𝑡)
4) Calculate
𝑁𝑁
1
𝑚𝑚𝑒𝑒𝑒𝑒 = � 𝑆𝑆𝑖𝑖
𝑁𝑁
𝑖𝑖=1
5) Repeat many times (how many and how?)
6) Calculate magnetisation < 𝑚𝑚 > for a given 𝑇𝑇

13
Metropolis algorithm
The most popular but not the only!

14
Elementary update
Random sequential updating, single-flip dynamics
1) Choose randomly one spin 𝑆𝑆𝑖𝑖𝑖𝑖 𝑖𝑖, 𝑗𝑗 ∼ 𝑈𝑈 1, 𝐿𝐿
2) Calculate Δ𝐸𝐸 for 𝑆𝑆𝑖𝑖𝑖𝑖 → −𝑆𝑆𝑖𝑖𝑖𝑖
3) If Δ𝐸𝐸 ≤ 0 then 𝑆𝑆𝑖𝑖𝑖𝑖 → −𝑆𝑆𝑖𝑖𝑖𝑖
4) If Δ𝐸𝐸 > 0 the
a) Choose randomly 𝑥𝑥 ∼ 𝑈𝑈(0,1)
Δ𝐸𝐸 𝑖𝑖
b) If 𝑥𝑥 < exp − then 𝑆𝑆𝑖𝑖𝑖𝑖 → −𝑆𝑆𝑖𝑖𝑖𝑖
𝑘𝑘𝐵𝐵 𝑇𝑇

1
2 ……
𝑗𝑗
• Time unit= 1 𝑀𝑀𝑀𝑀𝑀𝑀
(Monte Carlo Step)

𝐿𝐿
• 1 𝑀𝑀𝑀𝑀𝑀𝑀 = 𝑁𝑁 = 𝐿𝐿2
15
updates i.e. steps 1-4 1 2……………L
New configuration and the energy change

Δ𝐸𝐸 = 𝐸𝐸 −𝑆𝑆𝑖𝑖𝑖𝑖 − 𝐸𝐸 𝑆𝑆𝑖𝑖𝑖𝑖


= −𝐽𝐽 −𝑆𝑆𝑖𝑖𝑖𝑖 𝑆𝑆𝑖𝑖−1,𝑗𝑗 + 𝑆𝑆𝑖𝑖+1,𝑗𝑗 + 𝑆𝑆𝑖𝑖,𝑗𝑗−1 + 𝑆𝑆𝑖𝑖,𝑗𝑗+1
− −𝐽𝐽𝑆𝑆𝑖𝑖𝑖𝑖 𝑆𝑆𝑖𝑖−1,𝑗𝑗 + 𝑆𝑆𝑖𝑖+1,𝑗𝑗 + 𝑆𝑆𝑖𝑖,𝑗𝑗−1 + 𝑆𝑆𝑖𝑖,𝑗𝑗+1
= 2𝐽𝐽𝑆𝑆𝑖𝑖𝑖𝑖 𝑆𝑆𝑖𝑖−1,𝑗𝑗 + 𝑆𝑆𝑖𝑖+1,𝑗𝑗 + 𝑆𝑆𝑖𝑖,𝑗𝑗−1 + 𝑆𝑆𝑖𝑖,𝑗𝑗+1
𝑖𝑖
1

𝑆𝑆𝑖𝑖,𝑗𝑗
2 ……

𝑗𝑗
Δ𝐸𝐸 = 2𝐽𝐽 −1 −1 − 1 + 1 − 1 = 4𝐽𝐽 > 0

𝑆𝑆𝑖𝑖−1,𝑗𝑗 + 𝑆𝑆𝑖𝑖+1,𝑗𝑗 + 𝑆𝑆𝑖𝑖,𝑗𝑗−1 + 𝑆𝑆𝑖𝑖,𝑗𝑗+1


𝐿𝐿

16 1 2……………L
1 MCS Choose 𝑆𝑆𝑖𝑖𝑖𝑖

Calculate Δ𝐸𝐸
for 𝑆𝑆𝑖𝑖𝑖𝑖 → −𝑆𝑆𝑖𝑖𝑖𝑖

YES NO
𝑆𝑆𝑖𝑖𝑖𝑖 → −𝑆𝑆𝑖𝑖𝑖𝑖 𝛥𝛥𝐸𝐸 ≤ 0? Choose 𝑥𝑥 ∼ 𝑈𝑈(0,1)

YES NO
𝑆𝑆𝑖𝑖𝑖𝑖 → −𝑆𝑆𝑖𝑖𝑖𝑖 𝑥𝑥 < 𝑒𝑒 −Δ𝐸𝐸/𝑘𝑘𝐵𝐵 𝑇𝑇 ?

𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖 ≥ 𝑁𝑁?
NO
YES 𝐿𝐿
1
𝑚𝑚 𝑡𝑡 = 2 � 𝑆𝑆𝑖𝑖𝑗𝑗 (𝑡𝑡)
Calculate 𝑚𝑚 𝐿𝐿
𝑖𝑖,𝑗𝑗=1
Time

T=0

T<T*

T=T*

T>T*

18
Play in NetLogo

𝑘𝑘𝐵𝐵
𝑇𝑇 ∗= 𝑇𝑇
𝐽𝐽
Here:
𝑘𝑘𝐵𝐵 = 1, 𝐽𝐽 = 1

19
Spontaneous jumps in small systems
Simulations by Paweł Majewski (BDA, 2019)

20
𝑘𝑘𝐵𝐵
Trajectories for 𝑇𝑇 ∗ = 𝑇𝑇 = 1.85,
𝐽𝐽
The square lattice 𝑁𝑁 = 𝐿𝐿 × 𝐿𝐿, 𝐿𝐿 = 100
Simulations: Jakub Pawłowski (IK, 2019)
T=1.85
1

0.8
• Why the absolute value?
• Why termalization?
0.6

0.4
• What average?
0.2

0
𝐿𝐿
m

1
𝑚𝑚 𝑡𝑡 = 2 � 𝑆𝑆𝑖𝑖𝑗𝑗 (𝑡𝑡)
-0.2

-0.4 𝐿𝐿
𝑖𝑖,𝑗𝑗=1
-0.6

-0.8

-1
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

t [MCS]

21
Calculate 𝑚𝑚(𝑡𝑡) after each MC – note that 𝑡𝑡[𝑀𝑀𝑀𝑀𝑀𝑀]
∗ 𝑘𝑘𝐵𝐵
Trajectories for 𝑇𝑇 = 𝑇𝑇 = 1.85,
𝐽𝐽
The square lattice 𝑁𝑁 = 𝐿𝐿 × 𝐿𝐿, 𝐿𝐿 = 100
Simulations: Jakub Pawłowski (IK, 2019)

1
T=1.85
Time average
0.8
Skip first 𝐾𝐾0 steps
0.6
Time average over 𝐾𝐾 − 𝐾𝐾0 steps

ensemble average
0.4

0.2

𝐿𝐿
1
0
m

-0.2 𝑚𝑚 𝑡𝑡 = 2 � 𝑆𝑆𝑖𝑖𝑗𝑗 (𝑡𝑡)


𝐿𝐿
-0.4 𝑖𝑖,𝑗𝑗=1
-0.6

-0.8

-1
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

t [MCS]

22
∗ 𝑘𝑘𝐵𝐵
Trajectories for 𝑇𝑇 = 𝑇𝑇 = 2.26,
𝐽𝐽
The square lattice 𝑁𝑁 = 𝐿𝐿 × 𝐿𝐿, 𝐿𝐿 = 100
Simulations: Jakub Pawłowski (IK, 2019)

T=2.26
1

0.8

0.6

0.4

0.2
Near the critical point:
0 • Large fluctuations
m

-0.2
• Critical slowing down
-0.4

-0.6

-0.8

-1
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

t [MCS]
23
∗ 𝑘𝑘𝐵𝐵
Histograms for 𝑇𝑇 = 𝑇𝑇 = 1.85
𝐽𝐽
Simulations: Jakub Pawłowski (IK, 2019)

t=0 t=1000
60 60

40 40
P(m)

P(m)
20 20

0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
m m

t=2000 t=10000
200 400

150 300

100 200
P(m)

P(m)

50 100

0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
m m

24
∗ 𝑘𝑘𝐵𝐵
Histograms for 𝑇𝑇 = 𝑇𝑇 = 2.26
𝐽𝐽
Simulations: Jakub Pawłowski (IK, 2019)

t=0 t=1000
80 40

60 30

40 20
P(m)

P(m)
20 10

0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
m m

t=2000 t=10000
40
100

30

20
P(m)

P(m)

50

10

0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
m m

25
What is the transition probability
In the equilibrium statistical physics

𝑑𝑑𝑃𝑃𝑟𝑟
= � 𝑊𝑊𝑠𝑠→𝑟𝑟 𝑃𝑃𝑠𝑠 − � 𝑊𝑊𝑟𝑟→𝑠𝑠 𝑃𝑃𝑟𝑟
𝑑𝑑𝑑𝑑
𝑠𝑠≠𝑟𝑟 𝑠𝑠≠𝑟𝑟
𝑑𝑑𝑃𝑃𝑟𝑟 Stationary
= � 𝑊𝑊𝑠𝑠→𝑟𝑟 𝑃𝑃𝑠𝑠 − 𝑊𝑊𝑟𝑟→𝑠𝑠 𝑃𝑃𝑟𝑟 = 0 condition
𝑑𝑑𝑑𝑑
𝑠𝑠≠𝑟𝑟
Detailed balance
𝑾𝑾𝒔𝒔→𝒓𝒓 𝑷𝑷𝒔𝒔 = 𝑾𝑾𝒓𝒓→𝒔𝒔 𝑷𝑷𝒓𝒓
condition

𝑷𝑷𝒓𝒓 = 𝒁𝒁−𝟏𝟏 𝒆𝒆𝒆𝒆𝒆𝒆 −𝜷𝜷𝑬𝑬𝒓𝒓 Equilibrium


distribution
𝑊𝑊𝑠𝑠→𝑟𝑟 𝑃𝑃𝑟𝑟 𝑍𝑍 −1 𝑒𝑒𝑒𝑒𝑒𝑒 −𝛽𝛽𝐸𝐸𝑟𝑟
= = −1 = exp(−𝛽𝛽Δ𝐸𝐸)
26 𝑊𝑊𝑟𝑟→𝑠𝑠 𝑃𝑃𝑠𝑠 𝑍𝑍 𝑒𝑒𝑒𝑒𝑒𝑒 −𝛽𝛽𝐸𝐸𝑆𝑆
The transition probability
Single-flip spin dynamics
Metropolis:

𝑊𝑊𝑀𝑀 = min[1, exp(−𝛽𝛽Δ𝐸𝐸)]

Glaubera = heat-bath:

1
𝑊𝑊𝐺𝐺 =
1 + exp(𝛽𝛽Δ𝐸𝐸)

For 𝑇𝑇 = 0:
0 𝑖𝑖𝑖𝑖 Δ𝐸𝐸 > 0
𝑊𝑊(Δ𝐸𝐸) = �𝑊𝑊0 𝑖𝑖𝑖𝑖 Δ𝐸𝐸 = 0
1 𝑖𝑖𝑖𝑖 Δ𝐸𝐸 < 0
27
The transition probability

𝟏𝟏
𝜷𝜷 =
𝒌𝒌𝑩𝑩 𝑻𝑻

28
Magnetization
Simulations: Paweł Majewski (BDA, 2019)

29 K=230 000 MCS, 𝐾𝐾0=30 000 MCS


Magnetic susceptibility
Simulations: Paweł Majewski (BDA, 2019)

30 K=230 000 MCS, 𝐾𝐾0=30 000 MCS


Phase transitions in the Ising model
Simulations: Maciej Tabiszewski (Uwr, 2011)

4nn

3nn
6nn

31
Universal critical exponents

𝑇𝑇𝑐𝑐 −𝑇𝑇
𝑡𝑡 = reduced temperature
𝑇𝑇𝑐𝑐

𝑚𝑚 𝑇𝑇, 0 ∼ 𝑡𝑡𝛽𝛽 , 𝑚𝑚 𝑇𝑇𝑐𝑐 , ℎ ∼ ℎ 1/𝛿𝛿

𝜒𝜒 𝑇𝑇, 0 ∼ 𝑡𝑡 −𝛾𝛾

𝑐𝑐 𝑇𝑇, 0 ∼ 𝑡𝑡 −𝛼𝛼

𝜉𝜉 𝑇𝑇, 0 ∼ 𝑡𝑡 −𝜈𝜈

32
𝐺𝐺 𝑟𝑟, 𝑇𝑇𝑐𝑐 , 0 ∼ 𝑟𝑟 −𝑑𝑑+2−𝜂𝜂
Critical exponents for the Ising model

d 2 3 4

Exact = classical (MFA)


α 0 Exact (Onsager)
0.110(1) 0
β 1/8 0.3265(3) 1/2
γ 7/4 1.2372(5) 1
δ 15 4.789(2) 3
η 1/4 0.0364(5)
ν 1 0.6301(4) 1/2

33
Finite size scaling (FSS)

• For 𝐿𝐿 < ∞ max in 𝑇𝑇𝑐𝑐 𝐿𝐿


pseudo-critical
temperaturę

𝑇𝑇𝑐𝑐 𝐿𝐿 −𝑇𝑇𝑐𝑐 ∞
• ∼ 𝐿𝐿−𝜃𝜃
𝑇𝑇𝑐𝑐 ∞
1
• 𝜃𝜃 = for 𝐿𝐿 → ∞
𝜈𝜈

34
Finite size scaling (FSS)

∞ FSS
Specific heat −𝜶𝜶
𝑐𝑐 𝑡𝑡 𝐿𝐿𝛼𝛼/𝜈𝜈
Susceptibility −𝜸𝜸
𝜒𝜒 𝑡𝑡 𝐿𝐿𝛼𝛼/𝜈𝜈
Correlation lenght −𝝂𝝂
𝜉𝜉 𝑡𝑡 𝐿𝐿
Order parameter 𝑚𝑚 𝑡𝑡 𝛽𝛽 𝐿𝐿−𝛽𝛽/𝜈𝜈

𝑇𝑇𝑐𝑐 − 𝑇𝑇 𝑇𝑇𝑐𝑐 (𝐿𝐿)


𝑡𝑡 =
𝑇𝑇𝑐𝑐

35
1/𝐿𝐿
FSS – universal method
Skalowanie skończonego rozmiaru

36
Be careful with the initial state

37
Literature

• M. E. J. Newman & G. T. Barkema, Monte Carlo


Methods in Statistical Physics, Oxford University
Press 2001
• D. P. Landau, K. Binder, A Guide to Monte Carlo
Simulations in Statistical Physics, Cambridge
University Press 2005

38

You might also like