      PROGRAM SEQUENCE
      DATA LP /19/
      
      CALL OPEN_SEQ_DIRECTORY()
      DO ISEQ = 1,10
      CALL OPEN_SEQ_FILE(LP,ISEQ)
      WRITE(LP,'("Number of particles = ", I10)') 100
      CLOSE(UNIT=LP)
      ENDDO
      
      STOP
      END
      
      SUBROUTINE OPEN_SEQ_DIRECTORY()
C     make sure there is a Cfgs/ directory
      CALL SYSTEM('sh -c "if [ ! -d Cfgs ]; then mkdir Cfgs ; fi"')
      RETURN
      END
      
      SUBROUTINE OPEN_SEQ_FILE(LP,ISEQ)
      INTEGER LP,ISEQ
      CHARACTER *79 FILENAME
      WRITE (FILENAME, '("Cfgs/", I7.7, ".cfg")'), ISEQ
      OPEN (UNIT=LP,STATUS='UNKNOWN',FORM='FORMATTED',FILE=FILENAME)
      RETURN
      END

C     f77 sequence.f -o sequence ; sequence
      
