      SUBROUTINE MNFOPN(NMUNIT)
      
      INTEGER NMUNIT
      CHARACTER*13  FNAME
      
      FNAME = 'mn_output.log'
      
      OPEN (UNIT = NMUNIT, FILE = FNAME)
      RETURN
      END

      
      
C Perform a flush simply by closing and reopening the file,
C then repositioning at the end.  This is not very efficient since
C it must reread the entire file each time called, but it ought
C to work independently of platform and Fortran version (unlike
C something such as setting ACCESS='APPEND' or POSITION='APPEND'
C in the call to OPEN).  This is based on a code sample in 
C "Fortran77" by Meissner and Organick, Ch. 9.5.

      SUBROUTINE MNFLSH(NMUNIT, IERR)
      
      INTEGER NMUNIT, IERR
      CHARACTER*13 FNAME
      INTEGER*4 CUTOFF, LOOP
      
      FNAME = 'mn_output.log'
      CUTOFF = 100000
      IERR = 0
      
C This ASSUMES the file is already open
      CLOSE(NMUNIT)
      OPEN(UNIT = NMUNIT, FILE = FNAME)
      DO 10, LOOP = 1, CUTOFF
      READ(NMUNIT,'( )', END=20)
 10   CONTINUE
      IERR = 1
 20   CONTINUE
      BACKSPACE(NMUNIT)
            
      RETURN
      END
      
