anchor.diff:          else if (.not. init .and. write_determinants .and. parent) then
               ! Output the determinants.
               fmt1 = int_fmt(ndets, padding=1)
  +            det_unit = get_free_unit()
  +            open(det_unit, file=determinant_file, status='unknown', position='append')
               do i = 1, ndets
                   write (det_unit,'('//fmt1//',4X)',advance='no') i
                   call write_det(sys%basis, sys%nel, dets_list(:,i), det_unit, new_line=.true.)
               end do
  +            close(det_unit, status='keep')
           end if
   
           deallocate(occ, stat=ierr)
  
positive.code: 
          use utils, only: get_free_unit
  
          if (write_determinants) then
              det_unit = get_free_unit()
              open(det_unit, file=determinant_file, status='unknown')
          end if
  
      end subroutine init_determinant_enumeration
  
      subroutine end_determinant_enumeration()
  
          ! Clean up.
  
          if (write_determinants) close(det_unit, status='keep')
  
      end subroutine end_determinant_enumeration
  
  !--- Hilbert space enumeration ---
  
  
negative.code: ! If true then the determinant list is written to determinant_file.
  logical :: write_determinants = .false.
  character(255) :: determinant_file = 'DETS'
  
  contains
  
  