!--------------! module system !--------------! save integer :: nn integer :: nb integer :: zz integer, allocatable :: site(:,:) integer, allocatable :: hamx(:) integer, allocatable :: nxop(:) real(8), allocatable :: hamz(:) real(8), allocatable :: jbnd(:) complex(8), allocatable :: ff(:) complex(8), allocatable :: f0(:) complex(8), allocatable :: f1(:) complex(8), allocatable :: f2(:) real(8), allocatable :: sdat(:,:) end module system !-----------------! !--------------------! program timevolution !--------------------! use system; implicit none integer :: i,j,t,nt,wf,a0,bins,confs real(8) :: pn,hh,jj,dh1,dh2,dj1,dj2,tt,dt open(10,file='read.in',status='old') read(10,*)nn,pn read(10,*)tt,dt,wf read(10,*)bins,confs close(10) ! nn = number of spins ! pn = probability of negative couplings ! tt = integration time ! dt = integration time step ! wf = output results every wf time step ! bins = number of bins ! confs = number of disorder configs per bin call initran(1) call lattice() call makehamiltonian() nt=int(tt/dt+0.1d0) ! total number of RK integration steps allocate(sdat(2,nt/wf)); sdat=0.d0 do j=1,bins do i=1,confs call couplings(pn,a0) call initstate() do t=0,nt-1 call ramp(t,nt,hh,jj,dh1,dh2,dj1,dj2) call timestep(dt,hh,jj,dh1,dh2,dj1,dj2) if (mod(t+1,wf)==0) call savedata((t+1)/wf,a0) enddo enddo call writedata(nt/wf,confs) enddo end program timevolution !------------------------! !-------------------------! subroutine savedata(t,a0) !-------------------------! use system; implicit none integer :: a,t,a0 real(8) :: ez,p0 sdat(1,t)=sdat(1,t)+2.d0*abs(ff(a0))**2 sdat(2,t)=sdat(2,t)+sum(hamz(:)*abs(ff(:))**2)-hamz(a0) end subroutine savedata !-----------------------! !------------------------------! subroutine writedata(nt,confs) !------------------------------! use system; implicit none integer :: i,nt,confs sdat=sdat/dble(confs) open(10,file='res.dat',position='append') do i=1,nt write(10,'(i6,2f18.12)')i,sdat(:,i) enddo close(10) sdat=0.d0 end subroutine writedata !------------------------! !-------------------------------------------! subroutine ramp(t,nt,hh,jj,dh1,dh2,dj1,dj2) !-------------------------------------------! use system; implicit none integer :: t,nt real(8) :: ss,ds,hh,jj,dh1,dh2,dj1,dj2 ss=dble(t)/dble(nt) jj=ss hh=1.d0-ss ds=1.d0/dble(nt) dj1=0.5d0*ds dh1=-dj1 dj2=ds dh2=-dj2 end subroutine ramp !-------------------! !---------------------------------------------! subroutine timestep(dt,hh,jj,dh1,dh2,dj1,dj2) !------------------------------------------------------------------------------! ! Uses the RK method to integrate the Schrodinger equation by one time step dt ! !------------------------------------------------------------------------------! use system; implicit none integer :: i,j real(8) :: hh,jj,dh1,dh2,dj1,dj2,dt f2=ff f0=ff call hoperation(hh,jj) f1=-dt*(0,1)*f1 f2=f2+f1/6.d0 f0=ff+0.5d0*f1 call hoperation(hh+dh1,jj+dj1) f1=-dt*(0,1)*f1 f2=f2+f1/3.d0 f0=ff+0.5d0*f1 call hoperation(hh+dh1,jj+dj1) f1=-dt*(0,1)*f1 f2=f2+f1/3.d0 f0=ff+f1 call hoperation(hh+dh2,jj+dj2) f1=-dt*(0,1)*f1 f2=f2+f1/6.d0 ff=f2/sqrt(dot_product(f2,f2)) ! Explicit symmetrization of the state do i=0,2**nn-1 j=ieor(i,zz) if (i1) call sort(nxop(a),hamx(j-nxop(a)+1:j)) enddo end subroutine makehamiltonian !------------------------------! !--------------------! subroutine sort(n,a) !----------------------------! ! Based on Numerical Recipes. !----------------------------! implicit none integer :: i,j,l,n,ir,rra,a(n) l=n/2+1 ir=n do if (l>1) then l=l-1 rra=a(l) else rra=a(ir) a(ir)=a(1) ir=ir-1 if (ir==1) then a(1)=rra return endif endif i=l j=l+l do if (j<=ir) then if (j