~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/iolibs/template_files/loop_optimized/mp_compute_loop_coefs.inc

  • Committer: olivier Mattelaer
  • Date: 2015-03-05 00:14:16 UTC
  • mfrom: (258.1.9 2.3)
  • mto: (258.8.1 2.3)
  • mto: This revision was merged to the branch mainline in revision 259.
  • Revision ID: olivier.mattelaer@uclouvain.be-20150305001416-y9mzeykfzwnl9t0j
partial merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
C
15
15
      CHARACTER*64 paramFileName
16
16
      PARAMETER ( paramFileName='MadLoopParams.dat')
17
 
          %(nbornamps_decl)s
 
17
## if (not LoopInduced) {
 
18
          INTEGER NBORNAMPS
 
19
      PARAMETER (NBORNAMPS=%(nbornamps)d)
 
20
## }
18
21
      INTEGER    NLOOPS, NLOOPGROUPS, NCTAMPS
19
22
      PARAMETER (NLOOPS=%(nloops)d, NLOOPGROUPS=%(nloop_groups)d, NCTAMPS=%(nctamps)d) 
 
23
      INTEGER    NLOOPAMPS
 
24
          PARAMETER (NLOOPAMPS=%(nloopamps)d)
20
25
      INTEGER    NCOLORROWS
21
 
          PARAMETER (NCOLORROWS=%(nloopamps)d)
 
26
          PARAMETER (NCOLORROWS=NLOOPAMPS)
22
27
          INTEGER    NEXTERNAL
23
28
      PARAMETER (NEXTERNAL=%(nexternal)d)
24
29
      INTEGER    NWAVEFUNCS,NLOOPWAVEFUNCS
36
41
C     These are constants related to the split orders
37
42
      INTEGER    NSO, NSQUAREDSO, NAMPSO
38
43
          PARAMETER (NSO=%(nSO)d, NSQUAREDSO=%(nSquaredSO)d, NAMPSO=%(nAmpSO)d)
 
44
 
 
45
##if(ComputeColorFlows) {
 
46
C The variables below are just used in the context of a JAMP consistency check turned off by default.
 
47
      LOGICAL DIRECT_ME_COMPUTATION, ME_COMPUTATION_FROM_JAMP
 
48
      %(real_dp_format)s RES_FROM_JAMP(0:3,0:NSQUAREDSO)
 
49
          common/%(proc_prefix)sDOUBLECHECK_JAMP/RES_FROM_JAMP,DIRECT_ME_COMPUTATION,ME_COMPUTATION_FROM_JAMP
 
50
## }
 
51
          
39
52
C  
40
53
C ARGUMENTS 
41
54
C  
44
57
C  
45
58
C LOCAL VARIABLES 
46
59
C  
47
 
      INTEGER I,J,K,H,DUMMY,ITEMP
48
 
      %(real_mp_format)s TEMP2
 
60
      LOGICAL DPW_COPIED
 
61
      INTEGER I,J,K,H,HEL_MULT,ITEMP
 
62
## if(not AmplitudeReduction){
 
63
          %(real_mp_format)s TEMP2
 
64
## }else{
 
65
          %(real_mp_format)s TEMP2(3)
 
66
## }
49
67
      INTEGER NHEL(NEXTERNAL), IC(NEXTERNAL)
50
68
      %(real_mp_format)s P(0:3,NEXTERNAL)
51
69
          DATA IC/NEXTERNAL*1/
52
70
          %(real_mp_format)s ANS(3,0:NSQUAREDSO)
 
71
## if(ComputeColorFlows) {
 
72
          %(real_dp_format)s BUFFRES(0:3,0:NSQUAREDSO)
 
73
## }
53
74
          %(complex_mp_format)s COEFS(MAXLWFSIZE,0:VERTEXMAXCOEFS-1,MAXLWFSIZE)
54
75
      %(complex_mp_format)s CFTOT
55
76
C
74
95
          INTEGER HELPICKED
75
96
          common/%(proc_prefix)sHELCHOICE/HELPICKED
76
97
 
 
98
          INTEGER USERHEL
 
99
          common/%(proc_prefix)sUSERCHOICE/USERHEL
 
100
 
77
101
          INTEGER SQSO_TARGET
78
102
          common/%(proc_prefix)sSOCHOICE/SQSO_TARGET
79
103
      
80
104
          LOGICAL UVCT_REQ_SO_DONE,MP_UVCT_REQ_SO_DONE,CT_REQ_SO_DONE,MP_CT_REQ_SO_DONE,LOOP_REQ_SO_DONE,MP_LOOP_REQ_SO_DONE,CTCALL_REQ_SO_DONE,FILTER_SO
81
105
          common/%(proc_prefix)sSO_REQS/UVCT_REQ_SO_DONE,MP_UVCT_REQ_SO_DONE,CT_REQ_SO_DONE,MP_CT_REQ_SO_DONE,LOOP_REQ_SO_DONE,MP_LOOP_REQ_SO_DONE,CTCALL_REQ_SO_DONE,FILTER_SO
82
106
 
83
 
          %(mp_born_amps_decl)s   
 
107
## if(not LoopInduced) {
 
108
          %(complex_mp_format)s AMP(NBORNAMPS)
 
109
          common/%(proc_prefix)sMP_AMPS/AMP
 
110
          %(complex_dp_format)s DP_AMP(NBORNAMPS)
 
111
          common/%(proc_prefix)sAMPS/DP_AMP
 
112
## }      
84
113
          %(complex_mp_format)s W(20,NWAVEFUNCS)
85
114
          common/%(proc_prefix)sMP_W/W  
86
115
 
91
120
          %(complex_mp_format)s PL(0:3,0:NLOOPWAVEFUNCS)
92
121
          common/%(proc_prefix)sMP_WL/WL,PL
93
122
 
 
123
## if(not AmplitudeReduction){
94
124
          %(complex_mp_format)s LOOPCOEFS(0:LOOPMAXCOEFS-1,NSQUAREDSO,NLOOPGROUPS)
 
125
## } else {
 
126
          %(complex_mp_format)s LOOPCOEFS(0:LOOPMAXCOEFS-1,NLOOPGROUPS)
 
127
## }
95
128
          common/%(proc_prefix)sMP_LCOEFS/LOOPCOEFS
96
129
 
 
130
## if(AmplitudeReduction) {
 
131
C This flag is used to prevent the re-computation of the OpenLoop coefficients when changing the CTMode for the stability test.
 
132
          LOGICAL SKIP_LOOPNUM_COEFS_CONSTRUCTION
 
133
          COMMON/%(proc_prefix)sSKIP_COEFS/SKIP_LOOPNUM_COEFS_CONSTRUCTION
 
134
## }
 
135
 
 
136
## if(not AmplitudeReduction){
97
137
      %(complex_mp_format)s AMPL(3,NCTAMPS)
 
138
## } else {
 
139
      %(complex_mp_format)s AMPL(3,NLOOPAMPS)
 
140
## } 
98
141
          common/%(proc_prefix)sMP_AMPL/AMPL
99
142
 
 
143
## if(AmplitudeReduction){
 
144
      %(complex_dp_format)s DP_AMPL(3,NLOOPAMPS)
 
145
          common/%(proc_prefix)sAMPL/DP_AMPL
 
146
 
 
147
      %(complex_dp_format)s LOOPRES(3,NSQUAREDSO,NLOOPGROUPS)
 
148
          LOGICAL S(NSQUAREDSO,NLOOPGROUPS)
 
149
          common/%(proc_prefix)sLOOPRES/LOOPRES,S
 
150
 
 
151
          integer I_SO
 
152
          common/%(proc_prefix)sI_SO/I_SO
 
153
## }
 
154
 
100
155
          INTEGER CF_D(NCOLORROWS,%(color_matrix_size)s)
101
156
          INTEGER CF_N(NCOLORROWS,%(color_matrix_size)s)
102
157
          common/%(proc_prefix)sCF/CF_D,CF_N
128
183
DO I=0,3
129
184
  PL(I,0)=(ZERO,ZERO)
130
185
ENDDO
 
186
## if(AmplitudeReduction){
 
187
IF (.NOT.SKIP_LOOPNUM_COEFS_CONSTRUCTION) THEN
 
188
## }
131
189
DO I=1,MAXLWFSIZE
132
190
  DO J=0,LOOPMAXCOEFS-1
133
191
    DO K=1,MAXLWFSIZE
141
199
ENDDO
142
200
 
143
201
DO K=1, 3
 
202
## if(not AmplitudeReduction){
144
203
  DO I=1,NCTAMPS
 
204
## }else{
 
205
  DO I=1,NLOOPAMPS
 
206
## }
145
207
    AMPL(K,I)=(ZERO,ZERO)
146
208
  ENDDO
147
209
ENDDO
148
210
 
 
211
## if(AmplitudeReduction){
 
212
ENDIF
 
213
## }
 
214
 
 
215
## if(not LoopInduced) {
 
216
DO I=1, NBORNAMPS
 
217
  DP_AMP(I) = (0.0d0,0.0d0)
 
218
  AMP(I) = (ZERO, ZERO)
 
219
ENDDO
 
220
## }
 
221
 
 
222
## if(not AmplitudeReduction){
149
223
DO I=1,NLOOPGROUPS
150
224
  DO J=0,LOOPMAXCOEFS-1
151
225
    DO K=1,NSQUAREDSO  
153
227
        ENDDO
154
228
  ENDDO
155
229
ENDDO
 
230
## }
156
231
 
157
232
DO K=1,3
158
233
  DO J=0,NSQUAREDSO
161
236
  ENDDO
162
237
ENDDO
163
238
 
 
239
DPW_COPIED = .False.
164
240
DO H=1,NCOMB
165
241
  IF ((HELPICKED.EQ.H).OR.((HELPICKED.EQ.-1).AND.(CHECKPHASE.OR.(.NOT.HELDOUBLECHECKED).OR.(GOODHEL(H).GT.-HELOFFSET.AND.GOODHEL(H).NE.0)))) THEN
166
242
  DO I=1,NEXTERNAL
169
245
 
170
246
  MP_UVCT_REQ_SO_DONE=.FALSE.
171
247
  MP_CT_REQ_SO_DONE=.FALSE.
172
 
  MP_LOOP_REQ_SO_DONE=.FALSE.
 
248
  MP_LOOP_REQ_SO_DONE=.FALSE.  
 
249
 
 
250
  IF (.NOT.CHECKPHASE.AND.HELDOUBLECHECKED.AND.HELPICKED.EQ.-1) THEN
 
251
    HEL_MULT=GOODHEL(H)
 
252
  ELSE
 
253
    HEL_MULT=1
 
254
  ENDIF
 
255
 
 
256
## if(AmplitudeReduction){
 
257
  CTCALL_REQ_SO_DONE=.FALSE.
 
258
 
 
259
C The coefficient were already computed previously with another CTMode, so we can skip them
 
260
  IF (SKIP_LOOPNUM_COEFS_CONSTRUCTION) THEN
 
261
    GOTO 4000
 
262
  ENDIF
 
263
 
 
264
  DO I=1,NLOOPGROUPS
 
265
    DO J=0,LOOPMAXCOEFS-1
 
266
      LOOPCOEFS(J,I)=(ZERO,ZERO)
 
267
    ENDDO
 
268
  ENDDO
 
269
  
 
270
 DO K=1, 3
 
271
  DO I=1,NLOOPAMPS
 
272
    AMPL(K,I)=(ZERO,ZERO)
 
273
  ENDDO
 
274
ENDDO
 
275
## }
173
276
 
174
277
  %(mp_born_ct_helas_calls)s
175
278
2000 CONTINUE
179
282
3000 CONTINUE
180
283
  MP_UVCT_REQ_SO_DONE=.TRUE.
181
284
 
182
 
  IF (.NOT.CHECKPHASE.AND.HELDOUBLECHECKED.AND.HELPICKED.EQ.-1) THEN
183
 
    DUMMY=GOODHEL(H)
184
 
  ELSE
185
 
    DUMMY=1
186
 
  ENDIF
187
 
  DO I=1,%(nctamps_or_nloopamps)s
188
 
    DO J=1,%(nbornamps_or_nloopamps)s
 
285
## if(not AmplitudeReduction) { 
 
286
  DO I=1,NCTAMPS
 
287
    DO J=1,NBORNAMPS
189
288
          CFTOT=CMPLX(CF_N(I,J)/REAL(ABS(CF_D(I,J)),KIND=16),0.0e0_16,KIND=16)
190
289
      IF(CF_D(I,J).LT.0) CFTOT=CFTOT*IMAG1
191
 
          %(mp_squaring)s
 
290
      ITEMP = %(proc_prefix)sML5SQSOINDEX(%(proc_prefix)sML5SOINDEX_FOR_LOOP_AMP(I),%(proc_prefix)sML5SOINDEX_FOR_BORN_AMP(J))
 
291
          IF (.NOT.FILTER_SO.OR.SQSO_TARGET.EQ.ITEMP) THEN
 
292
        DO K=1,3
 
293
          TEMP2 = HEL_MULT*2.0e0_16*REAL(CFTOT*AMPL(K,I)*CONJG(AMP(J)),KIND=16)
 
294
          ANS(K,ITEMP)=ANS(K,ITEMP)+TEMP2
 
295
          ANS(K,0)=ANS(K,0)+TEMP2
 
296
        ENDDO
 
297
      ENDIF
192
298
    ENDDO
193
 
  ENDDO 
 
299
  ENDDO
 
300
## }
194
301
 
195
302
  %(mp_coef_construction)s  
196
303
  4000 CONTINUE
197
304
  MP_LOOP_REQ_SO_DONE=.TRUE.
198
305
 
199
 
  ENDIF
200
 
ENDDO
 
306
## if(AmplitudeReduction) {
 
307
## if(not LoopInduced) {
 
308
C Copy the multiple precision Born amplitudes computed to the AMP double precision array for its use later if necessary (i.e. color flows for example.)
 
309
  DO I=1,NBORNAMPS
 
310
    DP_AMP(I)=AMP(I)
 
311
  ENDDO
 
312
## }
 
313
 
 
314
C Copy the multiple precision CT amplitudes computed to the AMPL double precision array for its use later if necessary (i.e. color flows for example.)
 
315
  DO I=1,NCTAMPS
 
316
    DO K=1,3
 
317
      DP_AMPL(K,I)=AMPL(K,I)
 
318
    ENDDO
 
319
  ENDDO
 
320
## }
201
321
 
202
322
c Copy the qp wfs to the dp ones as they are used to setup the CT calls.
203
 
DO I=1,NWAVEFUNCS
204
 
  DO J=1,MAXLWFSIZE+4
205
 
    DPW(J,I)=W(J,I)
206
 
  ENDDO
 
323
C This needs to be done once since only the momenta of these WF matters.
 
324
  IF(.NOT.DPW_COPIED) THEN
 
325
    DO I=1,NWAVEFUNCS
 
326
      DO J=1,MAXLWFSIZE+4
 
327
        DPW(J,I)=DBLE(W(J,I))
 
328
      ENDDO
 
329
    ENDDO
 
330
    DPW_COPIED=.True.
 
331
  ENDIF
 
332
 
 
333
## if(AmplitudeReduction) {
 
334
  DO I=1,NSQUAREDSO
 
335
    DO J=1,NLOOPGROUPS
 
336
      S(I,J)=.TRUE.
 
337
    ENDDO
 
338
  ENDDO
 
339
  
 
340
C We need a dummy argument for the squared order index to conform to the 
 
341
C structure that the call to the LOOP* subroutine takes for processes with Born diagrams.
 
342
  I_SO=1
 
343
%(loop_CT_calls)s
 
344
5000 CONTINUE
 
345
  CTCALL_REQ_SO_DONE=.TRUE.
 
346
 
 
347
C Copy the loop amplitudes computed (whose final result was stored in a double
 
348
C precision variable) to the AMPL multiple precision array.
 
349
  DO I=NCTAMPS+1,NLOOPAMPS
 
350
    DO K=1,3
 
351
      AMPL(K,I)=DP_AMPL(K,I)
 
352
    ENDDO
 
353
  ENDDO
 
354
 
 
355
## if(ComputeColorFlows) {
 
356
  IF (DIRECT_ME_COMPUTATION) THEN
 
357
## }
 
358
  DO I=1,NLOOPAMPS
 
359
## if(not LoopInduced) {
 
360
    DO J=1,NBORNAMPS
 
361
## } else {
 
362
    DO J=1,NLOOPAMPS
 
363
## }
 
364
          CFTOT=CMPLX(CF_N(I,J)/REAL(ABS(CF_D(I,J)),KIND=16),0.0e0_16,KIND=16)
 
365
      IF(CF_D(I,J).LT.0) CFTOT=CFTOT*IMAG1
 
366
## if(not LoopInduced) {
 
367
      ITEMP = %(proc_prefix)sML5SQSOINDEX(%(proc_prefix)sML5SOINDEX_FOR_LOOP_AMP(I),%(proc_prefix)sML5SOINDEX_FOR_BORN_AMP(J))
 
368
      DO K=1,3
 
369
        TEMP2(K) = 2.0d0*HEL_MULT*REAL(CFTOT*AMPL(K,I)*CONJG(AMP(J)),KIND=16)
 
370
      ENDDO
 
371
## } else {
 
372
      ITEMP = %(proc_prefix)sML5SQSOINDEX(%(proc_prefix)sML5SOINDEX_FOR_LOOP_AMP(I),%(proc_prefix)sML5SOINDEX_FOR_LOOP_AMP(J))
 
373
      TEMP2(1) = HEL_MULT*REAL(CFTOT*AMPL(1,I)*CONJG(AMPL(1,J)),KIND=16)
 
374
C Computing the quantities below is not strictly necessary since the result should be finite
 
375
C It is however a good cross-check.
 
376
      TEMP2(2) = HEL_MULT*REAL(CFTOT*(AMPL(2,I)*CONJG(AMPL(1,J)) + AMPL(1,I)*CONJG(AMPL(2,J))),KIND=16)
 
377
      TEMP2(3) = HEL_MULT*REAL(CFTOT*(AMPL(3,I)*CONJG(AMPL(1,J)) + AMPL(1,I)*CONJG(AMPL(3,J))+AMPL(2,I)*CONJG(AMPL(2,J))),KIND=16)
 
378
## }
 
379
C To mimic the structure of the non loop-induced processes, we add here the squared counterterm contribution directly the result ANS and put the loop contributions in the LOOPRES array which will be added to ANS later
 
380
      IF (I.LE.NCTAMPS) THEN
 
381
        IF (.NOT.FILTER_SO.OR.SQSO_TARGET.EQ.ITEMP) THEN
 
382
          DO K=1,3
 
383
            ANS(K,ITEMP)=ANS(K,ITEMP)+TEMP2(K)
 
384
            ANS(K,0)=ANS(K,0)+TEMP2(K)
 
385
          ENDDO
 
386
        ENDIF
 
387
      ELSE
 
388
        DO K=1,3
 
389
C This LOOPRES array entries will be added to the main result ANS(*,*) later in the loop_matrix.f file. It is in double precision however, so the cast of the temporary variable TEMP2 is necessary.
 
390
          LOOPRES(K,ITEMP,I-NCTAMPS)=LOOPRES(K,ITEMP,I-NCTAMPS)+DBLE(TEMP2(K))
 
391
C During the evaluation of the AMPL, we had stored the stability in S(1,*) so we now copy over this flag to the relevant contributing Squared orders.
 
392
          S(ITEMP,I-NCTAMPS)=S(1,I-NCTAMPS)
 
393
        ENDDO
 
394
      ENDIF
 
395
    ENDDO
 
396
  ENDDO
 
397
 
 
398
## if(ComputeColorFlows) {
 
399
  ENDIF
 
400
## }
 
401
  
 
402
## }
 
403
 
 
404
 
 
405
 
 
406
## if(ComputeColorFlows){
 
407
C We should compute the color flow either if it contributes to the final result (i.e. not used just for the filtering), or if the computation is only done from the color flows
 
408
IF (((.NOT.DIRECT_ME_COMPUTATION).AND.ME_COMPUTATION_FROM_JAMP).OR.(H.EQ.USERHEL.OR.USERHEL.EQ.-1)) THEN
 
409
C The cumulative quantities must only be computed if that helicity contributes according to user request (second argument of the subroutine below).
 
410
  CALL %(proc_prefix)sCOMPUTE_COLOR_FLOWS(HEL_MULT,(H.EQ.USERHEL.OR.USERHEL.EQ.-1))
 
411
  IF(ME_COMPUTATION_FROM_JAMP) THEN
 
412
    CALL %(proc_prefix)sCOMPUTE_RES_FROM_JAMP(BUFFRES,HEL_MULT)
 
413
    IF(((.NOT.DIRECT_ME_COMPUTATION).AND.ME_COMPUTATION_FROM_JAMP)) THEN
 
414
C     If the computation from the color flow is the only form of computation, we directly update the answer.
 
415
      DO K=1,3
 
416
        DO I=0,NSQUAREDSO
 
417
          ANS(K,I)=ANS(K,I)+REAL(BUFFRES(K,I),KIND=16)
 
418
        ENDDO
 
419
      ENDDO
 
420
C     In this case, we temporarily store the compute Born ME in RES_FROM_JAMP(0,I), which will be used to set ANS(0,I) just after the call to this subroutine in loop_matrix.f
 
421
      DO I=0,NSQUAREDSO
 
422
        RES_FROM_JAMP(0,I)=RES_FROM_JAMP(0,I)+REAL(BUFFRES(0,I),KIND=16)
 
423
      ENDDO
 
424
C   When setting up the loop filter, it is important to set the quantitied LOOPRES.
 
425
C   Notice that you may have a more powerful filter with the direct computation mode because it can filter vanishing loop contributions for a particular squared split order only
 
426
C   The quantity LOOPRES defined below is not physical, but it's ok since it is only intended for the loop filtering.
 
427
C   In principle it is no longer necessary to compute the quantity below once the loop filter is setup, but it takes a negligible amount of time compare to the quad prec computations. 
 
428
      DO J=1,NLOOPGROUPS
 
429
        DO I=1,NSQUAREDSO
 
430
          DO K=1,3
 
431
            LOOPRES(K,I,J)=LOOPRES(K,I,J)+DP_AMPL(K,NCTAMPS+J)
 
432
          ENDDO
 
433
        ENDDO
 
434
      ENDDO
 
435
C   The if statement below is not strictly necessary but makes it clear when it is executed.
 
436
    ELSEIF(H.EQ.USERHEL.OR.USERHEL.EQ.-1) THEN
 
437
C     If both computational method is used, then we must just update RES_FROM_JAMP
 
438
      DO K=0,3
 
439
        DO I=0,NSQUAREDSO
 
440
          RES_FROM_JAMP(K,I)=RES_FROM_JAMP(K,I)+BUFFRES(K,I)
 
441
        ENDDO
 
442
      ENDDO
 
443
    ENDIF 
 
444
  ENDIF
 
445
ENDIF
 
446
## }
 
447
 
 
448
  ENDIF
207
449
ENDDO
208
450
 
209
451
DO I=1,3
212
454
  ENDDO
213
455
ENDDO
214
456
 
 
457
## if(not AmplitudeReduction) {
215
458
%(mp_coef_merging)s
 
459
## }
216
460
 
217
461
END