Unexpected source.f behaviour

Dear community

My goal is to simulate Am-241 with a source routine. For this purpose, I did some preliminary tests using a simplified source-detector geometry and comparing the built-in beam card with the source routine source.f. In each history, a single photon with an energy of 59.5409 keV should be emitted isotropically. Now it happens that the results differ significantly, i.e. the simulation with the source routine significantly underpredicts the deposited energy per primary. The scoring is performed by the same user-routine usreou.f (more information can be found in this post: EVENTBIN output simplification?). For your convenience, the following files are attached to this post:

  • source_test_v1.f: the adapted source.f user-routine (I changed only the kinetic energy)
  • usreou_det1.f: the usreou.f user-routine
  • flksrc.inp: the input file, which runs only with usreou_det1.f and without source_test_v1
  • srcrtn.inp: the input file, which runs with usreou_det1.f and source_test_v1
  • flksrc_DETECT01.txt: the ASCI output file for flksrc.inp of the first cycle
  • srcrtn_DETECT01.txt: the ASCI output file for srcrtn.inp of the first cycle
  • source_Am241_v7.f: the final source.f routine to simulate the promt decay radiation of Am-241. This routine was not used in the simulations and is only attached for your information.


  • The same number of primaries (1E6) was used for both input files.

  • The background, why I need the source.f routine for Am-241 is the fact that I want to simulate only the decay radiation of Am-241 and none of its daughters (as discussed in this post: Prompt Decay Radiation from Isotopes). The approaches with TCQUENCH didn’t work in my case and I would prefer a “source.f” solution.

  • I’m aware of the new source routine source_newgen.f. However, due to the fact, that I would like to simulate Am-241 using (inverse) sampling from a discrete probability density function (photon energies with the corresponding emission probabilities), I decided for the “old” source.f routine , because to my knowledge, the source_newgen.f doesn’t allow to do this specific sampling with a function at the moment in source_newgen.f.

  • My guess for the discrepancy is an error from my side in the source.f routine.

Thank you very much for your support


flksrc.inp (1.4 KB) flksrc_DETECT01.txt (103.9 KB) source_Am241_v7.f (11.3 KB) source_test_v1.f (9.1 KB) srcrtn.inp (1.4 KB) srcrtn_DETECT01.txt (1.5 KB) usreou_det1.f (2.8 KB)

Dear David,

the problem is, that the source routine ignores the isotropic beam direction set on the BEAM card. So, the direction sampling has to be added manually to the routine.

The easiest way is to replace the lines under * Cosines (tx,ty,tz) with the following one:


Furthermore, the momentum (PMOFLK (NPFLKA)) is not updated after setting the kinetic energy, so based on a previous line it takes the value set on the BEAM card, which can lead to unexpected behavior.

Finally one comment on the new source routine source_newgen.f. It still allows the users to add their own code in place or in a new function, so your energy sampling code could be copied over, if you want. But it is not necessary, since using the “old” source routine is valid and supported.


Dear David,

Thank you very much for your fast and detailed answer. I will try to follow up your recommendations and will come back if something exceeds me.

Thank you for your help