Monte Carlo Simulation, Ising model in 2D

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: 454
  • CvVsT.jpg
    CvVsT.jpg
    8.9 KB · Views: 494
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
 
##|\Psi|^2=\frac{1}{\sqrt{\pi b^2}}\exp(\frac{-(x-x_0)^2}{b^2}).## ##\braket{x}=\frac{1}{\sqrt{\pi b^2}}\int_{-\infty}^{\infty}dx\,x\exp(-\frac{(x-x_0)^2}{b^2}).## ##y=x-x_0 \quad x=y+x_0 \quad dy=dx.## The boundaries remain infinite, I believe. ##\frac{1}{\sqrt{\pi b^2}}\int_{-\infty}^{\infty}dy(y+x_0)\exp(\frac{-y^2}{b^2}).## ##\frac{2}{\sqrt{\pi b^2}}\int_0^{\infty}dy\,y\exp(\frac{-y^2}{b^2})+\frac{2x_0}{\sqrt{\pi b^2}}\int_0^{\infty}dy\,\exp(-\frac{y^2}{b^2}).## I then resolved the two...
Hello everyone, I’m considering a point charge q that oscillates harmonically about the origin along the z-axis, e.g. $$z_{q}(t)= A\sin(wt)$$ In a strongly simplified / quasi-instantaneous approximation I ignore retardation and take the electric field at the position ##r=(x,y,z)## simply to be the “Coulomb field at the charge’s instantaneous position”: $$E(r,t)=\frac{q}{4\pi\varepsilon_{0}}\frac{r-r_{q}(t)}{||r-r_{q}(t)||^{3}}$$ with $$r_{q}(t)=(0,0,z_{q}(t))$$ (I’m aware this isn’t...
Hi, I had an exam and I completely messed up a problem. Especially one part which was necessary for the rest of the problem. Basically, I have a wormhole metric: $$(ds)^2 = -(dt)^2 + (dr)^2 + (r^2 + b^2)( (d\theta)^2 + sin^2 \theta (d\phi)^2 )$$ Where ##b=1## with an orbit only in the equatorial plane. We also know from the question that the orbit must satisfy this relationship: $$\varepsilon = \frac{1}{2} (\frac{dr}{d\tau})^2 + V_{eff}(r)$$ Ultimately, I was tasked to find the initial...
Back
Top