INFN homepage
FLUKA: 13} User routines Previous Index Next

13} User routines


********************************************************************************
Unlike some other Monte Carlo particle transport codes, FLUKA gets its input mainly from a simple file. It offers a rich choice of options for scoring most quantities of possible interest and for applying different variance reduction techniques, without requiring the user to write a single line of code. However, although normally there is no need for any "user code", there are special cases where this is unavoidable, either because of the complexity of the problem, or because the desired information is too unusual or too problem-specific to be offered as a standard option. And on the other hand, even when this is not strictly necessary, experienced programmers may like to create customised input/output interfaces. A number of user routines (available on LINUX and UNIX platforms in directory usermvax) allow to define non-standard input and output, and in some cases even to modify to a limited extent the normal particle transport. Most of them are already present in the FLUKA library as dummy or template routines, and require a special command in the standard input file to be activated. Users can modify any one of these routines, and even insert into them further calls to their own private ones, or to external packages (at their own risk!). This increased flexibility must be balanced against the advantage of using as far as possible the FLUKA standard facilities, which are known to be reliable and well tested. To implement their own code, users must perform the following steps: 1) make a modified copy of one or more of these routines. It is recommended that each modified routine should always print an informative message when called for the first time, to confirm that it has been successfully activated, for future documentation, and to avoid misinterpretations of the standard output. It is important to remember that when calling modified user routines, the units, titles etc. reported in the normal FLUKA output become often meaningless. A typical way to do this is: .............. LOGICAL LFIRST SAVE LFIRST DATA LFIRST /.TRUE./
* return message from first call
IF (LFIRST) THEN WRITE(LUNOUT,*) 'Version xxx of Routine yyy called' LFIRST = .FALSE. ENDIF .............. IMPORTANT: The user should not modify the value of any argument in a routine calling list, except when marked as "returned" in the description of the routine here below. Similarly, no variable contained in COMMON blocks should be overwritten unless explicitly indicated. 2) compile the modified routines (with the fff script on LINUX/UNIX): fff yyy.f (produces a new file yyy.o) 3) link them (with the lfluka script on LINUX/UNIX) to the FLUKA library and any additional library of interest (for instance CERNLIB): lfluka -o myfluka -m fluka yyy.o This will produce a new executable (indicated here as myfluka). To run the new executable, launch the usual rfluka script with the option -e myfluka.

Previous Index Next