Uploaded by 홍길동

IsingModel final 0928

advertisement
Ising Model : Team Tim (Suhong Kim, Seona Lee, Jaeyeon Yang, Seonwoo Choi)
I.
INTRODUCTION
To understand natural phenomena, we utilize various models to mathematically represent
these occurrences. Hamiltonian allows us to analyze the energy states of such phenomena,
and through trajectory analysis, we can predict the system’s dynamic changes. At the Microscopic Level, specific models like the Ising model are utilized to model the spin states
of atoms or molecules and their interactions. This enables us to track the changes in the
microscopic states within the system and understand the movements of spins or atoms. On
the Macroscopic Level, we focus on the system’s average characteristics, such as temperature or pressure. Through trajectory analysis, we discern how changes in the microscopic
state influence macroscopic properties, like thermodynamic quantities such as entropy. Such
understanding plays a pivotal role in unraveling the intricate behaviors of systems.
II.
ISING MODEL
The 2D Ising model describes a system of spins positioned on a lattice, where each spin
assumes a value of either +1 or -1. These spins interact with their neighboring spins and
can also be influenced by external magnetic fields. Central to this model is the Hamiltonian,
which quantifies the energy of a given spin configuration. This Hamiltonian considers the
interaction strength between spins and the individual values of each spin to calculate the
overall energy of the system. As the lattice size increases, the number of possible states
grows exponentially, making it computationally inefficient to directly explore and compute
all possible states.
To address this challenge, a probabilistic sampling method, known as the Monte Carlo
method, is introduced. Within the Monte Carlo framework, the Metropolis algorithm is employed, which randomly selects a spin in the current state to generate a new state. This new
state’s energy is then compared to the current state’s energy. If there’s an energy decrease,
the new state is accepted. However, if there’s an energy increase, the new state’s acceptance
depends on the Boltzmann distribution. Through this approach, the system converges to
an equilibrium state at a given temperature. This simulation models the behavior of the
1
2D Ising system, visually representing the magnetization changes over time and providing
snapshots of the lattice states. This facilitates the observation and analysis of the system’s
behavior under various temperatures and conditions.
III.
CODE DESCRIPTION
The overall code is provided in appendix.
(1) Initialization: Randomly set the spins in the lattice to either +1 or -1.
(2) Spin Selection: Randomly select a spin within the lattice.
(3) Spin Flip: Flip the value of the chosen spin to create a new state.
(4) Energy Calculation: Compute the energy of both the new and current states.
(5) Decision on State Acceptance: Accept the new state if energy decreases. If energy
increases, decide based on the Boltzmann distribution.
(6) Equilibrium Check: Determine if the system has reached equilibrium.
(7) Iteration: Continue the preceding steps until equilibrium is reached.
IV.
SIMULATION RESULT
FIG. 1. Simulation result, T=10
2
FIG. 2. Simulation result, T=5
FIG. 3. Simulation result, T=2
3
FIG. 4. Simulation result, T=1
V.
DISCUSSION
In the 2D Ising model, energy decreases when adjacent spins align in the same direction.
Temperature, representing kinetic energy, tends to increase the system’s entropy, driving it
towards a more random state. This indicates the importance of balance between the forces
trying to maximize entropy and those aiming to minimize energy.
(1) Low Temperature: At cooler temperatures, the system predominantly seeks to conserve energy, causing spins to align. This behavior is understood through the Gibbs free
energy equation :
G = H − T ∆S
(1)
where the enthalpy H becomes the dominating factor, leading to a strong magnetic alignment, with magnetization values tending towards 1 or -1.
(2)High Temperature: Conversely, at warmer temperatures, the system’s entropy maximization becomes dominant, compelling spins to arrange more randomly. In the Gibbs free
equation, the TS term becomes significant due to the increased temperature. This results in
the system favoring disorder to minimize the Gibbs free energy. This randomness is evident
4
in the magnetization graph as values fluctuate without a discernible pattern. In essence, the
Ising model elucidates the temperature-dependent balance between the desires of a system
to save energy and maximize disorder.
FIG. 5. Magnetization of different temperature and metals1
Figure 5 is a data illustrating the degree of magnetization of various metals according to
temperature. In general, as the temperature increases, the magnetic properties of the metal
significantly decrease, and the magnetic properties of the metal become zero after a certain
temperature (Curie Temperature).
This is the result of the competitive action of entropy and enthalpy caused by the kinetic
energy of metal atoms changing with temperature. In order for Gibbs free energy to ultimately have a small value, it can be seen that the magnetic properties of the metal change
according to the dominance of entropy at different temperatures.
5
VI.
APPENDIX
[2D Ising model simulation]
import numpy as np
import matplotlib.pyplot as plt
class Ising2D:
"""
Class representing a 2D Ising model with Monte Carlo simulation
"""
def __init__(self, size, temperature, coupling):
"""
Initialize the Ising model
size : int
The size of the lattice, i.e., number of spins along each dimension.
temperature : float
The temperature of the system.
coupling : float
The interaction strength between spins.
"""
self.size = size
self.temperature = temperature
self.coupling = coupling
self.lattice = np.random.choice([1, -1], size=(size, size))
# save initial state
self.magnetization = [np.sum(self.lattice) / (self.size ** 2)]
self.snapshots = [self.lattice.copy()]
def energy(self):
"""
Compute the total energy of the system
"""
en = 0
for i in range(self.size):
for j in range(self.size):
#periodic boundary condition
right = self.lattice[(i+1)% self.size][j]
down = self.lattice[i][(j+1) % self.size]
en += -self.coupling * self.lattice[i][j] * (right + down)
return en
def propose_flip(self):
"""
Propose flipping a random spin in the lattice
"""
x, y = np.random.randint(0, self.size, 2) # Understand this part
right = self.lattice[(x+1) % self.size][y]
left = self.lattice[(x-1) % self.size][y]
up = self.lattice[x][(y-1) % self.size]
down = self.lattice[x][(y+1) % self.size]
energy_change = 2 * self.coupling * self.lattice[x][y] * (right + left + up + down)
return x, y, energy_change
6
def accept_flip(self, x, y, energy_change):
"""
Accept the flip according to the Metropolis-Hastings criterion
"""
# This is a rule - worth trying to understand, but not necessary at this moment.
if np.random.random() < np.exp(-energy_change / self.temperature):
self.lattice[x, y] *= -1
def monte_carlo_step(self, step_now=0):
"""
Perform one Monte Carlo step, i.e., propose and carry out a spin flip for each spin on average
"""
# Propose a move
for _ in range(self.size ** 2): # loop runs for total number of spins times
x, y, energy_change = self.propose_flip() # propose a single flip
self.accept_flip(x, y, energy_change) # Check acceptance of the move
# Record magnetization - Track total sum of spins, normalized
self.magnetization.append(np.sum(self.lattice) / (self.size ** 2))
[Plot how a configuration evolves with MC step]
# Create an Ising system
size = 50
coupling = 1.0
num_steps = 1000 # number of MC cycle
snapshot_interval = num_steps // 5
# Change this to control how frequently snapshots are taken
# Control variable
temperature = 10.0
# Independent runs
several=5
for _ in range(several):
# Run the Monte Carlo simulation
system = Ising2D(size, temperature, coupling)
for step in range(num_steps):
system.monte_carlo_step()
if step % snapshot_interval == 0:
system.snapshots.append(system.lattice.copy())
# Plot the result
plot_evolution(system, snapshot_interval)
[Run simulation]
# Control variable
temperature = 5.0
# Independent runs
several=5
for _ in range(several):
# Run the Monte Carlo simulation
system = Ising2D(size, temperature, coupling)
for step in range(num_steps):
system.monte_carlo_step()
if step % snapshot_interval == 0:
system.snapshots.append(system.lattice.copy())
# Plot the result
plot_evolution(system, snapshot_interval)
# Control variable
temperature = 2.0
7
# Independent runs
several=5
for _ in range(several):
# Run the Monte Carlo simulation
system = Ising2D(size, temperature, coupling)
for step in range(num_steps):
system.monte_carlo_step()
if step % snapshot_interval == 0:
system.snapshots.append(system.lattice.copy())
# Plot the result
plot_evolution(system, snapshot_interval)
# Control variable
temperature = 1.0
# Independent runs
several=5
for _ in range(several):
# Run the Monte Carlo simulation
system = Ising2D(size, temperature, coupling)
for step in range(num_steps):
system.monte_carlo_step()
if step % snapshot_interval == 0:
system.snapshots.append(system.lattice.copy())
# Plot the result
plot_evolution(system, snapshot_interval)
REFERENCES
1
RFL Evans, U Atxitia, and RW Chantrell. Quantitive simulation of temperature dependent
magnetization dynamics and equilibrium properties. Tc, 3(2):2.
8
Download