| 1 | === How to generate a standalone MadLoop library for the evaluation of one-loop matrix elements === |
| 2 | |
| 3 | In order to generate a standalone MadLoop library for several processes, you must first generated them with the 'generate' and 'add process' syntax, while making sure to use 'virt=' when specifying the perturbation couplings. |
| 4 | Here is an example |
| 5 | {{{ |
| 6 | MG5_aMC> generate u d~ > e+ ve [virt=QCD] @42 |
| 7 | MG5_aMC> add process c s > c s h QED<=3 QCD=0 [virt=QCD] @23 |
| 8 | MG5_aMC> add process g g > z z [virt=QCD] @33 |
| 9 | MG5_aMC> ... |
| 10 | MG5_aMC> output MyStandaloneMadLoopOutput |
| 11 | }}} |
| 12 | |
| 13 | Notice that you cannot output together processes from different models, these will need to be put in separate libraries. |
| 14 | Also, the '@<i>' syntax is optional and will be assigned by default if absent, but this can allow you to specify how each process will be identified in the library (i.e. the prefix for the corresponding symbols/subroutines will be ML5_<i>_). |
| 15 | At this stage I recommend that you run 'launch -f' this will compile and run each process for a trial kinematic configuration, making sure that they are functional and also performing the initialization of the loop and helicity filters (which only need to be done once after which they are saved on disk for future use in 'MyStandaloneMadLoopOutput/SubProcesses/MadLoop5_resources'): |
| 16 | |
| 17 | {{{ |
| 18 | MG5_aMC> launch -f |
| 19 | }}} |
| 20 | |
| 21 | You can now exit the MG5_aMC interface and you can go to the various folders 'MyStandaloneMadLoopOutput/SubProcesses/P<i>_*' where <i> is the identifier specified above with the '@' syntax. |
| 22 | In each of these folders you can compile the steering fortran driver 'check_sa.f' with |
| 23 | |
| 24 | {{{ |
| 25 | > cd <MG_root>/MyStandaloneMadLoopOutput/SubProcesses/P33_gg_zz |
| 26 | > make check |
| 27 | > ./check |
| 28 | }}} |
| 29 | |
| 30 | If you want to chose your phase-space point (as opposed to the default behavior which picks a random configuration generated by RAMBO) you can directly modify 'check_sa.f' and change the following parameters |
| 31 | |
| 32 | {{{ |
| 33 | PARAMETER (READPS = .FALSE.) -> PARAMETER (READPS = .TRUE.) |
| 34 | PARAMETER (NPSPOINTS = 4) -> PARAMETER (NPSPOINTS = 1) |
| 35 | }}} |
| 36 | |
| 37 | and recompile. The kinematic configuration is then read from the file 'PS.input' that you should create and in which you can specify the kinematic configuration in this format (E,px,py,pz) for each external particle, in the order of the process specified, e.g. for our g g > z z case: |
| 38 | |
| 39 | {{{ |
| 40 | > cat PS.input |
| 41 | 5.000000000000000E+002 0.000000000000000E+000 0.000000000000000E+000 5.000000000000000E+002 |
| 42 | 5.000000000000000E+002 0.000000000000000E+000 0.000000000000000E+000 -5.000000000000000E+002 |
| 43 | 5.000000000000002E+002 3.169376489451249E+002 1.414175899625355E+002 -3.481900926021950E+002 |
| 44 | 5.000000000000002E+002 -3.169376489451246E+002 -1.414175899625355E+002 3.481900926021950E+002 |
| 45 | }}} |
| 46 | |
| 47 | Notice that the result for the loop matrix element computed fro the last kinematic configuration explored by './check' is not only displayed on screen but also written in the file 'results.dat'. |
| 48 | The runtime parameter for MadLoop can be edited directly in the card 'MyStandaloneMadLoopOutput/SubProcesses/MadLoopParams.dat' (doesn't necessitate a recompilation. |
| 49 | It is worth noting that one can also steer the MadLoop standalone output with f2py, in the similar way as explained in [wiki:FAQ-General-4 this page]. |
| 50 | |
| 51 | Finally, the above is convenient when debugging or testing MadLoop for individual PS points, but it is clear that a library is needed to integrate MadLoop loop matrix elements in any third-party tool. |
| 52 | In order to do so, you can simply type 'make OLP' or 'make OLP_static' (for a static library) in the Subprocesses folder (OLP stands for One-Loop Provider): |
| 53 | |
| 54 | {{{ |
| 55 | > cd <MG_root>/MyStandaloneMadLoopOutput/SubProcesses |
| 56 | > make OLP_static |
| 57 | }}} |
| 58 | |
| 59 | And you will see the resulting library 'libMadLoop.a' being created in the folder 'MyStandaloneMadLoopOutput/lib'. You can now link your third-party tool to this library and call main MadLoop subroutines which are 'ML5_<i>_SLOOPMATRIX' where <i> is whatever integer you specified when generating the processes. Notice that the similar subroutines with the name 'ML5_<i>_SLOOPMATRIXHEL' allow you to specify the helicity configuration. You can look for the implementations of these subroutines in the files 'MyStandaloneMadLoopOutput/SubProcesses/P<i>_*/loop_matrix.f' to understand the nature of their inputs (or read the short driver file 'check_sa' that uses them'). |
| 60 | |
| 61 | *Warning* It is important to stress that at run time MadLoop must have access to the content of the folder '<MG_root>/MyStandaloneMadLoopOutput/SubProcesses/MadLoop5_resources'. You can make sure that this is the case using any of the three following setups: |
| 62 | |
| 63 | * Run your executable linked to MadLoop from anywhere within the folder '<MG_root>/MyStandaloneMadLoopOutput/SubProcesses' |
| 64 | |
| 65 | OR |
| 66 | |
| 67 | * Make a soft link of the folder '<MG_root>/MyStandaloneMadLoopOutput/SubProcesses/MadLoop5_resources' to wherever you are running your executable from |
| 68 | |
| 69 | OR |
| 70 | |
| 71 | * Before issuing your first call to MadLoop via an 'sloop*' subroutine, first have your program call the MadLoop subroutine 'SETMADLOOPPATH(PATH)' to instruct MadLoop of where you chose to place 'MadLoop5_resources' (PATH is a character array of fixed length 512) |
| 72 | |
| 73 | The default reduction tools interfaced to MadLoop (CutTools, IREGI and Ninja) are linked statically so that you don't have to worry about them. However, if you activated optional reduction tools (such as PJFry, Golem or Samurai), they are linked dynamically so that you will have to make sure that these libraries can be found both during the compilation and running of your third party tool linked against MadLoop (all these libraries and includes are soft-linked in the '<MG_root>/MyStandaloneMadLoopOutput/lib' directory. |
| 74 | |
| 75 | Finally, as stated before, the best way to understand how to call the various MadLoop subroutines is to read the workflow of the driver file 'check_sa.f'. For completeness, we provide here the details of the inputs and outputs of two of the most common way of calling MadLoop. First the simplest one: |
| 76 | |
| 77 | {{{ |
| 78 | CALL ML5_<ID>_SLOOPMATRIX(P, RESULT) |
| 79 | }}} |
| 80 | |
| 81 | where the input is: |
| 82 | |
| 83 | * A rank-2 array of double precision floating point variables, i.e. 'real*8 P(0:3,N_external)' which describes the kinematic configuration |
| 84 | |
| 85 | and the output is |
| 86 | |
| 87 | * A rank-2 array of double precision floating point variables, i.e. 'real*8 RESULT(0:3,0:N_COUPLING_ORDERS_COMBINATIONS)' where 'N_COUPLING_ORDERS_COMBINATIONS' is the number of different combinations of coupling orders which have a contribution for this process. |
| 88 | This number can be retrieved using MadLoop's subroutine 'CALL ML5_23_GET_ANSWER_DIMENSION(N_COUPLING_ORDERS_COMBINATIONS)' and the index 0 corresponds to the sum of all individual contributions. |
| 89 | |
| 90 | To summarize, the result returned by MadLoop is |
| 91 | |
| 92 | {{{ |
| 93 | RESULT(I,J) |
| 94 | }}} |
| 95 | with |
| 96 | |
| 97 | I=0 -> Born contribution |
| 98 | |
| 99 | I=1 -> Finite part of the virtual contribution |
| 100 | |
| 101 | I=2 -> Residue of the $\epsilon^-1$ pole of the the virtual contribution |
| 102 | |
| 103 | I=3 -> Residue of the $\epsilon^-2$ pole of the the virtual contribution |
| 104 | and |
| 105 | J=0 -> Result for the sum of all contributions factorizing different coupling order combinations |
| 106 | |
| 107 | J in [1,N_coupling_order_combinations) -> Result for the contribution that factorize the specific coupling order combination labelled with integer 'J'. |
| 108 | |
| 109 | and now the most complete access subroutine: |
| 110 | |
| 111 | {{{ |
| 112 | CALL ML5_<ID>_SLOOPMATRIXHEL_THRES(P, HEL_ID, RESULT, REQ_ACC, PREC_FOUND, RETURNCODE) |
| 113 | }}} |
| 114 | |
| 115 | whose extra inputs on top of the 'P' explained above are |
| 116 | |
| 117 | HEL_ID -> An integer which specifies which helicity configuration you want to evaluate the one-loop matrix element for (ordered as in MadLoop5_resources/ML5_<ID>_HelConfigs.dat). '-1' indicates that you want to sum/average over all helicity configurations. |
| 118 | |
| 119 | REQ_ACC -> is a double precision floating point variable that specifies the target relative accuracy for MadLoop's computation (-1.0d0 means that the value of the parameter 'MLStabThres' of MadLoop5_resources/MadLoopParams.dat will be used instead) |
| 120 | |
| 121 | And the extra outputs on top of RESULT described above are: |
| 122 | |
| 123 | PREC_FOUND(0:NSQUAREDSO) -> An array of NSQUAREDSO floating point variables specifying the numerical accuracy detected for each coupling order combination.\\ |
| 124 | This number can be obtained by calling the MadLoop subroutine ''CALL ML5_<ID>_GET_NSQSO_LOOP(NSQUAREDSO_LOOP)". The index 0 refers to the sum of all contributions. |
| 125 | |
| 126 | RETURNCODE -> An integer providing information on the internal behavior for MadLoop for that particular PS point. It follows the following convention: |
| 127 | |
| 128 | {{{ |
| 129 | Return code conventions: RET_CODE = H*100 + T*10 + U |
| 130 | |
| 131 | Return code == -1 |
| 132 | No Stability check could be performed |
| 133 | |
| 134 | H == 1 |
| 135 | Stability unknown. |
| 136 | H == 2 |
| 137 | Stable PS (SPS) point. |
| 138 | No stability rescue was necessary. |
| 139 | H == 3 |
| 140 | Unstable PS (UPS) point. |
| 141 | Stability rescue necessary, and successful. |
| 142 | H == 4 |
| 143 | Exceptional PS (EPS) point. |
| 144 | Stability rescue attempted, but unsuccessful. |
| 145 | |
| 146 | T == 1 |
| 147 | Default computation (double prec.) was performed. |
| 148 | T == 2 |
| 149 | Quadruple precision was used for this PS point. |
| 150 | T == 3 |
| 151 | MadLoop in initialization phase. Only double precision used. |
| 152 | T == 4 |
| 153 | MadLoop in initialization phase. Quadruple precision used. |
| 154 | |
| 155 | U == 0 |
| 156 | Not stable. |
| 157 | U == 1 |
| 158 | Stable with CutTools in double precision. |
| 159 | U == 2 |
| 160 | Stable with PJFry++. |
| 161 | U == 3 |
| 162 | Stable with IREGI. |
| 163 | U == 4 |
| 164 | Stable with Golem95 |
| 165 | U == 5 |
| 166 | Stable with Samurai |
| 167 | U == 6 |
| 168 | Stable with Ninja in double precision |
| 169 | U == 8 |
| 170 | Stable with Ninja in quadruple precision |
| 171 | U == 9 |
| 172 | Stable with CutTools in quadruple precision. |
| 173 | }}} |
| 174 | |
| 175 | Finally, if you want color stripped amplitudes (typically for specific chosen color flows, but not only), this is relatively straightforward too, so contact me directly (Valentin Hirschi) and I'll add instructions on this page. |