• Support PF! Buy your school textbooks, materials and every day products via PF Here!

Monte Carlo Simulation, Ising model in 2D

  • Thread starter Firben
  • Start date
145
0
1. Homework Statement
Lo,Im stuck on how to retrieve the specific heat capacity from an MC simulation, with the metropolis algorithm. I want my graph to look something like this:
https://i.stack.imgur.com/NXeXs.png

2. Homework Equations
C_v = ((<E^2>-<E>^2)/T^2

3. The Attempt at a Solution

My code is similar to this guy:
but without magnetization

To retrieve C_v i wrote the following code to 4:19 from the video above.

Cv = (E2/16384 - E.*E/16384^2)./(T(i).^2);

plot(T,Cv);


Where E2 is given by the code:

function [E2] = ising_energy(u,J)

[L1,L2] = size(u);
E2=0;
for i=1:L1
for j=1:L2
f1i=mod(i,L1)+1;
f2j=mod(j,L2)+1;
forward_neighbors=u(f1i,j)+u(i,f2j);
E2=E2-(J*u(i,j)*forward_neighbors)*(J*u(i,j)*forward_neighbors);


end;clear j
end;clear i

However my graph looks more like the plot of <E> vs T.
 

Attachments

1,415
9
Thanks for the thread! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post? The more details the better.
 
145
0
No, im still stuck atm. Cant get any reasonable graph. Is there someone that have done this type of simulation before ?
 
145
0
Someone that knows what iam missing ?
 

MohammadJCM

Want to reply to this thread?

"Monte Carlo Simulation, Ising model in 2D" You must log in or register to reply here.

Related Threads for: Monte Carlo Simulation, Ising model in 2D

  • Posted
Replies
1
Views
5K
Replies
0
Views
1K
  • Posted
Replies
5
Views
2K
  • Posted
Replies
0
Views
907
  • Posted
Replies
0
Views
4K
Replies
1
Views
1K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top