Re: [fluka-discuss]: Question about writting source file for different types and energies of beam

From: Stefan E. Mueller <>
Date: Sun, 1 May 2022 14:41:59 +0200 (CEST)

Dear FLUKA user,

I have modified your SOURCE user routine (see attachment).

These are the modifications I did:

IF (CCC .LE. 1.D0/6.D0) THEN

selects the case for the proton beam.

Kinetic energy of a primary is set via the


variable, and after setting this, the momentum needs to be recalculated:

      & + TWOTWO * AM (IONID) ) )

The beam direction cosines need to be normalized to "1.D0", to ensure
this, it is useful to calculate z-component like this:

      & - TYFLK (NPFLKA)**2 )

In general, it is always useful to define numbers in the Double Precision
format ("D0"), "ONEONE" and "ZERZER" are FLUKA's predefined Double
Precision versions of "1.D0" and "0.D0", see the '(CNSTFL)'-COMMON in

I checked that the attached modified source file compiles and runs,
hopefully it does now what you need.



Stefan E. Mueller
Department of Information Services and Computing - Computational Science
and Institute of Radiation Physics
Helmholtz-Zentrum Dresden-Rossendorf
Tel: +49 (0351) 260 3847
Vorstand: Prof. Dr. Sebastian M. Schmidt, Dr. Diana Stiller
Vereinsregister: VR 1693 beim Amtsgericht Dresden
On Fri, 29 Apr 2022, wrote:
> Dear all,
> I want to consult you If the beam of different x-y-z positions with more
> than one energies and types , how to write the source file.
> For example there are two sources: 500MeV electron 0.5nA and 60MeV proton
> 0.1nA in different positions. I intend to run two sources together to
> calculate the total dose rate.
> I have tried to define the energy and beam types for different positions
> directly with:
> IF(CCC<=1.0/6) THEN
>    PBEAM=0.06
>    IJBEAM=1
>    。。。
>    PBEAM=0.5
>    IJBEAM=3
>    。。。
> in source file to instead of BEAM and BEAMPOS card for FLUKA input. I have
> no idea if I am right.
> I have attached the source file in the attachement. Any help will be
> appreciated and thanks in advance.

You can manage unsubscription from this mailing list at

Received on Sun May 01 2022 - 16:20:07 CEST

This archive was generated by hypermail 2.3.0 : Sun May 01 2022 - 16:20:10 CEST