Fortran runtime error( End of file) when using source.f to read a file with OPEN card

Dear FLUKA experts,

I was trying to read a file in source.f with OPEN card. The .dat file contains two group of numbers in pair. I used OPEN card and read them in source.f. In source.f , two numbers as a line was read at first. And Then this line was read as internal file and seperate into two numbers.
Source.f file can be compiled successful. But error message showed when running it. In log file, it showed “At line 78 of file source_RIFI.f Fortran runtime error: End of file”. I check the files and can’t find the problem. Could you please help me to find the mistake?

I attached inp, source and dat files. Thanks in advance for your help.

RIFI6.dat (4.5 KB)
source_RIFI.f (10.3 KB)
test.flair (2.0 KB)
test.inp (2.6 KB)
test001.log (532 Bytes)


Dear Jingfang,

the issue seems to be with the encoding of the file. According to my editor it is UTF-16 LE. When I change it to UTF-8, then the Fortran code can read the lines, but there are other errors in the code which prevents FLUKA to run.


Dear David,

Thanks for your quick reply. Your suggestion is very useful. I changed all .dat and source.f file to UTF-8. Then I can print information in log file. According to this, i fixed the errors in the code. Now it runs well.