Defining a volumetric neutron source with energy sampled from a histogram

Dear FLUKA users,

I want to simulate the defects produced by ambient neutrons on a quartz sample. First, I created a cubic quartz sample centered into the origin and defined a thin cartesian volume around the boundary of the sample. The angular distribution of the neutrons generated are isotropic. When I tried to sample the energy from a histogram using the source_newgen.f and the slides of the 2022 FLUKA course as reference the code ignored the defined geometry. I’m looking for help and reference material for setting a volumetric particle source as well with an energy spectrum defined by a histogram.

Thank you all in advance,
Matheus Bergamo

histogram.txt (38.1 KB)
SiO2.flair (5.8 KB)

Including the source file.
source_newgen.f (18.7 KB)

Dear @mberg96,

The problem is that using source routine overwrites the beam specifications given with standard cards.
In your case, this means that you CART-VOL is not taken into account. You need to specify in the source routine the coordinates of your primaries such that they give the specific distribution you want.

1 Like


in order to directly take into account volumetric source definitions, divergence etc. provided by FLUKA input cards, you can also call the FLUKA internal routines yourself.

Take a look at the source.f provided in: Sampling from energy spectra - Advanced Features and User Routines - FLUKA User Forum (

Look at the call in the section with the comment “PRIMARY PARTICLE: STARTING POSITION”. If the spatial distributions that are provided out of the box are not sufficient then you need to sample the positions yourself but from your post I understand that the cylindrical distribution should work.

Hope that helps

1 Like

I’m grateful for the answers! It worked!

Kind regards
Matheus Bergamo