Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- implicit none
- !Déclaration
- integer lx, ly, n, i,x,y,t,tt,ttt,tmax,ttmax
- parameter (lx=40,ly=lx,n=lx*ly,tmax=100,ttmax=10000)
- integer spin(0:n-1),s1,s2,s3,s4,ss,s
- real (8) r,rr(0:n-1),temp,pflip(-1:1,-4:4),m
- parameter (temp=0.59)
- !Initialisation
- forall (s=-1:1,ss=-4:4) pflip(s,ss)=exp(-s*ss/temp)
- call random_number (rr); spin=2*int(2*rr)-1
- !externe
- do t=1,tmax ! de temps en temps, on mesure et écrit sur le disque
- m=0.d0 !Initialisation de l'aimentation
- !moyenne
- do tt=1,ttmax !évolution sans mesure
- !interne
- do ttt=0,n-1 !n=nombre de spins
- !Chaque spin n a une chance d'être mis à jour
- call random_number (r);i=int(n*r)
- x=mod(i,lx)
- y=i/lx
- s1=spin(modulo(x+1,lx)+y*lx) !le spin à l'Est
- s2=spin(x+modulo(y+1,ly)*lx) !le spin au Nord
- s3=spin(modulo(x-1+lx,lx)+y*lx) !le spin à l'Ouest
- s4=spin(modulo(y-1+ly,ly)*lx) !le spin au Sud
- call random_number (r)
- if(r<pflip(spin(i),s1+s2+s3+s4)) spin(i)=-spin(i)
- enddo
- m=m+sum(spin)*1.0/n
- write (1,*) m/ttmax
- enddo
- enddo
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement