respectively decay

advertisement
Ben Gallup
2.030J
Pset3: Monte Carlo
Problem 3: Ising Model
Questions 1-4 –
The plots following the writeup are the 6 respective graphs of Ising simulations
for a 16x16 grid and:
Plot 1: Reduced Temperature = 2, random initial condition
Q1: Neq = 40 steps
Q2: Ordered with some noise at equilibrium
Plot 2: Reduced Temperature = 2, uniform initial condition
Q3: Equlibration nearly instantaneous (Graph looks messy, but noise amplitude
same as plot1 – much shorter equilibration time
Q3b: No qualitative difference at equilibrium (different dominant direction, but
that is arbitrary
Plot 3: Reduced Temperature = 0.5, random initial condition
Q1: Neq = 30 steps
Q2: Completely ordered at equilibrium
Plot 4: Reduced Temperature = 0.5, uniform initial condition
Q3: Instanteous Equilibrium – shorter equilibration time
Q3b: No qualitative difference at equilibrium
Plot 5: Reduced Temperature = 2.5, random initial condition
Q1: Appears to be in high-noise “equilibrium” from the beginning
Q2: Highly disordered “equilibrium”
Plot 6: Reduced Temperature = 2.5, uniform initial condition
Q3: Appears to take ~10 steps to reach “equilibrium” – longer equilibration time
Q3b: No Qualitative difference at equilibrium
Problems 5-6
Problem #5: Plot of Averaged Absolute Values of E/spin and M/spin over four 1000-MCstep trials
considering last 800 points as equilibirum
#6: Both quantities e and m (average absolute equilibrium energy and magnetization,
respectively) decay monotonically with increasing temperature. At T=1.5, the
equilibrium state is highly ordered, with e almost equal to 4, its maximum (four
neighbors per spin), and m almost equal to 1, its maximum. As temperature increases
magnetization quickly drops to zero, as the increasing number oppositely magnetized
poles cancel out the dominant charge. The energy decreases as increasing temperatures
prevent the formation of any domains of significant size.
EC – periodic boundary condition achieved on the point level through the use of modular
division, and on the array level by convolution with four identical image matrices shifted
one unit in each of the four principal two-dimensional directions.
Code:
ising.m – for a gridsize LxL and a reduced temperature T, do an Ising model magnetic
spin simulation with periodic boundary condition for tmax Monte Carlo steps per spin
function [] = ising(L,T,tmax)
mov=moviein(tmax);
E = zeros(1,tmax);
M = zeros(1,tmax);
space = round(rand(L))*2-1;
%space = ones(L);
%for display
%init grid
hold on
%draw initial setup, store handles for future reference
handles = zeros(L);
for xloop = 1:L
for yloop = 1:L
if space(xloop,yloop) == -1
handles(xloop,yloop) = fill([xloop-1 xloop-1 xloop xloop],[yloop-1 yloop yloop yloop-1],'b');
else
handles(xloop,yloop) = fill([xloop-1 xloop-1 xloop xloop],[yloop-1 yloop yloop yloop-1],'y');
end
end
end
for step = 1:tmax
%main loop – once per Monte Carlo Step Per Spin
M(step) = sum(sum(space));
%Total Magnetization
Emat = space.*space(:,[2:L 1])+space.*space(:,[L 1:(L-1)])+space.*space([2:L 1],:)+space.*space([L 1:(L-1)],:);
E(step) = -sum(sum(Emat));
%Calculate Total Energy with periodic boundary conditions
for substep = 1:L*L
% subloop – L^2 times per main loop
tx = round(rand*L+0.5);
% pick a random tx,ty on 0-L and figure out neighbors with
txplus = mod(tx,L)+1;
% periodic boundary condition
txminus = mod(tx-2,L)+1;
ty = round(rand*L+0.5);
typlus = mod(ty,L)+1;
tyminus = mod(ty-2,L)+1;
e_old = space(tx,ty)*space(tx,typlus) + space(tx,ty)*space(tx,tyminus) + space(tx,ty)*space(txminus,ty) +
space(tx,ty)*space(txplus,ty);
% determine flip delta energy
de = 2*e_old;
if de<0
% if reduction in energy, flip tx,ty
space(tx,ty) = -space(tx,ty);
set(handles(tx,ty),'FaceColor',abs(get(handles(tx,ty),'FaceColor')-1));
elseif rand < exp(-de/T)
% if not a reduction in energy, flip with p = exp(-de/T)
space(tx,ty) = -space(tx,ty);
set(handles(tx,ty),'FaceColor',abs(get(handles(tx,ty),'FaceColor')-1));
end
end
mov(step) = getframe;
end
movie(mov)
Download