How to read data from a file as particle energy?

I use source.f as user source, the code can be compiled, but when running the fluka application, the error occurs:

======================== Running FLUKA for cycle # 1 ========================
Error: “/home/llh/Fluka/Projection/Li6Chamber/source” executable returned RC=2

but with the array concerning the data in the file, everythings work ok.
and i write the fortran code similar for fluka of INFN version, it works well.
and it write a special fortran code to check out “reading the data from the file”, it works well.

the source.f code and the data file are uploaded, i rename the data file from STARGET_144KEV.ENE to STARGET_144KEV.txt for uploading.
it seems some special detail need to do, what is wrong with my fortran code?

STARGET_144KEV.txt (12.7 KB)
source.f (11.2 KB)

Dear Siyuan,

the actual error message is located in the temporary folder fluka_xxxxx in the .log file. It shows that the splitting of filename/path into two lines creates the problem.

You can:

  • merge the two lines into one, as FLUKA allows 132 character in one line, or
  • terminate the strings on both lines, and use the // operator to concatenate them.

Furthermore, you may want to move the code block reading from the file under the First call initializations section, so it won’t need to access the file on each call. This would help to speed up your simulation.
You can save the variables between calls with the use of the SAVE statement at the variable declarations.


@ Dávid Horváth,thanks!