!----------------------! module systemvariables !----------------------! implicit none integer :: d integer :: n integer :: nbors real(8) :: bprob integer, allocatable :: l(:) integer, allocatable :: neighbor(:,:) integer, allocatable :: bondspin(:,:) integer, allocatable :: spinbond(:,:) logical, allocatable :: notvisited(:) integer, allocatable :: stack(:) integer, allocatable :: spin(:) logical, allocatable :: bond(:) end module systemvariables !--------------------------! !-------------------------------------------------------------------! !Monte carlo simulation of the d-simensional (d=1,2,3) Ising model ! !based on the Swendesen-Wang cluster algorithm. An arbitrary number ! !of temperature can be studied. Input is read from 'ising.in'; ! ! d = dimensionality (1,2,3) ! ! lx,..,lz = lengths in the x,y,z directions ! ! nt = number of temperatures ! ! t_i,bins_i,steps_i = T/J, number of bins, MC step per bin ! ! (one line for each temperarure) ! !Random number seed (4 integers on separate lines) from 'seed.in' ! !Output is given in 'bindata.dat', which should be processed by ! !the program 'multiaverage.f90'. The quantities calculated are: ! ! - the energy ! ! - the energy squared ! ! - absolute value of the magnetization ! ! - squared magnetization (using standard and improved estimators) ! !-------------------------------------------------------------------! program isingsw !---------------! use systemvariables implicit none integer :: i,j,it,nt,bins,steps real(8) :: mag2 real(8), allocatable :: temp(:) open(unit=1,file='ising.in',status='old') read(1,*)d; allocate(l(d)) read(1,*)l read(1,*)bins,steps read(1,*)nt allocate(temp(nt)) do i=1,nt read(1,*)temp(i) end do close(1) call initrand(1) call initarrays call lattice do it=1,nt bprob=1.d0-exp(-2.d0/temp(it)) do i=1,steps/4 call castbonds call flipclusters(mag2) end do do j=1,bins call resetbindata do i=1,steps call castbonds call flipclusters(mag2) call measure(mag2) end do call writebindata(it,n,steps) end do end do deallocate(temp) call cleanup end program isingsw !-------------------! !--------------------! subroutine castbonds !--------------------! use systemvariables implicit none integer :: b real(8) :: rand external :: rand do b=0,d*n-1 if (spin(bondspin(1,b))==spin(bondspin(2,b))) then if (rand()