Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. implicit none
  2.  
  3. !Déclaration
  4. integer lx, ly, n, i,x,y,t,tt,ttt,tmax,ttmax
  5. parameter (lx=40,ly=lx,n=lx*ly,tmax=100,ttmax=10000)
  6. integer spin(0:n-1),s1,s2,s3,s4,ss,s
  7. real (8) r,rr(0:n-1),temp,pflip(-1:1,-4:4),m
  8. parameter (temp=0.59)
  9.  
  10. !Initialisation
  11. forall (s=-1:1,ss=-4:4) pflip(s,ss)=exp(-s*ss/temp)
  12. call random_number (rr); spin=2*int(2*rr)-1
  13.  
  14. !externe
  15. do t=1,tmax ! de temps en temps, on mesure et écrit sur le disque
  16.     m=0.d0 !Initialisation de l'aimentation
  17.  
  18.     !moyenne
  19.     do tt=1,ttmax !évolution sans mesure
  20.  
  21.         !interne
  22.         do ttt=0,n-1 !n=nombre de spins
  23.         !Chaque spin n a une chance d'être mis à jour
  24.         call random_number (r);i=int(n*r)
  25.         x=mod(i,lx)
  26.         y=i/lx
  27.         s1=spin(modulo(x+1,lx)+y*lx) !le spin à l'Est
  28.         s2=spin(x+modulo(y+1,ly)*lx) !le spin au Nord
  29.         s3=spin(modulo(x-1+lx,lx)+y*lx) !le spin à l'Ouest
  30.         s4=spin(modulo(y-1+ly,ly)*lx) !le spin au Sud
  31.         call random_number (r)
  32.     if(r<pflip(spin(i),s1+s2+s3+s4)) spin(i)=-spin(i)
  33.     enddo
  34.     m=m+sum(spin)*1.0/n
  35.     write (1,*) m/ttmax
  36.     enddo
  37. enddo
  38.  
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement