Revisiting Relative Path Opening

As a follow up to the bug reported in Relative Path in OPEN Card and the statement in the recent update Release of FLUKA 4-4.0 that said

Fixed the bug reported in this forum thread, whereupon relative paths are now accepted (in the form of strings between quotation marks) as #define variable values.

I made an attempt to use path. However, I have not succeeded. I tried both single and double quotes as shown in the attached images but I get the following error

*** Invalid character / in the value…/Sector_PSWrite/MorpSmall_100keV_R0mm_SecB_part1.phsspc ***
*** of a define directive, execution stopped ***

Am I doing something incorrectly?


Dear Dirk,

Could you please share your input file? (Of course, I am assuming you are using FLUKA v4-4.0).

Best regards,

Attached is the .flair file and other fortran files needed to compile the executable needed to run. Also attached a phase space file to be used assuming it is located in a folder above the run folder.

I am running FLUKA 4-4.0 with Flair 3.3-1.

PhaseSpaceFile.txt (232.4 KB)
FLUKAtest.flair (47.6 KB)
mgdraw.phasespace.f (12.5 KB)
source_Bias.phasespace_events_fix.f (21.4 KB)
usrout.f (2.5 KB)

Dear Dirk,

Thanks for your reply.

  • The way you set the relative path value to the define directive with Flair (and use the variable in your input file) looks totally fine.
    With a simple input file containing this configuration, I could not reproduce any file opening issue (FLUKA 4-4.0 and Flair 3.3-1).

  • With your user routines instead (you forgot to share, included by source_Bias.phasespace_events_fix.f: I Included instead), I got:

 # Reading of phase space file requested
 *** Impossible to open file ***
 *** on unit    1 ***
 Abort called from read_phase_space_file reason Unable to open phase space file Run stopped!
 STOP Unable to open phase space file

This happens to be thrown from in read_phase_space_file, an OAUXFI tries to open the file from the file name only, not the relative path, hence the error. This occurs because in source_Bias.phasespace_events_fix.f, the relative path is trimmed to the file name only (which is then passed to read_phase_space_file). Removing the trimming in source_Bias.phasespace_events_fix.f fixed it:

*              filedelimpos = SCAN(phase_space_pathfile, "/", .TRUE.)
*              phase_space_file = phase_space_pathfile(filedelimpos+1:len(phase_space_pathfile))
              phase_space_file = phase_space_pathfile

However, you get a different error, possibly stemming from a similar issue. Would need to have to be able to conclude: please share it (along with your output files) if still needed.
In the meantime, I take note that the variable filename in read_phase_space_file should be renamed filepath.


1 Like

I forgot about my modified INCLUDE file. Here it is. (35.0 KB)

I aslo forgot about the trimming in source_Bias.phasespace_events_fix.f.

Dear Dirk,

Thanks for sharing the file. I tested it out: apart from the needed fix mentioned above, evth still runs properly with your configuration.

Are you really sure that you are using FLUKA v4-4.0? Could you please check by clicking Parameters (button at the bottom right) and updating paths in the FLUKA tab?
And checking the release by printing the top of RELEASE-NOTES in your fluka repo.


Thank you. After implementing removal of my TRIM lines, it seems to be working correctly.

1 Like

Ok great!
Yes, outside of the TRIM issue, the Invalid character / error could only come from a non v4-4.0 release, since the code throwing this error message was removed in v4-4.0.
Glad evth is working now!