The PYTHIA `master copy' is the one found on the web page
There you have, for several subversions xxx:
pythia6xxx.f the PYTHIA 6.xxx code,In addition to these, one may also find sample main programs and other pieces of related software, and some physics papers.
pythia6xxx.tex editions of this PYTHIA manual, and
pythia6xxx.update plain text update notes to the manual.
The program is written essentially entirely in standard Fortran 77, and should run on any platform with such a compiler. To a first approximation, program compilation should therefore be straightforward.
Unfortunately, experience with many different compilers has been uniform: the options available for obtaining optimized code may actually produce erroneous code (e.g. operations inside DO loops are moved out before them, where some of the variables have not yet been properly set). Therefore the general advice is to use a low optimization level. Note that this is often not the default setting.
SAVE statements have been included in accordance with the Fortran standard.
All default settings and particle and process data are stored in BLOCK DATA PYDATA. This subprogram must be linked for a proper functioning of the other routines. On some platforms this is not done automatically but must be forced by you, e.g. by having a line
EXTERNAL PYDATAat the beginning of your main program. This applies in particular if PYTHIA is maintained as a library from which routines are to be loaded only when they are needed. In this connection we note that the library approach does not give any significant space advantages over a loading of the packages as a whole, since a normal run will call on most of the routines anyway, directly or indirectly.
With the move towards higher energies, e.g. for LHC applications, single-precision (32 bit) real arithmetic has become inappropriate. Therefore a declaration IMPLICIT DOUBLE PRECISION(A-H,O-Z) at the beginning of each subprogram is inserted to ensure double-precision (64 bit) real arithmetic. Remember that this also means that all calls to PYTHIA routines have to be done with real variables declared correspondingly in the user-written calling program. An IMPLICIT INTEGER(I-N) is also included to avoid problems on some compilers. Integer functions beginning with PY have to be declared explicitly. In total, therefore all routines begin with
C...Double precision and integer declarations. IMPLICIT DOUBLE PRECISION(A-H, O-Z) IMPLICIT INTEGER(I-N) INTEGER PYK,PYCHGE,PYCOMPand you are recommended to do the same in your main programs. Note that, in running text and in description of common-block default values, the more cumbersome double-precision notation is not always made explicit, but code examples should be correct.
On a machine where DOUBLE PRECISION would give 128 bits, it may make sense to use compiler options to revert to 64 bits, since the program is anyway not constructed to make use of 128 bit precision.
Fortran 77 makes no provision for double-precision complex numbers. Therefore complex numbers have been used only sparingly. However, some matrix element expressions, mainly for supersymmetric and technicolor processes, simplify considerably when written in terms of complex variables. In order to achieve a uniform precision, such variables have been declared COMPLEX*16, and are manipulated with functions such as DCMPLX and DCONJG. Affected are PYSIGH, PYWIDT and several of the supersymmetry routines. Should the compiler not accept this deviation from the standard, or some simple equivalent thereof (like DOUBLE COMPLEX instead of COMPLEX*16) these code pieces could be rewritten to ordinary COMPLEX, also converting the real numbers involved to and from single precision, with some drop in accuracy for the affected processes. PYRESD already contains some ordinary COMPLEX variables, and should not cause any problems.
Several compilers report problems when an odd number of integers precede a double-precision variable in a common block. Therefore an extra integer has been introduced as padding in a few instances, e.g. NPAD, MSELPD and NGENPD.
Since Fortran 77 provides no date-and-time routine, PYTIME allows a system-specific routine to be interfaced, with some commented-out examples given in the code. This routine is only used for cosmetic improvements of the output, however, so can be left at the default with time 0 given.
A test program, PYTEST, is included in the PYTHIA package. It is disguised as a subroutine, so you have to run a main program
CALL PYTEST(1) ENDThis program will generate over a thousand events of different types, under a variety of conditions. If PYTHIA has not been properly installed, this program is likely to crash, or at least generate a number of erroneous events. This will then clearly be marked in the output, which otherwise will just contain a few sample event listings and a table of the number of different particles produced. To switch off the output of normal events and final table, use PYTEST(0) instead of PYTEST(1). The final tally of errors detected should read 0.
For a program written to run PYTHIA 5 and JETSET 7, most of the conversion required for PYTHIA 6 is fairly straightforward, and can be automatized. Both a simple Fortran routine and a more sophisticated Perl [Gar98] script exist to this end, see the PYTHIA web page. Some manual checks and interventions may still be required.