Fortran runtime error: Sequential READ or WRITE not allowed

  • #1
3
0

Main Question or Discussion Point

Dear Forum users,

I am running a program called NMTO package for constructing Wannier functions for a material. It uses a code plotnmto.f90 to calculate wannier isosurfaces within the mesh defined by me. I compiled the code in gfortran. After defining the mesh when I ran the program for Wannier functions I get the error

At line 329 of file NMTO/plotnmto.f90 (unit = 999, file = 'RHOF')
Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE

I searched in the forum and I find some similar error for gfortran but I am unable to find the error in the code. As I know there are many fortran program experts in the forum I would like to request if you could help me to solve this error .

Thanking you in advance,

Santu Baidya
 

Answers and Replies

  • #2
11,830
5,453
Check that your data file is properly setup. Compare it to a known working datafile. Perhaps you are missing some sort of sentinel card/line at the end of the file, some fortran programs would look for a special end card/line starting with '***end' or '99999999' or something like that. If you have the source code you can look at where things are read and see if there is a loop that terminates when a specific piece of data is read.

By known working datafile I mean one that the NMTO program processes without error.
 
  • #3
33,648
5,317
At line 329 of file NMTO/plotnmto.f90 (unit = 999, file = 'RHOF')
Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE
This error is pretty straightforward. Once you have read all of the data in a file, and so are at the end of the file (EOF), it is an error to attempt to read in a sequential fashion (i.e., from beginning of file toward the end) additional data from the file.

I'm not sure why this error would arise if you're writing to a file, unless possibly you're writing to a file that already exists. If you write to a newly created file, the beginning of the file is also the end of the file.
 

Related Threads on Fortran runtime error: Sequential READ or WRITE not allowed

  • Last Post
Replies
17
Views
840
Replies
5
Views
943
  • Last Post
Replies
12
Views
5K
  • Last Post
Replies
13
Views
6K
Replies
2
Views
19K
Replies
2
Views
7K
Replies
19
Views
3K
Replies
1
Views
2K
  • Last Post
Replies
7
Views
7K
  • Last Post
Replies
1
Views
4K
Top