1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Monte Carlo Simulation, Ising model in 2D

  1. Jun 11, 2017 #1
    1. The problem statement, all variables and given/known data
    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. Relevant 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.
     

    Attached Files:

  2. jcsd
  3. Jun 16, 2017 #2
    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.
     
  4. Jun 18, 2017 #3
    No, im still stuck atm. Cant get any reasonable graph. Is there someone that have done this type of simulation before ?
     
  5. Jul 9, 2017 #4
    Someone that knows what iam missing ?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Monte Carlo Simulation, Ising model in 2D
  1. 2d ising model, mft (Replies: 1)

  2. Ising model (Replies: 5)

Loading...