Last version:
FLUKA 2024.1.0, April 30th 2024
(last respin 2024.1.0)
flair-2.3-0e 06-May-2024


-- New Fluka Major Release
( 06.05.2024 )

FLUKA 2024.1.0 is available.
Flair-2.3-0epy3 adapted

font_small font_med font_big print_ascii

[ <--- prev -- ]  [ HOME ]  [ -- next ---> ]

[ full index ]


invokes the use of a user defined source routine SOURCE


This option allows to input up to 12 double precision parameters chosen by the user, to be passed to the user routine SOURCE. To pass more than 6 parameters, two successive SOURCE cards are required.

First card:

     WHAT(1..6) : user parameters to be passed to the SOURCE routine as
               a double precision subarray WHASOU(1)...WHASOU(6)
               (via COMMON SOURCM, in the INCLUDE file of the same name)

     SDUM    = any user dependent character string (not containing "&")
               to be passed to the SOURCE routine as a character
               variable SDUSOU (via COMMON CHSOCM, in INCLUDE file SOURCM)

Continuation card:

     WHAT(1..6) : user parameters to be passed to the SOURCE routine as
               a double precision subarray WHASOU(7)...WHASOU(12)

     SDUM    = "&" in any position in column 71 to 78 (or in the last
               field if free format is used)

     Default (option SOURCE not given): subroutine SOURCE is not called


  • 1) In many simple cases, the primary particle properties can be defined by just two input cards: BEAM and BEAMPOS. The two options define the type of the particle, its energy/momentum (monoenergetic or simply distributed) and its starting position and direction (also sampled from a few simple distributions centreed around the z-axis). A third option, POLARIZAti, can be used to complete the description of the primaries in case they are totally or partially polarised.

  • 2) However, there are more complex situations where the type of primary particles and their phase space coordinates must be sampled from different types of distributions, read from files, or generated by a rule decided by the user. To handle these cases, it is possible to call a user routine SOURCE which can override totally or in part the definitions given in input. The call is activated by option SOURCE. A default version of the routine, which leaves any other input definition unchanged, is present in the FLUKA library. Instructions on how to write, compile and link SOURCE are given in (13).

  • 3) Even when overridden by SOURCE, the momentum or kinetic energy defined by WHAT(1) of option BEAM is meaningful, since it is taken as maximum energy for several scoring facilities. Therefore, it is recommended to input in any case a BEAM card with the maximum energy expected in the current run.

  • 4) The user has the possibility to write a flexible SOURCE routine which can handle different cases without being recompiled and linked. The 12 WHASOU optional double precision parameters and the SDUSOU character string can be combined to provide a multitude of possible options.

  • 5) Initialisations (for instance reading data from files, or spectrum normalisation needed for sampling) can be done in SOURCE itself, as explained in (13), or in two other user routines USRINI and USRGLO. USRINI is called every time a card USRICALL is found in input (see (13)), while USRGLO is called before any other initialisation made by FLUKA. Note that more than one primary particle can be sampled in a same call to SOURCE and loaded into stack for later transport. A further user routine, USREIN (see (13)), which is called just after SOURCE and before the sampled primary (or primaries) are transported, allows the user to do an initialisation at the beginning of each event. An event is defined as all the histories of primaries sampled in a single call to SOURCE and of their descendants. Routine USREOU is called instead at the end of each event.

  • 6) In old versions of FLUKA, the call to SOURCE was requested by means of a flag in card START. This feature has been discontinued.

Example 1:

 * A user-written SOURCE routine is called without passing any parameter.

Example 2:

 * Here the user passes to the SOURCE routine 7 numerical values and one
 * character string. These can be used as free parameters inside the routine,
 * or as flags/switches to select between different options
 SOURCE         12.58       1.0      -14.  0.987651      100.      365.FLAG18
 SOURCE         999.2                                                  &

© FLUKA Team 2000–2024

Informativa cookies