Use of source_newgen.f

Dear FLUKA experts,

I am using FLUKA to simulate an electron beam hitting a tungsten target in the presence of a magnetic field. Inside the source_newgen.f routine, I am assigning custom direction cosines to the electrons. These directions depend on an angle (which I refer to as theta), defined as follows:

  ...  = sample_flat_distribution([min], [max])

in my case:

user_theta = sample_flat_distribution(0.0d0, 1.0d0) * 2.0 * user_pi

user_pi is equal to 3.1415926536.

In FLAIR, I am using the SOURCE card to correctly read the source characteristics from source_newgen.f.
However, I noticed that when simulating 1E5 electrons, the value of theta appears to be the same for all particles.

I have attached both my FLAIR input file and the source_newgen.f file.

Thank you in advance for your support.

Cheers,
Alessio
baselineW.flair (3.3 KB)
source_newgen.f (25.1 KB)

Hi Alessio,

Sorry for the delayed reply!

I tested your source routine and I’m getting different theta values for all primary particles.
Maybe you forgot to recompile your executable, and you were running a version where the theta value was fixed?

Cheers,
David