Register to reply

Matlab Ising model: Anti-ferromagnet

by Beer-monster
Tags: antiferromagnet, ising, matlab, model
Share this thread:
Beer-monster
#1
Nov5-11, 09:44 PM
P: 293
Hi

I'm working on a matlab simulation of the 2D Ising model, and would like to verify my code and its results. One thing I'd like to try and observe is the transition from anti-ferromagnet to ferromagnet, but I'm not sure how to create the initial lattice in Matlab. I've already made a (pseudo)random lattice of spins and one that starts as a ferromagnet.

In other words, how can I create a lattice with alternating elements (1s and -1s)?

Also, is there a way to plot or graph my matrix as a colour/greyscale grid, so that -1s are black and +1s are black say? Currently I've used a surface plot but have to rotate the 3D image to a plan view.
Phys.Org News Partner Science news on Phys.org
Scientists develop 'electronic nose' for rapid detection of C. diff infection
Why plants in the office make us more productive
Tesla Motors dealing as states play factory poker
Beer-monster
#2
Nov6-11, 04:55 PM
P: 293
As an additional point. I'd also like to calculate the thermal average of magnetisation and Energy [itex]<M>,<E>[/itex] as a function of temperature. I'm not quite sure how to do this with a Monte Carlo algorithm, without a partition function. Is the best way to run the alogrithm for different temperatures then average the results for each temperature?
Pythagorean
#3
Nov6-11, 06:01 PM
PF Gold
Pythagorean's Avatar
P: 4,287
Quote Quote by Beer-monster View Post
In other words, how can I create a lattice with alternating elements (1s and -1s)?
If I understand what you're asking for (a checkerboard pattern?)
Y = zeros(m,n) %make a mxn matrix of zeros

%now make checkerboard 1,-1
Y(1:2:end,1:2:end) = 1
Y(2:2:end,1:2:end) = -1
Y(1:2:end,2:2:end) = -1
Y(2:2:end,2:2:end) = 1
Also, is there a way to plot or graph my matrix as a colour/greyscale grid, so that -1s are black and +1s are black say? Currently I've used a surface plot but have to rotate the 3D image to a plan view.
try "doc imagesc"
you can call options to customize the colors, read up on it.

Beer-monster
#4
Nov7-11, 08:42 PM
P: 293
Matlab Ising model: Anti-ferromagnet

Thanks for the tip. That did the trick nicely. The simulation is showing the wrong behaviour but the graphs look good

Does anyone have any tips for debugging a code in matlab, I'm really not seeing my error at the moment.
Pythagorean
#5
Nov8-11, 09:13 PM
PF Gold
Pythagorean's Avatar
P: 4,287
Just follow the input/output chain backwards (pause ad display function can help with this).


Register to reply

Related Discussions
Ising model on GPU Science & Math Textbooks 0
Ising model Atomic, Solid State, Comp. Physics 3
About ising model Atomic, Solid State, Comp. Physics 12
Ising Model Atomic, Solid State, Comp. Physics 6
2d ising model, mft Advanced Physics Homework 1