Monte Carlo Simulation, Ising model in 2D

Click For Summary

Homework Help Overview

The discussion revolves around retrieving specific heat capacity from a Monte Carlo simulation of the Ising model in two dimensions using the Metropolis algorithm. The original poster expresses difficulty in achieving the desired graph output related to specific heat capacity.

Discussion Character

  • Exploratory, Problem interpretation, Assumption checking

Approaches and Questions Raised

  • The original poster attempts to calculate specific heat capacity using a formula involving energy averages but notes that their graph resembles the plot of average energy versus temperature instead. Other participants inquire about the original poster's code and express their own struggles with similar simulations.

Discussion Status

The discussion is ongoing, with participants seeking clarification and assistance regarding the implementation of the simulation and the calculation of specific heat capacity. There is no clear consensus or resolution yet, but some guidance has been sought regarding the code and methodology.

Contextual Notes

Participants are working under the constraints of homework assignments, which may limit the information they can share or the depth of their inquiries. The original poster's code appears to be influenced by external resources, and there is a focus on troubleshooting specific aspects of the simulation.

Firben
Messages
141
Reaction score
0

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

Homework Equations


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

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

  • EVsT.jpg
    EVsT.jpg
    10.5 KB · Views: 469
  • CvVsT.jpg
    CvVsT.jpg
    8.9 KB · Views: 518
Physics news on Phys.org
No, I am still stuck atm. Cant get any reasonable graph. Is there someone that have done this type of simulation before ?
 
Someone that knows what iam missing ?
 
Firben said:
Someone that knows what iam missing ?
where is your code?
 
MohammadJCM said:
where is your code?
I solved it
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
6
Views
2K
Replies
1
Views
920