Skip to main content

TOTAL ISING ENERGY


function E=Ising_Energy(lattice,i,j,rneigh)
H=2; ## applied magnetic field times permeability[joule]
E=0; ## initial configuration energy[joule]
J0=1 ## coupling constant of function J, normaly in joule.
alpha=2 ## exponential constant of function J.
L=length(lattice); ## number of particles or spins in lattice
for r=1:rneigh
NN1=mod(j+r,L); NN1+=(NN1==0)*L;
NN2=mod(j-r,L); NN2+=(NN2==0)*L;
NN3=mod(i+r,L); NN3+=(NN3==0)*L;
NN4=mod(i-r,L); NN4+=(NN4==0)*L;
J=coupling(rneigh,J0,alpha);
dE=J*(lattice(i,NN1)+lattice(i,NN2)+
lattice(NN3,j)+lattice(NN4,j))-H*(sum((rand(L)>0.5)*2-1));
E+=-1*dE
endfor
endfunction

Comments

Popular posts from this blog

Second Harmonic Generation N=1:21

gnuplot> set xrange [-180:180] gnuplot> set yrange [-180:180]

splot sin(cos(x*pi/180))*sin(cos(x*pi/180))/(cos(x*pi/180)*cos(x*pi/180))*sin(cos(y*pi/180))*sin(cos(y*pi/180))/(cos(y*pi/180)*cos(y*pi/180))+sin(cos((x+1)*pi/180))*sin(cos((x+1)*pi/180))/(cos((x+1)*pi/180)*cos((x+1)*pi/180))*sin(cos((y+1)*pi/180))*sin(cos((y+1)*pi/180))/(cos((y+1)*pi/180)*cos((y+1)*pi/180))+sin(cos((x+2)*pi/180))*sin(cos((x+2)*pi/180))/(cos((x+2)*pi/180)*cos((x+2)*pi/180))*sin(cos((y+2)*pi/180))*sin(cos((y+2)*pi/180))/(cos((y+2)*pi/180)*cos((y+2)*pi/180))+sin(cos((x+3)*pi/180))*sin(cos((x+3)*pi/180))/(cos((x+3)*pi/180)*cos((x+3)*pi/180))*sin(cos((y+3)*pi/180))*sin(cos((y+3)*pi/180))/(cos((y+3)*pi/180)*cos((y+3)*pi/180))+sin(cos((x+4)*pi/180))*sin(cos((x+4)*pi/180))/(cos((x+4)*pi/180)*cos((x+4)*pi/180))*sin(cos((y+4)*pi/180))*sin(cos((y+4)*pi/180))/(cos((y+4)*pi/180)*cos((y+4)*pi/180)) +sin(cos((x+5)*pi/180))*sin(cos((x+5)*pi/180))/(cos((x+5)*pi/180)*cos((x+5)*pi/180))*sin(cos((y+5)*pi/180))*sin(cos(…

Second Harmonic Generation

gnuplot> set xrange [-180:180] gnuplot> set yrange [-180:180] gnuplot> set pm3d gnuplot> set hidden3d  gnuplot> set title 'SHG' gnuplot> splot sin(cos(x*pi/180))*sin(cos(x*pi/180))/(cos(x*pi/180)*cos(x*pi/180))*sin(cos(y*pi/180))*sin(cos(y*pi/180))/(cos(y*pi/180)*cos(y*pi/180)) title 'N=1
'