How to use the source_newgen.f read the phase_space file?

Dear FLUKA experts,
I want to input the particles.txt as the source of particles. When I read the source_newgen.f code, I found that the topic of “8. Sampling from phase space file”. I wrote particles.txt according to the file format, but there was an error in operation. The attachment is as follows.
How to solve this proble, or is there another way to read the particles distribution file output by other programs for particle tracking?
source_newgen.f (18.9 KB)
vhee-dose.flair (1.8 KB)
particles.txt (115.8 KB)

Dear An Chaofan,

You need to make sure that the Fortran code starts on the 7th column, as the fixed form requires it.

Some other remarks:

  • Please update your FLUKA installation, as support is only provided for the latest version.
  • You may need to check if the units of your phase-space file are correct.
  • Finally, make sure the direction cosines are correct, otherwise due to the automatic normalization, the particle direction could be altered unexpectedly.


Dear David,
Thank you for your reply, I have solved the above problem. What should I do if I want to activate source_newgen.f to read the phase space file? It doesn’t read the file when I use the card of SOURCE and the card of BEAM, or I use the card of SOURCE? Is there any tutorial?
Best wishes,

Of course there is a tutorial and it has been indicated many times on this forum, you just needed to use the search function (top right corner of the web page).
Study the slides from the source routine lecture from the last beginners’ course. You could also try to do the corresponding exercise from the course. Between the lecture and the exercise you will find all the information needed to read a phase space file as input.

A post was split to a new topic: How to verify that the phase-space file is read correctly