
!C----------------------------------------------------------------------C
!C                                                                      C
!C  Make a picture of the configuration in PPM format (readable by xv)  C
!C                                                                      C
!C----------------------------------------------------------------------C
 
      SUBROUTINE picture
      USE global_variables
      INTEGER i, j

      WRITE(9,100)  
  100 FORMAT('P6' )
      WRITE(9,101)
  101 FORMAT('# 2d Potts Model')
      WRITE(9,*) dim, dim
      WRITE(9,*) 127
      DO i=0,dimm1
      DO j=0,dimm1
        IF ( spin(i,j) == -1 ) THEN
          WRITE(9,'(3A1)',ADVANCE='NO')achar(0),achar(0),achar(0)
        ELSE IF ( spin(i,j) == 1 ) THEN
          WRITE(9,'(3A1)',ADVANCE='NO')achar(127),achar(127),achar(127)
        ELSE
          WRITE(9,'(3A1)',ADVANCE='NO')achar(0), achar(127),achar(0)
        ENDIF
      ENDDO
      ENDDO

      RETURN
      END SUBROUTINE

