Skip to content

Commit

Permalink
correctly close stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Jackson committed Feb 15, 2024
1 parent 8e61b0e commit 57d5621
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/wannier_prog.F90
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ program wannier
! open main output file
open (newunit=stdout, file=seedname//'.wout', status="replace")
! open main error file
open (newunit=stderr, file=seedname//'.werr', status="replace")
call w90_get_fortran_stderr(stderr)
if (rank == 0) open (newunit=stderr, file=seedname//'.werr', status="replace")

call io_date(cdate, ctime)
write (stderr, *) 'Wannier90: Execution started on ', cdate, ' at ', ctime
if (rank == 0) write (stderr, *) 'Wannier90: Execution started on ', cdate, ' at ', ctime

call input_reader_special(common_data, seedname, stdout, stderr, ierr)
if (ierr /= 0) stop
Expand Down Expand Up @@ -163,7 +164,7 @@ program wannier
! please only invoke on rank 0
call write_kmesh(common_data, stdout, stderr, ierr)
if (ierr /= 0) stop
!if (rank == 0) close (unit=stderr, status='delete')
if (rank == 0) close (unit=stderr, status='delete')
#ifdef MPI
call mpi_finalize(ierr)
#endif
Expand Down Expand Up @@ -286,7 +287,7 @@ program wannier
endif

call print_times(common_data, stdout)
!if (rank == 0) close (unit=stderr, status='delete')
if (rank == 0) close (unit=stderr, status='delete')
#ifdef MPI
call mpi_finalize(ierr)
#endif
Expand Down

0 comments on commit 57d5621

Please sign in to comment.