c******************************************************* c out_juxta_distance(n,ntime) c c np600=0 output: 1. if a pair has the distance below the criterique c record them into npairs and outputting the the c trajectories until the distance is larger than 3 c critical length c 2. nflag(ijudge)=0 no pair into this distance c .. =1 right inside c .. =2 out of the range c if all the criteria are checked once, (all flags are 2) c stop the trajectory. subroutine out_juxta_distance(n,ntime) implicit double precision(a-h, o-z) parameter(maxpair=100,maxa=500,maxjudge=10) common /juxtapair/ npair,npairs(maxpair,2),nflag(maxpair,maxjudge) +,njudge, sjuxta_judge(maxjudge),mp(maxpair) common/matrix/x(maxa,3),bangle(maxa) c 1. check if some flags are still 0, and if all 2, stop mtmp=0 kflag=0 mmax=2*njudge do i=1,njudge if (nflag(1,i).eq.0) then kflag=1 endif mtmp=mtmp+nflag(1,i) enddo if (mtmp.eq.mmax) then stop endif c 2. when flag=0 searching for good pair candidates rrmin=100 minpair1=0 minpair2=0 if (kflag.eq.1) then inter=5 do i=1,n-inter jmax=min(n,n-inter+i) do j=i+inter,jmax rr=0 do k=1,3 rr=rr+(x(i,k)-x(j,k))*(x(i,k)-x(j,k)) enddo if (rr.lt.rrmin) then rrmin=rr minpair1=i minpair2=j endif enddo enddo rrmin=dsqrt(rrmin) c write(*,*) ntime, minpair1,minpair2,rrmin do i=1,njudge if ((nflag(1,i).eq.0).and.(rrmin.le.sjuxta_judge(i))) then nflag(1,i)=1 npairs(i,1)=minpair1 npairs(i,2)=minpair2 mp(i)=600+i write(888,*) minpair1,minpair2,mp(i),sjuxta_judge(i) call flush(888) sjuxta_judge(i)=sjuxta_judge(i)*3.0 c start a monitor c the inside and outside criteria are different by the factor of 3 endif enddo endif c 3. check the pairs inside nflag(1,i)=1 c if distance is inside the range, output into mp(i) c otherwise stop the output and set nflag(1,i)=2 do i=1,njudge if (nflag(1,i).eq.1) then rr=0 do j=1,3 rr=rr+(x(npairs(i,1),j)-x(npairs(i,2),j))*(x(npairs(i,1),j) + -x(npairs(i,2),j)) enddo rr=dsqrt(rr) if (rr.lt.sjuxta_judge(i)) then write(mp(i),700) npairs(i,1),npairs(i,2),ntime,rr call flush(mp(i)) else nflag(1,i)=2 endif endif enddo 700 format(i5,1x,i5,1x,i8,1x,g11.5) return end