anchor.diff:    CALL write_tfile(iframe,t,mfields,ngrids,dir3)
     CALL new_qfile(iframe,dir3)
   
  +  ALLOCATE(grid_max(mfields),global_max(mfields))
     grid_max = 0
  -  field_max = 0
     global_max = 0
   
     OPEN(10,file=dir1_fname1)
  
positive.code:               q(i,j,mq) = 0.d0
             ENDIF
          END DO
          WRITE(fid_com,120) INT(q(i,j,1)), (q(i,j,mq),mq=1,mfields-1)
       ENDDO
       WRITE(fid_com,*) ' '
    ENDDO
  
negative.code:   CLOSE(10)
    CLOSE(20)
  
    WRITE(6,*) ' '
    DO m = 1,mfields
       WRITE(6,150) global_max(m), m, grid_max(m)
    ENDDO
  
    WRITE(6,*) ' '
    OPEN(30,file=dir3_fname3)
    DO m = 1,mfields
       WRITE(30,150) global_max(m), m, grid_max(m)
    ENDDO
    WRITE(30,*) ' '
  
    DO n = 0,ngrids-1
       WRITE(30,'(I5,10E16.4)') n, (max_grids(n,m),m=1,mfields)
    ENDDO
    CLOSE(30)
  130 FORMAT(E30.16,'     ',A)
  140 FORMAT(I30,   '     ',A)
  150 FORMAT(E30.16, '     occurs in field',I5,' on grid ',I5)
  
  END PROGRAM compare_files
  
  