# Revisiting Relative Path Opening

**URL:** <https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805>\
**Category:** Flair\
**Created:** [13 March 2024 17:06 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805 "2024-03-13T17:06:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/dirk.a.bartkoski/32/697_2.png) [@Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/u/Dirk.A.Bartkoski)\
**Post date:** [13 March 2024 17:06 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/1 "2024-03-13T17:06:07Z")

</div>

As a follow up to the bug reported in [Relative Path in OPEN Card](https://fluka-forum.web.cern.ch/t/relative-path-in-open-card/5160) and the statement in the recent update [Release of FLUKA 4-4.0](https://fluka-forum.web.cern.ch/t/release-of-fluka-4-4-0/5686) that said

> Fixed the bug reported in [this forum thread](https://fluka-forum.web.cern.ch/t/relative-path-in-open-card/5160), 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?

![FlukaErrorCards](https://fluka-forum.web.cern.ch/uploads/default/original/2X/3/3981fcb621803c20075d0901d3a1c8bb3b2e1199.png)

 ![FlukaErrordouble](https://fluka-forum.web.cern.ch/uploads/default/original/2X/2/2cb64a8e1a544c230a9706a2d3ef8c8d0b3e93b4.png)  
 ![FlukaErrorsingle](https://fluka-forum.web.cern.ch/uploads/default/original/2X/3/3cb186327b762cecd08a92badc7258ec358d6c64.png)

---

<div class="post-metadata">

**Author:** ![ghugo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/g/35a633/32.png) [@ghugo](https://fluka-forum.web.cern.ch/u/ghugo)\
**Post date:** [20 March 2024 15:23 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/3 "2024-03-20T15:23:27Z")

</div>

Dear Dirk,

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

Best regards,  
Gabrielle

---

<div class="post-metadata">

**Author:** ![Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/dirk.a.bartkoski/32/697_2.png) [@Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/u/Dirk.A.Bartkoski)\
**Post date:** [25 March 2024 14:56 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/4 "2024-03-25T14:56:36Z")

</div>

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](https://fluka-forum.web.cern.ch/uploads/short-url/tmUZ5pg0k5AIJRn178A97LGGrye.txt) (232.4 KB)  
[FLUKAtest.flair](https://fluka-forum.web.cern.ch/uploads/short-url/ppcsteQ6NkNsE505sR6nEJZFKwG.flair) (47.6 KB)  
[mgdraw.phasespace.f](https://fluka-forum.web.cern.ch/uploads/short-url/jjnj2esGj2ZIP19RN2TYzp20Vxq.f) (12.5 KB)  
[source\_Bias.phasespace\_events\_fix.f](https://fluka-forum.web.cern.ch/uploads/short-url/8OopbszK5EPKWYTHvzxjmZUt7YP.f) (21.4 KB)  
[usrout.f](https://fluka-forum.web.cern.ch/uploads/short-url/cXv6HO8rnjn3fujwgetO8Ilb91A.f) (2.5 KB)

---

<div class="post-metadata">

**Author:** ![ghugo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/g/35a633/32.png) [@ghugo](https://fluka-forum.web.cern.ch/u/ghugo)\
**Post date:** [26 March 2024 15:41 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/5 "2024-03-26T15:41:50Z")

</div>

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 `source_library_events.inc`, included by `source_Bias.phasespace_events_fix.f`: I Included `source_library.inc` instead), I got:

```auto
 # Reading of phase space file requested
 #
 ***Impossible to open file***
 PhaseSpaceFile.txt
 ***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 `source_library_events.inc`: 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:

```auto
* 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 `source_library_events.inc` 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`.

Thanks,  
Gabrielle

---

<div class="post-metadata">

**Author:** ![Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/dirk.a.bartkoski/32/697_2.png) [@Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/u/Dirk.A.Bartkoski)\
**Post date:** [26 March 2024 19:43 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/6 "2024-03-26T19:43:53Z")

</div>

I forgot about my modified INCLUDE file. Here it is.

[source\_library\_events.inc](https://fluka-forum.web.cern.ch/uploads/short-url/h156JC5jRTmbh5AxJ7IA9LSeNHA.inc) (35.0 KB)

I aslo forgot about the trimming in source\_Bias.phasespace\_events\_fix.f.

---

<div class="post-metadata">

**Author:** ![ghugo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/g/35a633/32.png) [@ghugo](https://fluka-forum.web.cern.ch/u/ghugo)\
**Post date:** [27 March 2024 11:02 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/7 "2024-03-27T11:02:29Z")

</div>

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.

Thanks,  
Cheers,  
Gabrielle

---

<div class="post-metadata">

**Author:** ![Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/dirk.a.bartkoski/32/697_2.png) [@Dirk.A.Bartkoski](https://fluka-forum.web.cern.ch/u/Dirk.A.Bartkoski)\
**Post date:** [27 March 2024 12:40 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/8 "2024-03-27T12:40:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ghugo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/g/35a633/32.png) [@ghugo](https://fluka-forum.web.cern.ch/u/ghugo)\
**Post date:** [27 March 2024 14:00 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/9 "2024-03-27T14:00:56Z")

</div>

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!  
Cheers

---

<div class="post-metadata">

**Author:** ![horvathd](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/horvathd/32/10584_2.png) [@horvathd](https://fluka-forum.web.cern.ch/u/horvathd)\
**Post date:** [27 March 2024 14:22 UTC](https://fluka-forum.web.cern.ch/t/revisiting-relative-path-opening/5805/10 "2024-03-27T14:22:23Z")

</div>

Closed on 27 March 2024 14:22 UTC


