~maddevelopers/mg5amcnlo/2.9.4

« back to all changes in this revision

Viewing changes to aloha/template_files/aloha_functions_loop.f

pass to v2.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
C###############################################################################
 
2
C
 
3
C Copyright (c) 2010 The ALOHA Development team and Contributors
 
4
C
 
5
C This file is a part of the MadGraph5_aMC@NLO project, an application which
 
6
C automatically generates Feynman diagrams and matrix elements for arbitrary
 
7
C high-energy processes in the Standard Model and beyond.
 
8
C
 
9
C It is subject to the ALOHA license which should accompany this
 
10
C distribution.
 
11
C
 
12
C###############################################################################
 
13
      subroutine ixxxxx(p, fmass, nhel, nsf ,fi)
 
14
c
 
15
c This subroutine computes a fermion wavefunction with the flowing-IN
 
16
c fermion number.
 
17
c
 
18
c input:
 
19
c       real    p(0:3)         : four-momentum of fermion
 
20
c       real    fmass          : mass          of fermion
 
21
c       integer nhel = -1 or 1 : helicity      of fermion
 
22
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
23
c
 
24
c output:
 
25
c       complex fi(6)          : fermion wavefunction               |fi>
 
26
c
 
27
      implicit none
 
28
      double complex fi(8),chi(2)
 
29
      double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
 
30
     &     pp,pp3,sqp0p3,sqm(0:1)
 
31
      integer nhel,nsf,ip,im,nh
 
32
 
 
33
      double precision rZero, rHalf, rTwo
 
34
      parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
 
35
 
 
36
c#ifdef HELAS_CHECK
 
37
c      double precision p2
 
38
c      double precision epsi
 
39
c      parameter( epsi = 2.0d-5 )
 
40
c      integer stdo
 
41
c      parameter( stdo = 6 )
 
42
c#endif
 
43
c
 
44
c#ifdef HELAS_CHECK
 
45
c      pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
 
46
c      if ( abs(p(0))+pp.eq.rZero ) then
 
47
c         write(stdo,*)
 
48
c     &        ' helas-error : p(0:3) in ixxxxx is zero momentum'
 
49
c      endif
 
50
c      if ( p(0).le.rZero ) then
 
51
c         write(stdo,*)
 
52
c     &        ' helas-error : p(0:3) in ixxxxx has non-positive energy'
 
53
c         write(stdo,*)
 
54
c     &        '             : p(0) = ',p(0)
 
55
c      endif
 
56
c      p2 = (p(0)-pp)*(p(0)+pp)
 
57
c      if ( abs(p2-fmass**2).gt.p(0)**2*epsi ) then
 
58
c         write(stdo,*)
 
59
c     &        ' helas-error : p(0:3) in ixxxxx has inappropriate mass'
 
60
c         write(stdo,*)
 
61
c     &        '             : p**2 = ',p2,' : fmass**2 = ',fmass**2
 
62
c      endif
 
63
c      if (abs(nhel).ne.1) then
 
64
c         write(stdo,*) ' helas-error : nhel in ixxxxx is not -1,1'
 
65
c         write(stdo,*) '             : nhel = ',nhel
 
66
c      endif
 
67
c      if (abs(nsf).ne.1) then
 
68
c         write(stdo,*) ' helas-error : nsf in ixxxxx is not -1,1'
 
69
c         write(stdo,*) '             : nsf = ',nsf
 
70
c      endif
 
71
c#endif
 
72
 
 
73
c     Convention for trees
 
74
c      fi(5) = dcmplx(p(0),p(3))*nsf
 
75
c      fi(6) = dcmplx(p(1),p(2))*nsf
 
76
 
 
77
c     Convention for loop computations
 
78
      fi(1) = dcmplx(p(0),0.D0)*(-nsf)
 
79
      fi(2) = dcmplx(p(1),0.D0)*(-nsf)
 
80
      fi(3) = dcmplx(p(2),0.D0)*(-nsf)
 
81
      fi(4) = dcmplx(p(3),0.D0)*(-nsf)
 
82
 
 
83
      nh = nhel*nsf
 
84
 
 
85
      if ( fmass.ne.rZero ) then
 
86
 
 
87
         pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
88
 
 
89
         if ( pp.eq.rZero ) then
 
90
 
 
91
            sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
 
92
            sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
 
93
            ip = (1+nh)/2
 
94
            im = (1-nh)/2
 
95
 
 
96
            fi(5) = ip     * sqm(ip)
 
97
            fi(6) = im*nsf * sqm(ip)
 
98
            fi(7) = ip*nsf * sqm(im)
 
99
            fi(8) = im     * sqm(im)
 
100
 
 
101
         else
 
102
 
 
103
            sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
 
104
            sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
 
105
            omega(1) = dsqrt(p(0)+pp)
 
106
            omega(2) = fmass/omega(1)
 
107
            ip = (3+nh)/2
 
108
            im = (3-nh)/2
 
109
            sfomeg(1) = sf(1)*omega(ip)
 
110
            sfomeg(2) = sf(2)*omega(im)
 
111
            pp3 = max(pp+p(3),rZero)
 
112
            chi(1) = dcmplx( dsqrt(pp3*rHalf/pp) )
 
113
            if ( pp3.eq.rZero ) then
 
114
               chi(2) = dcmplx(-nh )
 
115
            else
 
116
               chi(2) = dcmplx( nh*p(1) , p(2) )/dsqrt(rTwo*pp*pp3)
 
117
            endif
 
118
 
 
119
            fi(5) = sfomeg(1)*chi(im)
 
120
            fi(6) = sfomeg(1)*chi(ip)
 
121
            fi(7) = sfomeg(2)*chi(im)
 
122
            fi(8) = sfomeg(2)*chi(ip)
 
123
 
 
124
         endif
 
125
 
 
126
      else
 
127
 
 
128
         if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
 
129
            sqp0p3 = 0d0
 
130
         else
 
131
            sqp0p3 = dsqrt(max(p(0)+p(3),rZero))*nsf
 
132
         end if
 
133
         chi(1) = dcmplx( sqp0p3 )
 
134
         if ( sqp0p3.eq.rZero ) then
 
135
            chi(2) = dcmplx(-nhel )*dsqrt(rTwo*p(0))
 
136
         else
 
137
            chi(2) = dcmplx( nh*p(1), p(2) )/sqp0p3
 
138
         endif
 
139
         if ( nh.eq.1 ) then
 
140
            fi(5) = dcmplx( rZero )
 
141
            fi(6) = dcmplx( rZero )
 
142
            fi(7) = chi(1)
 
143
            fi(8) = chi(2)
 
144
         else
 
145
            fi(5) = chi(2)
 
146
            fi(6) = chi(1)
 
147
            fi(7) = dcmplx( rZero )
 
148
            fi(8) = dcmplx( rZero )
 
149
         endif
 
150
      endif
 
151
c
 
152
      return
 
153
      end
 
154
 
 
155
 
 
156
      subroutine ixxxso(p, fmass, nhel, nsf ,fi)
 
157
c
 
158
c This subroutine computes a fermion wavefunction with the flowing-IN
 
159
c fermion number.
 
160
c
 
161
c input:
 
162
c       real    p(0:3)         : four-momentum of fermion
 
163
c       real    fmass          : mass          of fermion
 
164
c       integer nhel = -1 or 1 : helicity      of fermion
 
165
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
166
c
 
167
c output:
 
168
c       complex fi(6)          : fermion wavefunction               |fi>
 
169
c
 
170
      implicit none
 
171
      double complex fi(4),chi(2)
 
172
      double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
 
173
     &     pp,pp3,sqp0p3,sqm(0:1)
 
174
      integer nhel,nsf,ip,im,nh
 
175
 
 
176
      double precision rZero, rHalf, rTwo
 
177
      parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
 
178
 
 
179
c#ifdef HELAS_CHECK
 
180
c      double precision p2
 
181
c      double precision epsi
 
182
c      parameter( epsi = 2.0d-5 )
 
183
c      integer stdo
 
184
c      parameter( stdo = 6 )
 
185
c#endif
 
186
c
 
187
c#ifdef HELAS_CHECK
 
188
c      pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
 
189
c      if ( abs(p(0))+pp.eq.rZero ) then
 
190
c         write(stdo,*)
 
191
c     &        ' helas-error : p(0:3) in ixxxxx is zero momentum'
 
192
c      endif
 
193
c      if ( p(0).le.rZero ) then
 
194
c         write(stdo,*)
 
195
c     &        ' helas-error : p(0:3) in ixxxxx has non-positive energy'
 
196
c         write(stdo,*)
 
197
c     &        '             : p(0) = ',p(0)
 
198
c      endif
 
199
c      p2 = (p(0)-pp)*(p(0)+pp)
 
200
c      if ( abs(p2-fmass**2).gt.p(0)**2*epsi ) then
 
201
c         write(stdo,*)
 
202
c     &        ' helas-error : p(0:3) in ixxxxx has inappropriate mass'
 
203
c         write(stdo,*)
 
204
c     &        '             : p**2 = ',p2,' : fmass**2 = ',fmass**2
 
205
c      endif
 
206
c      if (abs(nhel).ne.1) then
 
207
c         write(stdo,*) ' helas-error : nhel in ixxxxx is not -1,1'
 
208
c         write(stdo,*) '             : nhel = ',nhel
 
209
c      endif
 
210
c      if (abs(nsf).ne.1) then
 
211
c         write(stdo,*) ' helas-error : nsf in ixxxxx is not -1,1'
 
212
c         write(stdo,*) '             : nsf = ',nsf
 
213
c      endif
 
214
c#endif
 
215
 
 
216
c     Convention for trees
 
217
c      fi(5) = dcmplx(p(0),p(3))*nsf
 
218
c      fi(6) = dcmplx(p(1),p(2))*nsf
 
219
 
 
220
c$$$c     Convention for loop computations
 
221
c$$$      fi(1) = dcmplx(p(0),0.D0)*(-nsf)
 
222
c$$$      fi(2) = dcmplx(p(1),0.D0)*(-nsf)
 
223
c$$$      fi(3) = dcmplx(p(2),0.D0)*(-nsf)
 
224
c$$$      fi(4) = dcmplx(p(3),0.D0)*(-nsf)
 
225
 
 
226
      nh = nhel*nsf
 
227
 
 
228
      if ( fmass.ne.rZero ) then
 
229
 
 
230
         pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
231
 
 
232
         if ( pp.eq.rZero ) then
 
233
 
 
234
            sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
 
235
            sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
 
236
            ip = (1+nh)/2
 
237
            im = (1-nh)/2
 
238
 
 
239
            fi(1) = ip     * sqm(ip)
 
240
            fi(2) = im*nsf * sqm(ip)
 
241
            fi(3) = ip*nsf * sqm(im)
 
242
            fi(4) = im     * sqm(im)
 
243
 
 
244
         else
 
245
 
 
246
            sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
 
247
            sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
 
248
            omega(1) = dsqrt(p(0)+pp)
 
249
            omega(2) = fmass/omega(1)
 
250
            ip = (3+nh)/2
 
251
            im = (3-nh)/2
 
252
            sfomeg(1) = sf(1)*omega(ip)
 
253
            sfomeg(2) = sf(2)*omega(im)
 
254
            pp3 = max(pp+p(3),rZero)
 
255
            chi(1) = dcmplx( dsqrt(pp3*rHalf/pp) )
 
256
            if ( pp3.eq.rZero ) then
 
257
               chi(2) = dcmplx(-nh )
 
258
            else
 
259
               chi(2) = dcmplx( nh*p(1) , p(2) )/dsqrt(rTwo*pp*pp3)
 
260
            endif
 
261
 
 
262
            fi(1) = sfomeg(1)*chi(im)
 
263
            fi(2) = sfomeg(1)*chi(ip)
 
264
            fi(3) = sfomeg(2)*chi(im)
 
265
            fi(4) = sfomeg(2)*chi(ip)
 
266
 
 
267
         endif
 
268
 
 
269
      else
 
270
 
 
271
         if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
 
272
            sqp0p3 = 0d0
 
273
         else
 
274
            sqp0p3 = dsqrt(max(p(0)+p(3),rZero))*nsf
 
275
         end if
 
276
         chi(1) = dcmplx( sqp0p3 )
 
277
         if ( sqp0p3.eq.rZero ) then
 
278
            chi(2) = dcmplx(-nhel )*dsqrt(rTwo*p(0))
 
279
         else
 
280
            chi(2) = dcmplx( nh*p(1), p(2) )/sqp0p3
 
281
         endif
 
282
         if ( nh.eq.1 ) then
 
283
            fi(1) = dcmplx( rZero )
 
284
            fi(2) = dcmplx( rZero )
 
285
            fi(3) = chi(1)
 
286
            fi(4) = chi(2)
 
287
         else
 
288
            fi(1) = chi(2)
 
289
            fi(2) = chi(1)
 
290
            fi(3) = dcmplx( rZero )
 
291
            fi(4) = dcmplx( rZero )
 
292
         endif
 
293
      endif
 
294
c
 
295
      return
 
296
      end
 
297
 
 
298
 
 
299
      subroutine mp_ixxxxx(p, fmass, nhel, nsf ,fi)
 
300
c
 
301
c This subroutine computes a fermion wavefunction with the flowing-IN
 
302
c fermion number, in QUADRUPLE PRECISIOn
 
303
c
 
304
c input:
 
305
c       real    p(0:3)         : four-momentum of fermion
 
306
c       real    fmass          : mass          of fermion
 
307
c       integer nhel = -1 or 1 : helicity      of fermion
 
308
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
309
c
 
310
c output:
 
311
c       complex fi(6)          : fermion wavefunction               |fi>
 
312
c
 
313
      implicit none
 
314
      complex*32 fi(8),chi(2)
 
315
      real*16 p(0:3),sf(2),sfomeg(2),omega(2),fmass,
 
316
     &     pp,pp3,sqp0p3,sqm(0:1)
 
317
      integer nhel,nsf,ip,im,nh
 
318
 
 
319
      real*16 rZero, rHalf, rTwo
 
320
      parameter( rZero = 0.0e0_16, rHalf = 0.5e0_16, rTwo = 2.0e0_16 )
 
321
c     Convention for loop computations
 
322
      fi(1) = cmplx(p(0),rZero,KIND=16)*(-nsf)
 
323
      fi(2) = cmplx(p(1),rZero,KIND=16)*(-nsf)
 
324
      fi(3) = cmplx(p(2),rZero,KIND=16)*(-nsf)
 
325
      fi(4) = cmplx(p(3),rZero,KIND=16)*(-nsf)
 
326
 
 
327
      nh = nhel*nsf
 
328
 
 
329
      if ( fmass.ne.rZero ) then
 
330
 
 
331
         pp = min(p(0),sqrt(p(1)**2+p(2)**2+p(3)**2))
 
332
 
 
333
         if ( pp.eq.rZero ) then
 
334
 
 
335
            sqm(0) = sqrt(abs(fmass)) ! possibility of negative fermion masses
 
336
            sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
 
337
            ip = (1+nh)/2
 
338
            im = (1-nh)/2
 
339
 
 
340
            fi(5) = ip     * sqm(ip)
 
341
            fi(6) = im*nsf * sqm(ip)
 
342
            fi(7) = ip*nsf * sqm(im)
 
343
            fi(8) = im     * sqm(im)
 
344
 
 
345
         else
 
346
 
 
347
            sf(1) = REAL(1+nsf+(1-nsf)*nh,KIND=16)*rHalf
 
348
            sf(2) = REAL(1+nsf-(1-nsf)*nh,KIND=16)*rHalf
 
349
            omega(1) = sqrt(p(0)+pp)
 
350
            omega(2) = fmass/omega(1)
 
351
            ip = (3+nh)/2
 
352
            im = (3-nh)/2
 
353
            sfomeg(1) = sf(1)*omega(ip)
 
354
            sfomeg(2) = sf(2)*omega(im)
 
355
            pp3 = max(pp+p(3),rZero)
 
356
            chi(1) = cmplx( sqrt(pp3*rHalf/pp), KIND=16 )
 
357
            if ( pp3.eq.rZero ) then
 
358
               chi(2) = cmplx(-nh ,KIND=16)
 
359
            else
 
360
               chi(2) = cmplx( nh*p(1) , p(2),KIND=16)/sqrt(rTwo*pp*pp3)
 
361
            endif
 
362
 
 
363
            fi(5) = sfomeg(1)*chi(im)
 
364
            fi(6) = sfomeg(1)*chi(ip)
 
365
            fi(7) = sfomeg(2)*chi(im)
 
366
            fi(8) = sfomeg(2)*chi(ip)
 
367
 
 
368
         endif
 
369
 
 
370
      else
 
371
 
 
372
         if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
 
373
            sqp0p3 = 0d0
 
374
         else
 
375
            sqp0p3 = sqrt(max(p(0)+p(3),rZero))*nsf
 
376
         end if
 
377
         chi(1) = cmplx( sqp0p3 ,KIND=16)
 
378
         if ( sqp0p3.eq.rZero ) then
 
379
            chi(2) = cmplx(-nhel ,KIND=16)*sqrt(rTwo*p(0))
 
380
         else
 
381
            chi(2) = cmplx( nh*p(1), p(2) ,KIND=16)/sqp0p3
 
382
         endif
 
383
         if ( nh.eq.1 ) then
 
384
            fi(5) = cmplx( rZero ,KIND=16)
 
385
            fi(6) = cmplx( rZero ,KIND=16)
 
386
            fi(7) = chi(1)
 
387
            fi(8) = chi(2)
 
388
         else
 
389
            fi(5) = chi(2)
 
390
            fi(6) = chi(1)
 
391
            fi(7) = cmplx( rZero ,KIND=16)
 
392
            fi(8) = cmplx( rZero ,KIND=16)
 
393
         endif
 
394
      endif
 
395
c
 
396
      return
 
397
      end
 
398
 
 
399
      subroutine oxxxxx(p,fmass,nhel,nsf , fo)
 
400
c
 
401
c This subroutine computes a fermion wavefunction with the flowing-OUT
 
402
c fermion number.
 
403
c
 
404
c input:
 
405
c       real    p(0:3)         : four-momentum of fermion
 
406
c       real    fmass          : mass          of fermion
 
407
c       integer nhel = -1 or 1 : helicity      of fermion
 
408
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
409
c
 
410
c output:
 
411
c       complex fo(6)          : fermion wavefunction               <fo|
 
412
c
 
413
      implicit none
 
414
      double complex fo(8),chi(2)
 
415
      double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
 
416
     &     pp,pp3,sqp0p3,sqm(0:1)
 
417
      integer nhel,nsf,nh,ip,im
 
418
 
 
419
      double precision rZero, rHalf, rTwo
 
420
      parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
 
421
 
 
422
c#ifdef HELAS_CHECK
 
423
c      double precision p2
 
424
c      double precision epsi
 
425
c      parameter( epsi = 2.0d-5 )
 
426
c      integer stdo
 
427
c      parameter( stdo = 6 )
 
428
c#endif
 
429
c
 
430
c#ifdef HELAS_CHECK
 
431
c      pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
 
432
c      if ( abs(p(0))+pp.eq.rZero ) then
 
433
c         write(stdo,*)
 
434
c     &        ' helas-error : p(0:3) in oxxxxx is zero momentum'
 
435
c      endif
 
436
c      if ( p(0).le.rZero ) then
 
437
c         write(stdo,*)
 
438
c     &        ' helas-error : p(0:3) in oxxxxx has non-positive energy'
 
439
c         write(stdo,*)
 
440
c     &        '         : p(0) = ',p(0)
 
441
c      endif
 
442
c      p2 = (p(0)-pp)*(p(0)+pp)
 
443
c      if ( abs(p2-fmass**2).gt.p(0)**2*epsi ) then
 
444
c         write(stdo,*)
 
445
c     &        ' helas-error : p(0:3) in oxxxxx has inappropriate mass'
 
446
c         write(stdo,*)
 
447
c     &        '             : p**2 = ',p2,' : fmass**2 = ',fmass**2
 
448
c      endif
 
449
c      if ( abs(nhel).ne.1 ) then
 
450
c         write(stdo,*) ' helas-error : nhel in oxxxxx is not -1,1'
 
451
c         write(stdo,*) '             : nhel = ',nhel
 
452
c      endif
 
453
c      if ( abs(nsf).ne.1 ) then
 
454
c         write(stdo,*) ' helas-error : nsf in oxxxxx is not -1,1'
 
455
c         write(stdo,*) '             : nsf = ',nsf
 
456
c      endif
 
457
c#endif
 
458
 
 
459
c     Convention for trees
 
460
c      fo(5) = dcmplx(p(0),p(3))*nsf
 
461
c      fo(6) = dcmplx(p(1),p(2))*nsf
 
462
 
 
463
c     Convention for loop computations
 
464
      fo(1) = dcmplx(p(0),0.D0)*(nsf)
 
465
      fo(2) = dcmplx(p(1),0.D0)*(nsf)
 
466
      fo(3) = dcmplx(p(2),0.D0)*(nsf)
 
467
      fo(4) = dcmplx(p(3),0.D0)*(nsf)
 
468
 
 
469
 
 
470
      nh = nhel*nsf
 
471
 
 
472
      if ( fmass.ne.rZero ) then
 
473
 
 
474
         pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
475
 
 
476
         if ( pp.eq.rZero ) then
 
477
 
 
478
            sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
 
479
            sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
 
480
            ip = -((1+nh)/2)
 
481
            im =  (1-nh)/2
 
482
 
 
483
            fo(5) = im     * sqm(im)
 
484
            fo(6) = ip*nsf * sqm(im)
 
485
            fo(7) = im*nsf * sqm(-ip)
 
486
            fo(8) = ip     * sqm(-ip)
 
487
 
 
488
         else
 
489
 
 
490
            pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
491
            sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
 
492
            sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
 
493
            omega(1) = dsqrt(p(0)+pp)
 
494
            omega(2) = fmass/omega(1)
 
495
            ip = (3+nh)/2
 
496
            im = (3-nh)/2
 
497
            sfomeg(1) = sf(1)*omega(ip)
 
498
            sfomeg(2) = sf(2)*omega(im)
 
499
            pp3 = max(pp+p(3),rZero)
 
500
            chi(1) = dcmplx( dsqrt(pp3*rHalf/pp) )
 
501
            if ( pp3.eq.rZero ) then
 
502
               chi(2) = dcmplx(-nh )
 
503
            else
 
504
               chi(2) = dcmplx( nh*p(1) , -p(2) )/dsqrt(rTwo*pp*pp3)
 
505
            endif
 
506
 
 
507
            fo(5) = sfomeg(2)*chi(im)
 
508
            fo(6) = sfomeg(2)*chi(ip)
 
509
            fo(7) = sfomeg(1)*chi(im)
 
510
            fo(8) = sfomeg(1)*chi(ip)
 
511
 
 
512
         endif
 
513
 
 
514
      else
 
515
 
 
516
         if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
 
517
            sqp0p3 = 0d0
 
518
         else
 
519
            sqp0p3 = dsqrt(max(p(0)+p(3),rZero))*nsf
 
520
         end if
 
521
         chi(1) = dcmplx( sqp0p3 )
 
522
         if ( sqp0p3.eq.rZero ) then
 
523
            chi(2) = dcmplx(-nhel )*dsqrt(rTwo*p(0))
 
524
         else
 
525
            chi(2) = dcmplx( nh*p(1), -p(2) )/sqp0p3
 
526
         endif
 
527
         if ( nh.eq.1 ) then
 
528
            fo(5) = chi(1)
 
529
            fo(6) = chi(2)
 
530
            fo(7) = dcmplx( rZero )
 
531
            fo(8) = dcmplx( rZero )
 
532
         else
 
533
            fo(5) = dcmplx( rZero )
 
534
            fo(6) = dcmplx( rZero )
 
535
            fo(7) = chi(2)
 
536
            fo(8) = chi(1)
 
537
         endif
 
538
 
 
539
      endif
 
540
c
 
541
      return
 
542
      end
 
543
 
 
544
      subroutine oxxxso(p,fmass,nhel,nsf , fo)
 
545
c
 
546
c This subroutine computes a fermion wavefunction with the flowing-OUT
 
547
c fermion number.
 
548
c
 
549
c input:
 
550
c       real    p(0:3)         : four-momentum of fermion
 
551
c       real    fmass          : mass          of fermion
 
552
c       integer nhel = -1 or 1 : helicity      of fermion
 
553
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
554
c
 
555
c output:
 
556
c       complex fo(6)          : fermion wavefunction               <fo|
 
557
c
 
558
      implicit none
 
559
      double complex fo(4),chi(2)
 
560
      double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
 
561
     &     pp,pp3,sqp0p3,sqm(0:1)
 
562
      integer nhel,nsf,nh,ip,im
 
563
 
 
564
      double precision rZero, rHalf, rTwo
 
565
      parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
 
566
 
 
567
c#ifdef HELAS_CHECK
 
568
c      double precision p2
 
569
c      double precision epsi
 
570
c      parameter( epsi = 2.0d-5 )
 
571
c      integer stdo
 
572
c      parameter( stdo = 6 )
 
573
c#endif
 
574
c
 
575
c#ifdef HELAS_CHECK
 
576
c      pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
 
577
c      if ( abs(p(0))+pp.eq.rZero ) then
 
578
c         write(stdo,*)
 
579
c     &        ' helas-error : p(0:3) in oxxxxx is zero momentum'
 
580
c      endif
 
581
c      if ( p(0).le.rZero ) then
 
582
c         write(stdo,*)
 
583
c     &        ' helas-error : p(0:3) in oxxxxx has non-positive energy'
 
584
c         write(stdo,*)
 
585
c     &        '         : p(0) = ',p(0)
 
586
c      endif
 
587
c      p2 = (p(0)-pp)*(p(0)+pp)
 
588
c      if ( abs(p2-fmass**2).gt.p(0)**2*epsi ) then
 
589
c         write(stdo,*)
 
590
c     &        ' helas-error : p(0:3) in oxxxxx has inappropriate mass'
 
591
c         write(stdo,*)
 
592
c     &        '             : p**2 = ',p2,' : fmass**2 = ',fmass**2
 
593
c      endif
 
594
c      if ( abs(nhel).ne.1 ) then
 
595
c         write(stdo,*) ' helas-error : nhel in oxxxxx is not -1,1'
 
596
c         write(stdo,*) '             : nhel = ',nhel
 
597
c      endif
 
598
c      if ( abs(nsf).ne.1 ) then
 
599
c         write(stdo,*) ' helas-error : nsf in oxxxxx is not -1,1'
 
600
c         write(stdo,*) '             : nsf = ',nsf
 
601
c      endif
 
602
c#endif
 
603
 
 
604
c     Convention for trees
 
605
c      fo(5) = dcmplx(p(0),p(3))*nsf
 
606
c      fo(6) = dcmplx(p(1),p(2))*nsf
 
607
 
 
608
c$$$c     Convention for loop computations
 
609
c$$$      fo(1) = dcmplx(p(0),0.D0)*(nsf)
 
610
c$$$      fo(2) = dcmplx(p(1),0.D0)*(nsf)
 
611
c$$$      fo(3) = dcmplx(p(2),0.D0)*(nsf)
 
612
c$$$      fo(4) = dcmplx(p(3),0.D0)*(nsf)
 
613
 
 
614
 
 
615
      nh = nhel*nsf
 
616
 
 
617
      if ( fmass.ne.rZero ) then
 
618
 
 
619
         pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
620
 
 
621
         if ( pp.eq.rZero ) then
 
622
 
 
623
            sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
 
624
            sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
 
625
            ip = -((1+nh)/2)
 
626
            im =  (1-nh)/2
 
627
 
 
628
            fo(1) = im     * sqm(im)
 
629
            fo(2) = ip*nsf * sqm(im)
 
630
            fo(3) = im*nsf * sqm(-ip)
 
631
            fo(4) = ip     * sqm(-ip)
 
632
 
 
633
         else
 
634
 
 
635
            pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
636
            sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
 
637
            sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
 
638
            omega(1) = dsqrt(p(0)+pp)
 
639
            omega(2) = fmass/omega(1)
 
640
            ip = (3+nh)/2
 
641
            im = (3-nh)/2
 
642
            sfomeg(1) = sf(1)*omega(ip)
 
643
            sfomeg(2) = sf(2)*omega(im)
 
644
            pp3 = max(pp+p(3),rZero)
 
645
            chi(1) = dcmplx( dsqrt(pp3*rHalf/pp) )
 
646
            if ( pp3.eq.rZero ) then
 
647
               chi(2) = dcmplx(-nh )
 
648
            else
 
649
               chi(2) = dcmplx( nh*p(1) , -p(2) )/dsqrt(rTwo*pp*pp3)
 
650
            endif
 
651
 
 
652
            fo(1) = sfomeg(2)*chi(im)
 
653
            fo(2) = sfomeg(2)*chi(ip)
 
654
            fo(3) = sfomeg(1)*chi(im)
 
655
            fo(4) = sfomeg(1)*chi(ip)
 
656
 
 
657
         endif
 
658
 
 
659
      else
 
660
 
 
661
         if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
 
662
            sqp0p3 = 0d0
 
663
         else
 
664
            sqp0p3 = dsqrt(max(p(0)+p(3),rZero))*nsf
 
665
         end if
 
666
         chi(1) = dcmplx( sqp0p3 )
 
667
         if ( sqp0p3.eq.rZero ) then
 
668
            chi(2) = dcmplx(-nhel )*dsqrt(rTwo*p(0))
 
669
         else
 
670
            chi(2) = dcmplx( nh*p(1), -p(2) )/sqp0p3
 
671
         endif
 
672
         if ( nh.eq.1 ) then
 
673
            fo(1) = chi(1)
 
674
            fo(2) = chi(2)
 
675
            fo(3) = dcmplx( rZero )
 
676
            fo(4) = dcmplx( rZero )
 
677
         else
 
678
            fo(1) = dcmplx( rZero )
 
679
            fo(2) = dcmplx( rZero )
 
680
            fo(3) = chi(2)
 
681
            fo(4) = chi(1)
 
682
         endif
 
683
 
 
684
      endif
 
685
c
 
686
      return
 
687
      end
 
688
 
 
689
      subroutine mp_oxxxxx(p,fmass,nhel,nsf , fo)
 
690
c
 
691
c This subroutine computes a fermion wavefunction with the flowing-OUT
 
692
c fermion number in quadruple precision.
 
693
c
 
694
c input:
 
695
c       real    p(0:3)         : four-momentum of fermion
 
696
c       real    fmass          : mass          of fermion
 
697
c       integer nhel = -1 or 1 : helicity      of fermion
 
698
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
699
c
 
700
c output:
 
701
c       complex fo(6)          : fermion wavefunction               <fo|
 
702
c
 
703
      implicit none
 
704
      complex*32 fo(8),chi(2)
 
705
      real*16 p(0:3),sf(2),sfomeg(2),omega(2),fmass,
 
706
     &     pp,pp3,sqp0p3,sqm(0:1)
 
707
      integer nhel,nsf,nh,ip,im
 
708
 
 
709
      real*16 rZero, rHalf, rTwo
 
710
      parameter( rZero = 0.0e0_16, rHalf = 0.5e0_16, rTwo = 2.0e0_16 )
 
711
 
 
712
c     Convention for loop computations
 
713
      fo(1) = cmplx(p(0),rZero,KIND=16)*nsf
 
714
      fo(2) = cmplx(p(1),rZero,KIND=16)*nsf
 
715
      fo(3) = cmplx(p(2),rZero,KIND=16)*nsf
 
716
      fo(4) = cmplx(p(3),rZero,KIND=16)*nsf
 
717
 
 
718
 
 
719
      nh = nhel*nsf
 
720
 
 
721
      if ( fmass.ne.rZero ) then
 
722
 
 
723
         pp = min(p(0),sqrt(p(1)**2+p(2)**2+p(3)**2))
 
724
 
 
725
         if ( pp.eq.rZero ) then
 
726
 
 
727
            sqm(0) = sqrt(abs(fmass)) ! possibility of negative fermion masses
 
728
            sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
 
729
            ip = -((1+nh)/2)
 
730
            im =  (1-nh)/2
 
731
 
 
732
            fo(5) = im     * sqm(im)
 
733
            fo(6) = ip*nsf * sqm(im)
 
734
            fo(7) = im*nsf * sqm(-ip)
 
735
            fo(8) = ip     * sqm(-ip)
 
736
 
 
737
         else
 
738
 
 
739
            pp = min(p(0),sqrt(p(1)**2+p(2)**2+p(3)**2))
 
740
            sf(1) = real(1+nsf+(1-nsf)*nh,KIND=16)*rHalf
 
741
            sf(2) = real(1+nsf-(1-nsf)*nh,KIND=16)*rHalf
 
742
            omega(1) = sqrt(p(0)+pp)
 
743
            omega(2) = fmass/omega(1)
 
744
            ip = (3+nh)/2
 
745
            im = (3-nh)/2
 
746
            sfomeg(1) = sf(1)*omega(ip)
 
747
            sfomeg(2) = sf(2)*omega(im)
 
748
            pp3 = max(pp+p(3),rZero)
 
749
            chi(1) = cmplx( sqrt(pp3*rHalf/pp) ,KIND=16)
 
750
            if ( pp3.eq.rZero ) then
 
751
               chi(2) = cmplx(-nh ,KIND=16)
 
752
            else
 
753
               chi(2) = cmplx( nh*p(1) , -p(2) , KIND=16)/
 
754
     & sqrt(rTwo*pp*pp3)
 
755
            endif
 
756
 
 
757
            fo(5) = sfomeg(2)*chi(im)
 
758
            fo(6) = sfomeg(2)*chi(ip)
 
759
            fo(7) = sfomeg(1)*chi(im)
 
760
            fo(8) = sfomeg(1)*chi(ip)
 
761
 
 
762
         endif
 
763
 
 
764
      else
 
765
 
 
766
         if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
 
767
            sqp0p3 = 0d0
 
768
         else
 
769
            sqp0p3 = sqrt(max(p(0)+p(3),rZero))*nsf
 
770
         end if
 
771
         chi(1) = cmplx( sqp0p3 ,KIND=16)
 
772
         if ( sqp0p3.eq.rZero ) then
 
773
            chi(2) = cmplx(-nhel , KIND=16)*sqrt(rTwo*p(0))
 
774
         else
 
775
            chi(2) = cmplx( nh*p(1), -p(2) , KIND=16)/sqp0p3
 
776
         endif
 
777
         if ( nh.eq.1 ) then
 
778
            fo(5) = chi(1)
 
779
            fo(6) = chi(2)
 
780
            fo(7) = cmplx( rZero , KIND=16)
 
781
            fo(8) = cmplx( rZero , KIND=16)
 
782
         else
 
783
            fo(5) = cmplx( rZero , KIND=16)
 
784
            fo(6) = cmplx( rZero , KIND=16)
 
785
            fo(7) = chi(2)
 
786
            fo(8) = chi(1)
 
787
         endif
 
788
 
 
789
      endif
 
790
c
 
791
      return
 
792
      end
 
793
 
 
794
      subroutine pxxxxx(p,tmass,nhel,nst , tc)
 
795
 
 
796
c    CP3 2009.NOV
 
797
 
 
798
c This subroutine computes a PSEUDOR wavefunction.
 
799
c
 
800
c input:
 
801
c       real    p(0:3)         : four-momentum of tensor boson
 
802
c       real    tmass          : mass          of tensor boson
 
803
c       integer nhel           : helicity      of tensor boson
 
804
c                = -2,-1,0,1,2 : (0 is forbidden if tmass=0.0)
 
805
c       integer nst  = -1 or 1 : +1 for final, -1 for initial
 
806
c
 
807
c output:
 
808
c       complex tc(18)         : PSEUDOR  wavefunction    epsilon^mu^nu(t)
 
809
c
 
810
      implicit none
 
811
      double precision p(0:3), tmass
 
812
      integer nhel, nst
 
813
      double complex tc(20)
 
814
 
 
815
      double complex ft(6,4), ep(4), em(4), e0(4)
 
816
      double precision pt, pt2, pp, pzpt, emp, sqh, sqs
 
817
      integer i, j
 
818
 
 
819
      double precision rZero, rHalf, rOne, rTwo
 
820
      parameter( rZero = 0.0d0, rHalf = 0.5d0 )
 
821
      parameter( rOne = 1.0d0, rTwo = 2.0d0 )
 
822
 
 
823
 
 
824
      tc(5)=NHEL
 
825
 
 
826
c     Convention for trees
 
827
c      tc(17) = dcmplx(p(0),p(3))*nst
 
828
c      tc(18) = dcmplx(p(1),p(2))*nst
 
829
 
 
830
c     Convention for loop computations
 
831
      tc(1) = dcmplx(p(0),0.D0)*nst
 
832
      tc(2) = dcmplx(p(1),0.D0)*nst
 
833
      tc(3) = dcmplx(p(2),0.D0)*nst
 
834
      tc(4) = dcmplx(p(3),0.D0)*nst
 
835
 
 
836
      return
 
837
      end
 
838
 
 
839
      subroutine mp_pxxxxx(p,tmass,nhel,nst , tc)
 
840
 
 
841
c    CP3 2009.NOV
 
842
 
 
843
c This subroutine computes a PSEUDOR wavefunction.
 
844
c
 
845
c input:
 
846
c       real    p(0:3)         : four-momentum of tensor boson
 
847
c       real    tmass          : mass          of tensor boson
 
848
c       integer nhel           : helicity      of tensor boson
 
849
c                = -2,-1,0,1,2 : (0 is forbidden if tmass=0.0)
 
850
c       integer nst  = -1 or 1 : +1 for final, -1 for initial
 
851
c
 
852
c output:
 
853
c       complex tc(18)         : PSEUDOR  wavefunction    epsilon^mu^nu(t)
 
854
c
 
855
      implicit none
 
856
      real*16 p(0:3), tmass
 
857
      integer nhel, nst
 
858
      complex*32 tc(20)
 
859
 
 
860
      complex*32 ft(6,4), ep(4), em(4), e0(4)
 
861
      real*16 pt, pt2, pp, pzpt, emp, sqh, sqs
 
862
      integer i, j
 
863
 
 
864
      real*16 rZero, rHalf, rOne, rTwo
 
865
      parameter( rZero = 0.0e0_16, rHalf = 0.5e0_16 )
 
866
      parameter( rOne = 1.0e0_16, rTwo = 2.0e0_16 )
 
867
 
 
868
 
 
869
      tc(5)=NHEL
 
870
 
 
871
c     Convention for trees
 
872
c      tc(17) = dcmplx(p(0),p(3))*nst
 
873
c      tc(18) = dcmplx(p(1),p(2))*nst
 
874
 
 
875
c     Convention for loop computations
 
876
      tc(1) = cmplx(p(0),0.0e0_16,KIND=16)*nst
 
877
      tc(2) = cmplx(p(1),0.0e0_16,KIND=16)*nst
 
878
      tc(3) = cmplx(p(2),0.0e0_16,KIND=16)*nst
 
879
      tc(4) = cmplx(p(3),0.0e0_16,KIND=16)*nst
 
880
 
 
881
      return
 
882
      end
 
883
 
 
884
      subroutine sxxxxx(p,nss , sc)
 
885
c
 
886
c This subroutine computes a complex SCALAR wavefunction.
 
887
c
 
888
c input:
 
889
c       real    p(0:3)         : four-momentum of scalar boson
 
890
c       integer nss  = -1 or 1 : +1 for final, -1 for initial
 
891
c
 
892
c output:
 
893
c       complex sc(3)          : scalar wavefunction                   s
 
894
c
 
895
      implicit none
 
896
      double complex sc(5)
 
897
      double precision p(0:3)
 
898
      integer nss
 
899
 
 
900
      double precision rOne
 
901
      parameter( rOne = 1.0d0 )
 
902
 
 
903
c#ifdef HELAS_CHECK
 
904
c      double precision p2
 
905
c      double precision epsi
 
906
c      parameter( epsi = 2.0d-5 )
 
907
c      double precision rZero
 
908
c      parameter( rZero = 0.0d0 )
 
909
c      integer stdo
 
910
c      parameter( stdo = 6 )
 
911
c#endif
 
912
c
 
913
c#ifdef HELAS_CHECK
 
914
c      if ( abs(p(0))+abs(p(1))+abs(p(2))+abs(p(3)).eq.rZero ) then
 
915
c         write(stdo,*)
 
916
c     &        ' helas-error : p(0:3) in sxxxxx is zero momentum'
 
917
c      endif
 
918
c      if ( p(0).le.rZero ) then
 
919
c         write(stdo,*)
 
920
c     &        ' helas-error : p(0:3) in sxxxxx has non-positive energy'
 
921
c         write(stdo,*)
 
922
c     &        '             : p(0) = ',p(0)
 
923
c      endif
 
924
c      p2 = p(0)**2-(p(1)**2+p(2)**2+p(3)**2)
 
925
c      if ( p2.lt.-p(0)**2*epsi ) then
 
926
c         write(stdo,*) ' helas-error : p(0:3) in sxxxxx is spacelike'
 
927
c         write(stdo,*) '             : p**2 = ',p2
 
928
c      endif
 
929
c      if ( abs(nss).ne.1 ) then
 
930
c         write(stdo,*) ' helas-error : nss in sxxxxx is not -1,1'
 
931
c         write(stdo,*) '             : nss = ',nss
 
932
c      endif
 
933
c#endif
 
934
 
 
935
      sc(5) = dcmplx( rOne )
 
936
 
 
937
c     Convention for trees
 
938
c      sc(2) = dcmplx(p(0),p(3))*nss
 
939
c      sc(3) = dcmplx(p(1),p(2))*nss
 
940
 
 
941
c     Convention for loop computations
 
942
      sc(1) = dcmplx(p(0),0.D0)*nss
 
943
      sc(2) = dcmplx(p(1),0.D0)*nss
 
944
      sc(3) = dcmplx(p(2),0.D0)*nss
 
945
      sc(4) = dcmplx(p(3),0.D0)*nss
 
946
c
 
947
      return
 
948
      end
 
949
 
 
950
      subroutine mp_sxxxxx(p,nss , sc)
 
951
c
 
952
c This subroutine computes a complex SCALAR wavefunction.
 
953
c in quadrupole precision.
 
954
c
 
955
c input:
 
956
c       real    p(0:3)         : four-momentum of scalar boson
 
957
c       integer nss  = -1 or 1 : +1 for final, -1 for initial
 
958
c
 
959
c output:
 
960
c       complex sc(3)          : scalar wavefunction                   s
 
961
c
 
962
      implicit none
 
963
      complex*32 sc(5)
 
964
      real*16 p(0:3)
 
965
      integer nss
 
966
 
 
967
      real*16 rOne
 
968
      parameter( rOne = 1.0e0_16 )
 
969
 
 
970
      sc(5) = cmplx( rOne , KIND=16)
 
971
 
 
972
c     Convention for trees
 
973
c      sc(2) = dcmplx(p(0),p(3))*nss
 
974
c      sc(3) = dcmplx(p(1),p(2))*nss
 
975
 
 
976
c     Convention for loop computations
 
977
      sc(1) = cmplx(p(0),0.0e0_16, KIND=16)*nss
 
978
      sc(2) = cmplx(p(1),0.0e0_16, KIND=16)*nss
 
979
      sc(3) = cmplx(p(2),0.0e0_16, KIND=16)*nss
 
980
      sc(4) = cmplx(p(3),0.0e0_16, KIND=16)*nss
 
981
c
 
982
      return
 
983
      end
 
984
 
 
985
      subroutine txxxxx(p,tmass,nhel,nst , tc)
 
986
c
 
987
c This subroutine computes a TENSOR wavefunction.
 
988
c
 
989
c input:
 
990
c       real    p(0:3)         : four-momentum of tensor boson
 
991
c       real    tmass          : mass          of tensor boson
 
992
c       integer nhel           : helicity      of tensor boson
 
993
c                = -2,-1,0,1,2 : (0 is forbidden if tmass=0.0)
 
994
c       integer nst  = -1 or 1 : +1 for final, -1 for initial
 
995
c
 
996
c output:
 
997
c       complex tc(18)         : tensor wavefunction    epsilon^mu^nu(t)
 
998
c
 
999
      implicit none
 
1000
      double precision p(0:3), tmass
 
1001
      integer nhel, nst
 
1002
      double complex tc(20)
 
1003
 
 
1004
      double complex ft(8,4), ep(4), em(4), e0(4)
 
1005
      double precision pt, pt2, pp, pzpt, emp, sqh, sqs
 
1006
      integer i, j
 
1007
 
 
1008
      double precision rZero, rHalf, rOne, rTwo
 
1009
      parameter( rZero = 0.0d0, rHalf = 0.5d0 )
 
1010
      parameter( rOne = 1.0d0, rTwo = 2.0d0 )
 
1011
 
 
1012
      integer stdo
 
1013
      parameter( stdo = 6 )
 
1014
 
 
1015
      sqh = sqrt(rHalf)
 
1016
      sqs = sqrt(rHalf/3.d0)
 
1017
 
 
1018
      pt2 = p(1)**2 + p(2)**2
 
1019
      pp = min(p(0),sqrt(pt2+p(3)**2))
 
1020
      pt = min(pp,sqrt(pt2))
 
1021
 
 
1022
c     Convention for trees
 
1023
c      ft(5,1) = dcmplx(p(0),p(3))*nst
 
1024
c      ft(6,1) = dcmplx(p(1),p(2))*nst
 
1025
 
 
1026
c     Convention for loop computations
 
1027
      ft(5,1) = dcmplx(p(0),0.D0)*nst
 
1028
      ft(6,1) = dcmplx(p(1),0.D0)*nst
 
1029
      ft(7,1) = dcmplx(p(2),0.D0)*nst
 
1030
      ft(8,1) = dcmplx(p(3),0.D0)*nst
 
1031
 
 
1032
      if ( nhel.ge.0 ) then
 
1033
c construct eps+
 
1034
         if ( pp.eq.rZero ) then
 
1035
            ep(1) = dcmplx( rZero )
 
1036
            ep(2) = dcmplx( -sqh )
 
1037
            ep(3) = dcmplx( rZero , nst*sqh )
 
1038
            ep(4) = dcmplx( rZero )
 
1039
         else
 
1040
            ep(1) = dcmplx( rZero )
 
1041
            ep(4) = dcmplx( pt/pp*sqh )
 
1042
            if ( pt.ne.rZero ) then
 
1043
               pzpt = p(3)/(pp*pt)*sqh
 
1044
               ep(2) = dcmplx( -p(1)*pzpt , -nst*p(2)/pt*sqh )
 
1045
               ep(3) = dcmplx( -p(2)*pzpt ,  nst*p(1)/pt*sqh )
 
1046
            else
 
1047
               ep(2) = dcmplx( -sqh )
 
1048
               ep(3) = dcmplx( rZero , nst*sign(sqh,p(3)) )
 
1049
            endif
 
1050
         endif
 
1051
      end if
 
1052
 
 
1053
      if ( nhel.le.0 ) then
 
1054
c construct eps-
 
1055
         if ( pp.eq.rZero ) then
 
1056
            em(1) = dcmplx( rZero )
 
1057
            em(2) = dcmplx( sqh )
 
1058
            em(3) = dcmplx( rZero , nst*sqh )
 
1059
            em(4) = dcmplx( rZero )
 
1060
         else
 
1061
            em(1) = dcmplx( rZero )
 
1062
            em(4) = dcmplx( -pt/pp*sqh )
 
1063
            if ( pt.ne.rZero ) then
 
1064
               pzpt = -p(3)/(pp*pt)*sqh
 
1065
               em(2) = dcmplx( -p(1)*pzpt , -nst*p(2)/pt*sqh )
 
1066
               em(3) = dcmplx( -p(2)*pzpt ,  nst*p(1)/pt*sqh )
 
1067
            else
 
1068
               em(2) = dcmplx( sqh )
 
1069
               em(3) = dcmplx( rZero , nst*sign(sqh,p(3)) )
 
1070
            endif
 
1071
         endif
 
1072
      end if
 
1073
 
 
1074
      if ( abs(nhel).le.1 ) then
 
1075
c construct eps0
 
1076
         if ( pp.eq.rZero ) then
 
1077
            e0(1) = dcmplx( rZero )
 
1078
            e0(2) = dcmplx( rZero )
 
1079
            e0(3) = dcmplx( rZero )
 
1080
            e0(4) = dcmplx( rOne )
 
1081
         else
 
1082
            emp = p(0)/(tmass*pp)
 
1083
            e0(1) = dcmplx( pp/tmass )
 
1084
            e0(4) = dcmplx( p(3)*emp )
 
1085
            if ( pt.ne.rZero ) then
 
1086
               e0(2) = dcmplx( p(1)*emp )
 
1087
               e0(3) = dcmplx( p(2)*emp )
 
1088
            else
 
1089
               e0(2) = dcmplx( rZero )
 
1090
               e0(3) = dcmplx( rZero )
 
1091
            endif
 
1092
         end if
 
1093
      end if
 
1094
 
 
1095
      if ( nhel.eq.2 ) then
 
1096
         do j = 1,4
 
1097
            do i = 1,4
 
1098
               ft(i,j) = ep(i)*ep(j)
 
1099
            end do
 
1100
         end do
 
1101
      else if ( nhel.eq.-2 ) then
 
1102
         do j = 1,4
 
1103
            do i = 1,4
 
1104
               ft(i,j) = em(i)*em(j)
 
1105
            end do
 
1106
         end do
 
1107
      else if (tmass.eq.0) then
 
1108
         do j = 1,4
 
1109
            do i = 1,4
 
1110
               ft(i,j) = 0
 
1111
            end do
 
1112
         end do
 
1113
      else if (tmass.ne.0) then
 
1114
        if  ( nhel.eq.1 ) then
 
1115
           do j = 1,4
 
1116
              do i = 1,4
 
1117
                 ft(i,j) = sqh*( ep(i)*e0(j) + e0(i)*ep(j) )
 
1118
              end do
 
1119
           end do
 
1120
        else if ( nhel.eq.0 ) then
 
1121
           do j = 1,4
 
1122
              do i = 1,4
 
1123
                 ft(i,j) = sqs*( ep(i)*em(j) + em(i)*ep(j)
 
1124
     &                                + rTwo*e0(i)*e0(j) )
 
1125
              end do
 
1126
           end do
 
1127
        else if ( nhel.eq.-1 ) then
 
1128
           do j = 1,4
 
1129
              do i = 1,4
 
1130
                 ft(i,j) = sqh*( em(i)*e0(j) + e0(i)*em(j) )
 
1131
              end do
 
1132
           end do
 
1133
        else
 
1134
           write(stdo,*) 'invalid helicity in TXXXXX'
 
1135
           stop
 
1136
        end if
 
1137
      end if
 
1138
 
 
1139
      tc(5) = ft(1,1)
 
1140
      tc(6) = ft(1,2)
 
1141
      tc(7) = ft(1,3)
 
1142
      tc(8) = ft(1,4)
 
1143
      tc(9) = ft(2,1)
 
1144
      tc(10) = ft(2,2)
 
1145
      tc(11) = ft(2,3)
 
1146
      tc(12) = ft(2,4)
 
1147
      tc(13) = ft(3,1)
 
1148
      tc(14) = ft(3,2)
 
1149
      tc(15) = ft(3,3)
 
1150
      tc(16) = ft(3,4)
 
1151
      tc(17) = ft(4,1)
 
1152
      tc(18) = ft(4,2)
 
1153
      tc(19) = ft(4,3)
 
1154
      tc(20) = ft(4,4)
 
1155
 
 
1156
      tc(1) = ft(5,1)
 
1157
      tc(2) = ft(6,1)
 
1158
      tc(3) = ft(7,1)
 
1159
      tc(4) = ft(8,1)
 
1160
 
 
1161
      return
 
1162
      end
 
1163
 
 
1164
 
 
1165
      subroutine mp_txxxxx(p,tmass,nhel,nst , tc)
 
1166
c
 
1167
c This subroutine computes a TENSOR wavefunction.
 
1168
c
 
1169
c input:
 
1170
c       real    p(0:3)         : four-momentum of tensor boson
 
1171
c       real    tmass          : mass          of tensor boson
 
1172
c       integer nhel           : helicity      of tensor boson
 
1173
c                = -2,-1,0,1,2 : (0 is forbidden if tmass=0.0)
 
1174
c       integer nst  = -1 or 1 : +1 for final, -1 for initial
 
1175
c
 
1176
c output:
 
1177
c       complex tc(18)         : tensor wavefunction    epsilon^mu^nu(t)
 
1178
c
 
1179
      implicit none
 
1180
      real*16 p(0:3), tmass
 
1181
      integer nhel, nst
 
1182
      complex*32 tc(20)
 
1183
 
 
1184
      complex*32 ft(8,4), ep(4), em(4), e0(4)
 
1185
      real*16 pt, pt2, pp, pzpt, emp, sqh, sqs
 
1186
      integer i, j
 
1187
 
 
1188
      real*16 rZero, rHalf, rOne, rTwo
 
1189
      parameter( rZero = 0.0e0_16, rHalf = 0.5e0_16 )
 
1190
      parameter( rOne = 1.0e0_16, rTwo = 2.0e0_16 )
 
1191
 
 
1192
      integer stdo
 
1193
      parameter( stdo = 6 )
 
1194
 
 
1195
      sqh = sqrt(rHalf)
 
1196
      sqs = sqrt(rHalf/3.0e0_16)
 
1197
 
 
1198
      pt2 = p(1)**2 + p(2)**2
 
1199
      pp = min(p(0),sqrt(pt2+p(3)**2))
 
1200
      pt = min(pp,sqrt(pt2))
 
1201
 
 
1202
c     Convention for trees
 
1203
c      ft(5,1) = dcmplx(p(0),p(3))*nst
 
1204
c      ft(6,1) = dcmplx(p(1),p(2))*nst
 
1205
 
 
1206
c     Convention for loop computations
 
1207
      ft(5,1) = cmplx(p(0),0.0e0_16)*nst
 
1208
      ft(6,1) = cmplx(p(1),0.0e0_16)*nst
 
1209
      ft(7,1) = cmplx(p(2),0.0e0_16)*nst
 
1210
      ft(8,1) = cmplx(p(3),0.0e0_16)*nst
 
1211
 
 
1212
      if ( nhel.ge.0 ) then
 
1213
c construct eps+
 
1214
         if ( pp.eq.rZero ) then
 
1215
            ep(1) = cmplx( rZero ,KIND=16)
 
1216
            ep(2) = cmplx( -sqh ,KIND=16)
 
1217
            ep(3) = cmplx( rZero , nst*sqh ,KIND=16)
 
1218
            ep(4) = cmplx( rZero ,KIND=16)
 
1219
         else
 
1220
            ep(1) = cmplx( rZero ,KIND=16)
 
1221
            ep(4) = cmplx( pt/pp*sqh ,KIND=16)
 
1222
            if ( pt.ne.rZero ) then
 
1223
               pzpt = p(3)/(pp*pt)*sqh
 
1224
               ep(2) = cmplx( -p(1)*pzpt , -nst*p(2)/pt*sqh ,KIND=16)
 
1225
               ep(3) = cmplx( -p(2)*pzpt ,  nst*p(1)/pt*sqh ,KIND=16)
 
1226
            else
 
1227
               ep(2) = cmplx( -sqh ,KIND=16)
 
1228
               ep(3) = cmplx( rZero , nst*sign(sqh,p(3)) ,KIND=16)
 
1229
            endif
 
1230
         endif
 
1231
      end if
 
1232
 
 
1233
      if ( nhel.le.0 ) then
 
1234
c construct eps-
 
1235
         if ( pp.eq.rZero ) then
 
1236
            em(1) = cmplx( rZero ,KIND=16)
 
1237
            em(2) = cmplx( sqh ,KIND=16)
 
1238
            em(3) = cmplx( rZero , nst*sqh ,KIND=16)
 
1239
            em(4) = cmplx( rZero ,KIND=16)
 
1240
         else
 
1241
            em(1) = cmplx( rZero ,KIND=16)
 
1242
            em(4) = cmplx( -pt/pp*sqh ,KIND=16)
 
1243
            if ( pt.ne.rZero ) then
 
1244
               pzpt = -p(3)/(pp*pt)*sqh
 
1245
               em(2) = cmplx( -p(1)*pzpt , -nst*p(2)/pt*sqh ,KIND=16)
 
1246
               em(3) = cmplx( -p(2)*pzpt ,  nst*p(1)/pt*sqh ,KIND=16)
 
1247
            else
 
1248
               em(2) = cmplx( sqh ,KIND=16)
 
1249
               em(3) = cmplx( rZero , nst*sign(sqh,p(3)) ,KIND=16)
 
1250
            endif
 
1251
         endif
 
1252
      end if
 
1253
 
 
1254
      if ( abs(nhel).le.1 ) then
 
1255
c construct eps0
 
1256
         if ( pp.eq.rZero ) then
 
1257
            e0(1) = cmplx( rZero ,KIND=16)
 
1258
            e0(2) = cmplx( rZero ,KIND=16)
 
1259
            e0(3) = cmplx( rZero ,KIND=16)
 
1260
            e0(4) = cmplx( rOne ,KIND=16)
 
1261
         else
 
1262
            emp = p(0)/(tmass*pp)
 
1263
            e0(1) = cmplx( pp/tmass ,KIND=16)
 
1264
            e0(4) = cmplx( p(3)*emp ,KIND=16)
 
1265
            if ( pt.ne.rZero ) then
 
1266
               e0(2) = cmplx( p(1)*emp ,KIND=16)
 
1267
               e0(3) = cmplx( p(2)*emp ,KIND=16)
 
1268
            else
 
1269
               e0(2) = cmplx( rZero ,KIND=16)
 
1270
               e0(3) = cmplx( rZero ,KIND=16)
 
1271
            endif
 
1272
         end if
 
1273
      end if
 
1274
 
 
1275
      if ( nhel.eq.2 ) then
 
1276
         do j = 1,4
 
1277
            do i = 1,4
 
1278
               ft(i,j) = ep(i)*ep(j)
 
1279
            end do
 
1280
         end do
 
1281
      else if ( nhel.eq.-2 ) then
 
1282
         do j = 1,4
 
1283
            do i = 1,4
 
1284
               ft(i,j) = em(i)*em(j)
 
1285
            end do
 
1286
         end do
 
1287
      else if (tmass.eq.0) then
 
1288
         do j = 1,4
 
1289
            do i = 1,4
 
1290
               ft(i,j) = 0
 
1291
            end do
 
1292
         end do
 
1293
      else if (tmass.ne.0) then
 
1294
        if  ( nhel.eq.1 ) then
 
1295
           do j = 1,4
 
1296
              do i = 1,4
 
1297
                 ft(i,j) = sqh*( ep(i)*e0(j) + e0(i)*ep(j) )
 
1298
              end do
 
1299
           end do
 
1300
        else if ( nhel.eq.0 ) then
 
1301
           do j = 1,4
 
1302
              do i = 1,4
 
1303
                 ft(i,j) = sqs*( ep(i)*em(j) + em(i)*ep(j)
 
1304
     &                                + rTwo*e0(i)*e0(j) )
 
1305
              end do
 
1306
           end do
 
1307
        else if ( nhel.eq.-1 ) then
 
1308
           do j = 1,4
 
1309
              do i = 1,4
 
1310
                 ft(i,j) = sqh*( em(i)*e0(j) + e0(i)*em(j) )
 
1311
              end do
 
1312
           end do
 
1313
        else
 
1314
           write(stdo,*) 'invalid helicity in TXXXXX'
 
1315
           stop
 
1316
        end if
 
1317
      end if
 
1318
 
 
1319
      tc(5) = ft(1,1)
 
1320
      tc(6) = ft(1,2)
 
1321
      tc(7) = ft(1,3)
 
1322
      tc(8) = ft(1,4)
 
1323
      tc(9) = ft(2,1)
 
1324
      tc(10) = ft(2,2)
 
1325
      tc(11) = ft(2,3)
 
1326
      tc(12) = ft(2,4)
 
1327
      tc(13) = ft(3,1)
 
1328
      tc(14) = ft(3,2)
 
1329
      tc(15) = ft(3,3)
 
1330
      tc(16) = ft(3,4)
 
1331
      tc(17) = ft(4,1)
 
1332
      tc(18) = ft(4,2)
 
1333
      tc(19) = ft(4,3)
 
1334
      tc(20) = ft(4,4)
 
1335
 
 
1336
      tc(1) = ft(5,1)
 
1337
      tc(2) = ft(6,1)
 
1338
      tc(3) = ft(7,1)
 
1339
      tc(4) = ft(8,1)
 
1340
 
 
1341
      return
 
1342
      end
 
1343
 
 
1344
      subroutine vxxxxx(p,vmass,nhel,nsv , vc)
 
1345
c
 
1346
c This subroutine computes a VECTOR wavefunction.
 
1347
c
 
1348
c input:
 
1349
c       real    p(0:3)         : four-momentum of vector boson
 
1350
c       real    vmass          : mass          of vector boson
 
1351
c       integer nhel = -1, 0, 1: helicity      of vector boson
 
1352
c                                (0 is forbidden if vmass=0.0)
 
1353
c       integer nsv  = -1 or 1 : +1 for final, -1 for initial
 
1354
c
 
1355
c output:
 
1356
c       complex vc(6)          : vector wavefunction       epsilon^mu(v)
 
1357
c
 
1358
      implicit none
 
1359
      double complex vc(8)
 
1360
      double precision p(0:3),vmass,hel,hel0,pt,pt2,pp,pzpt,emp,sqh
 
1361
      integer nhel,nsv,nsvahl
 
1362
 
 
1363
      double precision rZero, rHalf, rOne, rTwo
 
1364
      parameter( rZero = 0.0d0, rHalf = 0.5d0 )
 
1365
      parameter( rOne = 1.0d0, rTwo = 2.0d0 )
 
1366
 
 
1367
c#ifdef HELAS_CHECK
 
1368
c      double precision p2
 
1369
c      double precision epsi
 
1370
c      parameter( epsi = 2.0d-5 )
 
1371
c      integer stdo
 
1372
c      parameter( stdo = 6 )
 
1373
c#endif
 
1374
c
 
1375
c#ifdef HELAS_CHECK
 
1376
c      pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
 
1377
c      if ( abs(p(0))+pp.eq.rZero ) then
 
1378
c         write(stdo,*)
 
1379
c     &        ' helas-error : p(0:3) in vxxxxx is zero momentum'
 
1380
c      endif
 
1381
c      if ( p(0).le.rZero ) then
 
1382
c         write(stdo,*)
 
1383
c     &        ' helas-error : p(0:3) in vxxxxx has non-positive energy'
 
1384
c         write(stdo,*)
 
1385
c     &        '             : p(0) = ',p(0)
 
1386
c      endif
 
1387
c      p2 = (p(0)+pp)*(p(0)-pp)
 
1388
c      if ( abs(p2-vmass**2).gt.p(0)**2*2.e-5 ) then
 
1389
c         write(stdo,*)
 
1390
c     &        ' helas-error : p(0:3) in vxxxxx has inappropriate mass'
 
1391
c         write(stdo,*)
 
1392
c     &        '             : p**2 = ',p2,' : vmass**2 = ',vmass**2
 
1393
c      endif
 
1394
c      if ( vmass.ne.rZero ) then
 
1395
c         if ( abs(nhel).gt.1 ) then
 
1396
c            write(stdo,*) ' helas-error : nhel in vxxxxx is not -1,0,1'
 
1397
c            write(stdo,*) '             : nhel = ',nhel
 
1398
c         endif
 
1399
c      else
 
1400
c         if ( abs(nhel).ne.1 ) then
 
1401
c            write(stdo,*) ' helas-error : nhel in vxxxxx is not -1,1'
 
1402
c            write(stdo,*) '             : nhel = ',nhel
 
1403
c         endif
 
1404
c      endif
 
1405
c      if ( abs(nsv).ne.1 ) then
 
1406
c         write(stdo,*) ' helas-error : nsv in vmxxxx is not -1,1'
 
1407
c         write(stdo,*) '             : nsv = ',nsv
 
1408
c      endif
 
1409
c#endif
 
1410
 
 
1411
      sqh = dsqrt(rHalf)
 
1412
      hel = dble(nhel)
 
1413
      nsvahl = nsv*dabs(hel)
 
1414
      pt2 = p(1)**2+p(2)**2
 
1415
      pp = min(p(0),dsqrt(pt2+p(3)**2))
 
1416
      pt = min(pp,dsqrt(pt2))
 
1417
 
 
1418
c     Convention for trees
 
1419
c      vc(5) = dcmplx(p(0),p(3))*nsv
 
1420
c      vc(6) = dcmplx(p(1),p(2))*nsv
 
1421
 
 
1422
c     Convention for loop computations
 
1423
      vc(1) = dcmplx(p(0),0.D0)*nsv
 
1424
      vc(2) = dcmplx(p(1),0.D0)*nsv
 
1425
      vc(3) = dcmplx(p(2),0.D0)*nsv
 
1426
      vc(4) = dcmplx(p(3),0.D0)*nsv
 
1427
 
 
1428
c#ifdef HELAS_CHECK
 
1429
c nhel=4 option for scalar polarization
 
1430
c      if( nhel.eq.4 ) then
 
1431
c         if( vmass.eq.rZero ) then
 
1432
c            vc(1) = rOne
 
1433
c            vc(2) = p(1)/p(0)
 
1434
c            vc(3) = p(2)/p(0)
 
1435
c            vc(4) = p(3)/p(0)
 
1436
c         else
 
1437
c            vc(1) = p(0)/vmass
 
1438
c            vc(2) = p(1)/vmass
 
1439
c            vc(3) = p(2)/vmass
 
1440
c            vc(4) = p(3)/vmass
 
1441
c         endif
 
1442
c         return
 
1443
c      endif
 
1444
c#endif
 
1445
 
 
1446
      if ( vmass.ne.rZero ) then
 
1447
 
 
1448
         hel0 = rOne-dabs(hel)
 
1449
 
 
1450
         if ( pp.eq.rZero ) then
 
1451
 
 
1452
            vc(5) = dcmplx( rZero )
 
1453
            vc(6) = dcmplx(-hel*sqh )
 
1454
            vc(7) = dcmplx( rZero , nsvahl*sqh )
 
1455
            vc(8) = dcmplx( hel0 )
 
1456
 
 
1457
         else
 
1458
 
 
1459
            emp = p(0)/(vmass*pp)
 
1460
            vc(5) = dcmplx( hel0*pp/vmass )
 
1461
            vc(8) = dcmplx( hel0*p(3)*emp+hel*pt/pp*sqh )
 
1462
            if ( pt.ne.rZero ) then
 
1463
               pzpt = p(3)/(pp*pt)*sqh*hel
 
1464
               vc(6) = dcmplx( hel0*p(1)*emp-p(1)*pzpt ,
 
1465
     &                         -nsvahl*p(2)/pt*sqh       )
 
1466
               vc(7) = dcmplx( hel0*p(2)*emp-p(2)*pzpt ,
 
1467
     &                          nsvahl*p(1)/pt*sqh       )
 
1468
            else
 
1469
               vc(6) = dcmplx( -hel*sqh )
 
1470
               vc(7) = dcmplx( rZero , nsvahl*sign(sqh,p(3)) )
 
1471
            endif
 
1472
 
 
1473
         endif
 
1474
 
 
1475
      else
 
1476
 
 
1477
         pp = p(0)
 
1478
         pt = sqrt(p(1)**2+p(2)**2)
 
1479
         vc(5) = dcmplx( rZero )
 
1480
         vc(8) = dcmplx( hel*pt/pp*sqh )
 
1481
         if ( pt.ne.rZero ) then
 
1482
            pzpt = p(3)/(pp*pt)*sqh*hel
 
1483
            vc(6) = dcmplx( -p(1)*pzpt , -nsv*p(2)/pt*sqh )
 
1484
            vc(7) = dcmplx( -p(2)*pzpt ,  nsv*p(1)/pt*sqh )
 
1485
        else
 
1486
            vc(6) = dcmplx( -hel*sqh )
 
1487
            vc(7) = dcmplx( rZero , nsv*sign(sqh,p(3)) )
 
1488
         endif
 
1489
 
 
1490
      endif
 
1491
c
 
1492
      return
 
1493
      end
 
1494
 
 
1495
      subroutine mp_vxxxxx(p,vmass,nhel,nsv , vc)
 
1496
c
 
1497
c This subroutine computes a VECTOR wavefunction in quadruple precision.
 
1498
c
 
1499
c input:
 
1500
c       real    p(0:3)         : four-momentum of vector boson
 
1501
c       real    vmass          : mass          of vector boson
 
1502
c       integer nhel = -1, 0, 1: helicity      of vector boson
 
1503
c                                (0 is forbidden if vmass=0.0)
 
1504
c       integer nsv  = -1 or 1 : +1 for final, -1 for initial
 
1505
c
 
1506
c output:
 
1507
c       complex vc(6)          : vector wavefunction       epsilon^mu(v)
 
1508
c
 
1509
      implicit none
 
1510
      complex*32 vc(8)
 
1511
      real*16 p(0:3),vmass,hel,hel0,pt,pt2,pp,pzpt,emp,sqh
 
1512
      integer nhel,nsv,nsvahl
 
1513
 
 
1514
      real*16 rZero, rHalf, rOne, rTwo
 
1515
      parameter( rZero = 0.0e0_16, rHalf = 0.5e0_16 )
 
1516
      parameter( rOne = 1.0e0_16, rTwo = 2.0e0_16 )
 
1517
 
 
1518
      sqh = sqrt(rHalf)
 
1519
      hel = real(nhel,KIND=16)
 
1520
      nsvahl = nsv*abs(hel)
 
1521
      pt2 = p(1)**2+p(2)**2
 
1522
      pp = min(p(0),sqrt(pt2+p(3)**2))
 
1523
      pt = min(pp,sqrt(pt2))
 
1524
 
 
1525
c     Convention for loop computations
 
1526
      vc(1) = cmplx(p(0),0.e0_16, KIND=16)*nsv
 
1527
      vc(2) = cmplx(p(1),0.e0_16, KIND=16)*nsv
 
1528
      vc(3) = cmplx(p(2),0.e0_16, KIND=16)*nsv
 
1529
      vc(4) = cmplx(p(3),0.e0_16, KIND=16)*nsv
 
1530
 
 
1531
      if ( vmass.ne.rZero ) then
 
1532
 
 
1533
         hel0 = rOne-abs(hel)
 
1534
 
 
1535
         if ( pp.eq.rZero ) then
 
1536
 
 
1537
            vc(5) = cmplx( rZero , KIND=16)
 
1538
            vc(6) = cmplx(-hel*sqh , KIND=16)
 
1539
            vc(7) = cmplx( rZero , nsvahl*sqh , KIND=16)
 
1540
            vc(8) = cmplx( hel0 , KIND=16)
 
1541
 
 
1542
         else
 
1543
 
 
1544
            emp = p(0)/(vmass*pp)
 
1545
            vc(5) = cmplx( hel0*pp/vmass , KIND=16)
 
1546
            vc(8) = cmplx( hel0*p(3)*emp+hel*pt/pp*sqh , KIND=16 )
 
1547
            if ( pt.ne.rZero ) then
 
1548
               pzpt = p(3)/(pp*pt)*sqh*hel
 
1549
               vc(6) = cmplx( hel0*p(1)*emp-p(1)*pzpt ,
 
1550
     &                         -nsvahl*p(2)/pt*sqh       , KIND=16)
 
1551
               vc(7) = cmplx( hel0*p(2)*emp-p(2)*pzpt ,
 
1552
     &                          nsvahl*p(1)/pt*sqh       , KIND=16)
 
1553
            else
 
1554
               vc(6) = cmplx( -hel*sqh , KIND=16)
 
1555
               vc(7) = cmplx( rZero , nsvahl*sign(sqh,p(3)) , KIND=16)
 
1556
            endif
 
1557
 
 
1558
         endif
 
1559
 
 
1560
      else
 
1561
 
 
1562
         pp = p(0)
 
1563
         pt = sqrt(p(1)**2+p(2)**2)
 
1564
         vc(5) = cmplx( rZero , KIND=16)
 
1565
         vc(8) = cmplx( hel*pt/pp*sqh , KIND=16)
 
1566
         if ( pt.ne.rZero ) then
 
1567
            pzpt = p(3)/(pp*pt)*sqh*hel
 
1568
            vc(6) = cmplx( -p(1)*pzpt , -nsv*p(2)/pt*sqh , KIND=16)
 
1569
            vc(7) = cmplx( -p(2)*pzpt ,  nsv*p(1)/pt*sqh , KIND=16)
 
1570
         else
 
1571
            vc(6) = cmplx( -hel*sqh , KIND=16)
 
1572
            vc(7) = cmplx( rZero , nsv*sign(sqh,p(3)), KIND=16 )
 
1573
         endif
 
1574
 
 
1575
      endif
 
1576
c
 
1577
      return
 
1578
      end
 
1579
 
 
1580
      subroutine boostx(p,q , pboost)
 
1581
c
 
1582
c This subroutine performs the Lorentz boost of a four-momentum.  The
 
1583
c momentum p is assumed to be given in the rest frame of q.  pboost is
 
1584
c the momentum p boosted to the frame in which q is given.  q must be a
 
1585
c timelike momentum.
 
1586
c
 
1587
c input:
 
1588
c       real    p(0:3)         : four-momentum p in the q rest  frame
 
1589
c       real    q(0:3)         : four-momentum q in the boosted frame
 
1590
c
 
1591
c output:
 
1592
c       real    pboost(0:3)    : four-momentum p in the boosted frame
 
1593
c
 
1594
      implicit none
 
1595
      double precision p(0:3),q(0:3),pboost(0:3),pq,qq,m,lf
 
1596
 
 
1597
      double precision rZero
 
1598
      parameter( rZero = 0.0d0 )
 
1599
 
 
1600
      qq = q(1)**2+q(2)**2+q(3)**2
 
1601
 
 
1602
c#ifdef HELAS_CHECK
 
1603
c      if (abs(p(0))+abs(p(1))+abs(p(2))+abs(p(3)).eq.rZero) then
 
1604
c         write(stdo,*)
 
1605
c     &        ' helas-error : p(0:3) in boostx is zero momentum'
 
1606
c      endif
 
1607
c      if (abs(q(0))+qq.eq.rZero) then
 
1608
c         write(stdo,*)
 
1609
c     &        ' helas-error : q(0:3) in boostx is zero momentum'
 
1610
c      endif
 
1611
c      if (p(0).le.rZero) then
 
1612
c         write(stdo,*)
 
1613
c     &        ' helas-warn  : p(0:3) in boostx has not positive energy'
 
1614
c         write(stdo,*)
 
1615
c     &        '             : p(0) = ',p(0)
 
1616
c      endif
 
1617
c      if (q(0).le.rZero) then
 
1618
c         write(stdo,*)
 
1619
c     &        ' helas-error : q(0:3) in boostx has not positive energy'
 
1620
c         write(stdo,*)
 
1621
c     &        '             : q(0) = ',q(0)
 
1622
c      endif
 
1623
c      pp=p(0)**2-p(1)**2-p(2)**2-p(3)**2
 
1624
c      if (pp.lt.rZero) then
 
1625
c         write(stdo,*)
 
1626
c     &        ' helas-warn  : p(0:3) in boostx is spacelike'
 
1627
c         write(stdo,*)
 
1628
c     &        '             : p**2 = ',pp
 
1629
c      endif
 
1630
c      if (q(0)**2-qq.le.rZero) then
 
1631
c         write(stdo,*)
 
1632
c     &        ' helas-error : q(0:3) in boostx is not timelike'
 
1633
c         write(stdo,*)
 
1634
c     &        '             : q**2 = ',q(0)**2-qq
 
1635
c      endif
 
1636
c      if (qq.eq.rZero) then
 
1637
c         write(stdo,*)
 
1638
c     &   ' helas-warn  : q(0:3) in boostx has zero spacial components'
 
1639
c      endif
 
1640
c#endif
 
1641
 
 
1642
      if ( qq.ne.rZero ) then
 
1643
         pq = p(1)*q(1)+p(2)*q(2)+p(3)*q(3)
 
1644
         m = sqrt(q(0)**2-qq)
 
1645
         lf = ((q(0)-m)*pq/qq+p(0))/m
 
1646
         pboost(0) = (p(0)*q(0)+pq)/m
 
1647
         pboost(1) =  p(1)+q(1)*lf
 
1648
         pboost(2) =  p(2)+q(2)*lf
 
1649
         pboost(3) =  p(3)+q(3)*lf
 
1650
      else
 
1651
         pboost(0) = p(0)
 
1652
         pboost(1) = p(1)
 
1653
         pboost(2) = p(2)
 
1654
         pboost(3) = p(3)
 
1655
      endif
 
1656
c
 
1657
      return
 
1658
      end
 
1659
 
 
1660
      subroutine boostm(p,q,m, pboost)
 
1661
c
 
1662
c This subroutine performs the Lorentz boost of a four-momentum.  The
 
1663
c momentum p is assumed to be given in the rest frame of q.  pboost is
 
1664
c the momentum p boosted to the frame in which q is given.  q must be a
 
1665
c timelike momentum.
 
1666
c
 
1667
c input:
 
1668
c       real    p(0:3)         : four-momentum p in the q rest  frame
 
1669
c       real    q(0:3)         : four-momentum q in the boosted frame
 
1670
c       real    m        : mass of q (for numerical stability)
 
1671
c
 
1672
c output:
 
1673
c       real    pboost(0:3)    : four-momentum p in the boosted frame
 
1674
c
 
1675
      implicit none
 
1676
      double precision p(0:3),q(0:3),pboost(0:3),pq,qq,m,lf
 
1677
 
 
1678
      double precision rZero
 
1679
      parameter( rZero = 0.0d0 )
 
1680
 
 
1681
c#ifdef HELAS_CHECK
 
1682
c      integer stdo
 
1683
c      parameter( stdo = 6 )
 
1684
c      double precision pp
 
1685
c#endif
 
1686
c
 
1687
      qq = q(1)**2+q(2)**2+q(3)**2
 
1688
 
 
1689
c#ifdef HELAS_CHECK
 
1690
c      if (abs(p(0))+abs(p(1))+abs(p(2))+abs(p(3)).eq.rZero) then
 
1691
c         write(stdo,*)
 
1692
c     &        ' helas-error : p(0:3) in boostx is zero momentum'
 
1693
c      endif
 
1694
c      if (abs(q(0))+qq.eq.rZero) then
 
1695
c         write(stdo,*)
 
1696
c     &        ' helas-error : q(0:3) in boostx is zero momentum'
 
1697
c      endif
 
1698
c      if (p(0).le.rZero) then
 
1699
c         write(stdo,*)
 
1700
c     &        ' helas-warn  : p(0:3) in boostx has not positive energy'
 
1701
c         write(stdo,*)
 
1702
c     &        '             : p(0) = ',p(0)
 
1703
c      endif
 
1704
c      if (q(0).le.rZero) then
 
1705
c         write(stdo,*)
 
1706
c     &        ' helas-error : q(0:3) in boostx has not positive energy'
 
1707
c         write(stdo,*)
 
1708
c     &        '             : q(0) = ',q(0)
 
1709
c      endif
 
1710
c      pp=p(0)**2-p(1)**2-p(2)**2-p(3)**2
 
1711
c      if (pp.lt.rZero) then
 
1712
c         write(stdo,*)
 
1713
c     &        ' helas-warn  : p(0:3) in boostx is spacelike'
 
1714
c         write(stdo,*)
 
1715
c     &        '             : p**2 = ',pp
 
1716
c      endif
 
1717
c      if (q(0)**2-qq.le.rZero) then
 
1718
c         write(stdo,*)
 
1719
c     &        ' helas-error : q(0:3) in boostx is not timelike'
 
1720
c         write(stdo,*)
 
1721
c     &        '             : q**2 = ',q(0)**2-qq
 
1722
c      endif
 
1723
c      if (qq.eq.rZero) then
 
1724
c         write(stdo,*)
 
1725
c     &   ' helas-warn  : q(0:3) in boostx has zero spacial components'
 
1726
c      endif
 
1727
c#endif
 
1728
 
 
1729
      if ( qq.ne.rZero ) then
 
1730
         pq = p(1)*q(1)+p(2)*q(2)+p(3)*q(3)
 
1731
         lf = ((q(0)-m)*pq/qq+p(0))/m
 
1732
         pboost(0) = (p(0)*q(0)+pq)/m
 
1733
         pboost(1) =  p(1)+q(1)*lf
 
1734
         pboost(2) =  p(2)+q(2)*lf
 
1735
         pboost(3) =  p(3)+q(3)*lf
 
1736
      else
 
1737
         pboost(0) = p(0)
 
1738
         pboost(1) = p(1)
 
1739
         pboost(2) = p(2)
 
1740
         pboost(3) = p(3)
 
1741
      endif
 
1742
c
 
1743
      return
 
1744
      end
 
1745
 
 
1746
      subroutine momntx(energy,mass,costh,phi , p)
 
1747
c
 
1748
c This subroutine sets up a four-momentum from the four inputs.
 
1749
c
 
1750
c input:
 
1751
c       real    energy         : energy
 
1752
c       real    mass           : mass
 
1753
c       real    costh          : cos(theta)
 
1754
c       real    phi            : azimuthal angle
 
1755
c
 
1756
c output:
 
1757
c       real    p(0:3)         : four-momentum
 
1758
c
 
1759
      implicit none
 
1760
      double precision p(0:3),energy,mass,costh,phi,pp,sinth
 
1761
 
 
1762
      double precision rZero, rOne
 
1763
      parameter( rZero = 0.0d0, rOne = 1.0d0 )
 
1764
 
 
1765
c#ifdef HELAS_CHECK
 
1766
c      double precision rPi, rTwo
 
1767
c      parameter( rPi = 3.14159265358979323846d0, rTwo = 2.d0 )
 
1768
c      integer stdo
 
1769
c      parameter( stdo = 6 )
 
1770
c#endif
 
1771
c
 
1772
c#ifdef HELAS_CHECK
 
1773
c      if (energy.lt.mass) then
 
1774
c         write(stdo,*)
 
1775
c     &        ' helas-error : energy in momntx is less than mass'
 
1776
c         write(stdo,*)
 
1777
c     &        '             : energy = ',energy,' : mass = ',mass
 
1778
c      endif
 
1779
c      if (mass.lt.rZero) then
 
1780
c         write(stdo,*) ' helas-error : mass in momntx is negative'
 
1781
c         write(stdo,*) '             : mass = ',mass
 
1782
c      endif
 
1783
c      if (abs(costh).gt.rOne) then
 
1784
c         write(stdo,*) ' helas-error : costh in momntx is improper'
 
1785
c         write(stdo,*) '             : costh = ',costh
 
1786
c      endif
 
1787
c      if (phi.lt.rZero .or. phi.gt.rTwo*rPi) then
 
1788
c         write(stdo,*)
 
1789
c     &   ' helas-warn  : phi in momntx does not lie on 0.0 thru 2.0*pi'
 
1790
c         write(stdo,*)
 
1791
c     &   '             : phi = ',phi
 
1792
c      endif
 
1793
c#endif
 
1794
 
 
1795
      p(0) = energy
 
1796
 
 
1797
      if ( energy.eq.mass ) then
 
1798
 
 
1799
         p(1) = rZero
 
1800
         p(2) = rZero
 
1801
         p(3) = rZero
 
1802
 
 
1803
      else
 
1804
 
 
1805
         pp = sqrt((energy-mass)*(energy+mass))
 
1806
         sinth = sqrt((rOne-costh)*(rOne+costh))
 
1807
         p(3) = pp*costh
 
1808
         if ( phi.eq.rZero ) then
 
1809
            p(1) = pp*sinth
 
1810
            p(2) = rZero
 
1811
         else
 
1812
            p(1) = pp*sinth*cos(phi)
 
1813
            p(2) = pp*sinth*sin(phi)
 
1814
         endif
 
1815
 
 
1816
      endif
 
1817
c
 
1818
      return
 
1819
      end
 
1820
      subroutine rotxxx(p,q , prot)
 
1821
c
 
1822
c This subroutine performs the spacial rotation of a four-momentum.
 
1823
c the momentum p is assumed to be given in the frame where the spacial
 
1824
c component of q points the positive z-axis.  prot is the momentum p
 
1825
c rotated to the frame where q is given.
 
1826
c
 
1827
c input:
 
1828
c       real    p(0:3)         : four-momentum p in q(1)=q(2)=0 frame
 
1829
c       real    q(0:3)         : four-momentum q in the rotated frame
 
1830
c
 
1831
c output:
 
1832
c       real    prot(0:3)      : four-momentum p in the rotated frame
 
1833
c
 
1834
      implicit none
 
1835
      double precision p(0:3),q(0:3),prot(0:3),qt2,qt,psgn,qq,p1
 
1836
 
 
1837
      double precision rZero, rOne
 
1838
      parameter( rZero = 0.0d0, rOne = 1.0d0 )
 
1839
 
 
1840
c#ifdef HELAS_CHECK
 
1841
c      integer stdo
 
1842
c      parameter( stdo = 6 )
 
1843
c#endif
 
1844
c
 
1845
      prot(0) = p(0)
 
1846
 
 
1847
      qt2 = q(1)**2 + q(2)**2
 
1848
 
 
1849
c#ifdef HELAS_CHECK
 
1850
c      if (abs(p(0))+abs(p(1))+abs(p(2))+abs(p(3)).eq.rZero) then
 
1851
c         write(stdo,*)
 
1852
c     &        ' helas-error : p(0:3) in rotxxx is zero momentum'
 
1853
c      endif
 
1854
c      if (abs(q(0))+abs(q(3))+qt2.eq.rZero) then
 
1855
c         write(stdo,*)
 
1856
c     &        ' helas-error : q(0:3) in rotxxx is zero momentum'
 
1857
c      endif
 
1858
c      if (qt2+abs(q(3)).eq.rZero) then
 
1859
c         write(stdo,*)
 
1860
c     &   ' helas-warn  : q(0:3) in rotxxx has zero spacial momentum'
 
1861
c      endif
 
1862
c#endif
 
1863
 
 
1864
      if ( qt2.eq.rZero ) then
 
1865
          if ( q(3).eq.rZero ) then
 
1866
             prot(1) = p(1)
 
1867
             prot(2) = p(2)
 
1868
             prot(3) = p(3)
 
1869
          else
 
1870
             psgn = dsign(rOne,q(3))
 
1871
             prot(1) = p(1)*psgn
 
1872
             prot(2) = p(2)*psgn
 
1873
             prot(3) = p(3)*psgn
 
1874
          endif
 
1875
      else
 
1876
          qq = sqrt(qt2+q(3)**2)
 
1877
          qt = sqrt(qt2)
 
1878
          p1 = p(1)
 
1879
          prot(1) = q(1)*q(3)/qq/qt*p1 -q(2)/qt*p(2) +q(1)/qq*p(3)
 
1880
          prot(2) = q(2)*q(3)/qq/qt*p1 +q(1)/qt*p(2) +q(2)/qq*p(3)
 
1881
          prot(3) =          -qt/qq*p1               +q(3)/qq*p(3)
 
1882
      endif
 
1883
c
 
1884
      return
 
1885
      end
 
1886
 
 
1887
      subroutine mom2cx(esum,mass1,mass2,costh1,phi1 , p1,p2)
 
1888
c
 
1889
c This subroutine sets up two four-momenta in the two particle rest
 
1890
c frame.
 
1891
c
 
1892
c input:
 
1893
c       real    esum           : energy sum of particle 1 and 2
 
1894
c       real    mass1          : mass            of particle 1
 
1895
c       real    mass2          : mass            of particle 2
 
1896
c       real    costh1         : cos(theta)      of particle 1
 
1897
c       real    phi1           : azimuthal angle of particle 1
 
1898
c
 
1899
c output:
 
1900
c       real    p1(0:3)        : four-momentum of particle 1
 
1901
c       real    p2(0:3)        : four-momentum of particle 2
 
1902
c     
 
1903
      implicit none
 
1904
      double precision p1(0:3),p2(0:3),
 
1905
     &     esum,mass1,mass2,costh1,phi1,md2,ed,pp,sinth1
 
1906
 
 
1907
      double precision rZero, rHalf, rOne, rTwo
 
1908
      parameter( rZero = 0.0d0, rHalf = 0.5d0 )
 
1909
      parameter( rOne = 1.0d0, rTwo = 2.0d0 )
 
1910
 
 
1911
c#ifdef HELAS_CHECK
 
1912
c      double precision rPi
 
1913
c      parameter( rPi = 3.14159265358979323846d0 )
 
1914
c      integer stdo
 
1915
c      parameter( stdo = 6 )
 
1916
c#endif
 
1917
cc
 
1918
c#ifdef HELAS_CHECK
 
1919
c      if (esum.lt.mass1+mass2) then
 
1920
c         write(stdo,*)
 
1921
c     &        ' helas-error : esum in mom2cx is less than mass1+mass2'
 
1922
c         write(stdo,*)
 
1923
c     &        '             : esum = ',esum,
 
1924
c     &        ' : mass1+mass2 = ',mass1,mass2
 
1925
c      endif
 
1926
c      if (mass1.lt.rZero) then
 
1927
c         write(stdo,*) ' helas-error : mass1 in mom2cx is negative'
 
1928
c         write(stdo,*) '             : mass1 = ',mass1
 
1929
c      endif
 
1930
c      if (mass2.lt.rZero) then
 
1931
c         write(stdo,*) ' helas-error : mass2 in mom2cx is negative'
 
1932
c         write(stdo,*) '             : mass2 = ',mass2
 
1933
c      endif
 
1934
c      if (abs(costh1).gt.1.) then
 
1935
c         write(stdo,*) ' helas-error : costh1 in mom2cx is improper'
 
1936
c         write(stdo,*) '             : costh1 = ',costh1
 
1937
c      endif
 
1938
c      if (phi1.lt.rZero .or. phi1.gt.rTwo*rPi) then
 
1939
c         write(stdo,*)
 
1940
c     &   ' helas-warn  : phi1 in mom2cx does not lie on 0.0 thru 2.0*pi'
 
1941
c         write(stdo,*) 
 
1942
c     &   '             : phi1 = ',phi1
 
1943
c      endif
 
1944
c#endif
 
1945
 
 
1946
      md2 = (mass1-mass2)*(mass1+mass2)
 
1947
      ed = md2/esum
 
1948
      if ( mass1*mass2.eq.rZero ) then
 
1949
         pp = (esum-abs(ed))*rHalf
 
1950
      else
 
1951
         pp = sqrt((md2/esum)**2-rTwo*(mass1**2+mass2**2)+esum**2)*rHalf
 
1952
      endif
 
1953
      sinth1 = sqrt((rOne-costh1)*(rOne+costh1))
 
1954
 
 
1955
      p1(0) = max((esum+ed)*rHalf,rZero)
 
1956
      p1(1) = pp*sinth1*cos(phi1)
 
1957
      p1(2) = pp*sinth1*sin(phi1)
 
1958
      p1(3) = pp*costh1
 
1959
 
 
1960
      p2(0) = max((esum-ed)*rHalf,rZero)
 
1961
      p2(1) = -p1(1)
 
1962
      p2(2) = -p1(2)
 
1963
      p2(3) = -p1(3)
 
1964
c
 
1965
      return
 
1966
      end
 
1967
 
 
1968
C###############################################################################
 
1969
C LOOP related universal subroutines
 
1970
C###############################################################################
 
1971
 
 
1972
C===============================================================================
 
1973
C Subroutines to create the external wavefunctions of the L-cut particles 
 
1974
C===============================================================================
 
1975
 
 
1976
      SUBROUTINE LCUT_F(Q,CFIG,W)
 
1977
 
 
1978
      COMPLEX*16 Q(0:3)
 
1979
      INTEGER CFIG
 
1980
      COMPLEX*16 W(20)
 
1981
      
 
1982
      CALL LCUT_V(Q,CFIG,W)
 
1983
      END
 
1984
 
 
1985
      SUBROUTINE LCUT_AF(Q,CFIG,W)
 
1986
 
 
1987
      COMPLEX*16 Q(0:3)
 
1988
      INTEGER CFIG
 
1989
      COMPLEX*16 W(20)
 
1990
      
 
1991
      CALL LCUT_V(Q,CFIG,W)
 
1992
      END
 
1993
 
 
1994
      SUBROUTINE LCUT_V(Q,CFIG,W)
 
1995
 
 
1996
      COMPLEX*16 Q(0:3)
 
1997
      INTEGER CFIG
 
1998
      COMPLEX*16 W(20)
 
1999
      
 
2000
      W(5)=(0.d0,0.d0)
 
2001
      W(6)=(0.d0,0.d0)
 
2002
      W(7)=(0.d0,0.d0)
 
2003
      W(8)=(0.d0,0.d0)
 
2004
      W(CFIG+4)=(1.d0,0.d0)
 
2005
      
 
2006
      W(1)=Q(0)
 
2007
      W(2)=Q(1)
 
2008
      W(3)=Q(2)
 
2009
      W(4)=Q(3)
 
2010
 
 
2011
      END
 
2012
 
 
2013
      SUBROUTINE LCUT_S(Q,CFIG,W)
 
2014
 
 
2015
      COMPLEX*16 Q(0:3)
 
2016
      INTEGER CFIG
 
2017
      COMPLEX*16 W(20)
 
2018
 
 
2019
      W(5)=(1.D0,0.D0)
 
2020
 
 
2021
      W(1)=Q(0)
 
2022
      W(2)=Q(1)
 
2023
      W(3)=Q(2)
 
2024
      W(4)=Q(3)
 
2025
 
 
2026
      END
 
2027
 
 
2028
      SUBROUTINE LCUT_AS(Q,CFIG,W)
 
2029
 
 
2030
      COMPLEX*16 Q(0:3)
 
2031
      INTEGER CFIG
 
2032
      COMPLEX*16 W(20)
 
2033
 
 
2034
      W(5)=(1.D0,0.D0)
 
2035
 
 
2036
      W(1)=Q(0)
 
2037
      W(2)=Q(1)
 
2038
      W(3)=Q(2)
 
2039
      W(4)=Q(3)
 
2040
 
 
2041
      END
 
2042
 
 
2043
      SUBROUTINE MP_LCUT_F(Q,CFIG,W)
 
2044
 
 
2045
      COMPLEX*32 Q(0:3)
 
2046
      INTEGER CFIG
 
2047
      COMPLEX*32 W(20)
 
2048
      
 
2049
      CALL MP_LCUT_V(Q,CFIG,W)
 
2050
      END
 
2051
 
 
2052
      SUBROUTINE MP_LCUT_AF(Q,CFIG,W)
 
2053
 
 
2054
      COMPLEX*32 Q(0:3)
 
2055
      INTEGER CFIG
 
2056
      COMPLEX*32 W(20)
 
2057
      
 
2058
      CALL MP_LCUT_V(Q,CFIG,W)
 
2059
      END
 
2060
 
 
2061
      SUBROUTINE MP_LCUT_V(Q,CFIG,W)
 
2062
 
 
2063
      COMPLEX*32 Q(0:3)
 
2064
      INTEGER CFIG
 
2065
      COMPLEX*32 W(20)
 
2066
      COMPLEX*32 IONE, IZERO
 
2067
      PARAMETER (IONE=(1.0e0_16,0.0e0_16))
 
2068
      PARAMETER (IZERO=(0.0e0_16,0.0e0_16))      
 
2069
      
 
2070
      W(5)=IZERO
 
2071
      W(6)=IZERO
 
2072
      W(7)=IZERO
 
2073
      W(8)=IZERO
 
2074
      W(CFIG+4)=IONE
 
2075
 
 
2076
      W(1)=Q(0)
 
2077
      W(2)=Q(1)
 
2078
      W(3)=Q(2)
 
2079
      W(4)=Q(3)
 
2080
 
 
2081
      END
 
2082
 
 
2083
      SUBROUTINE MP_LCUT_AS(Q,CFIG,W)
 
2084
 
 
2085
      COMPLEX*32 Q(0:3)
 
2086
      INTEGER CFIG
 
2087
      COMPLEX*32 W(20)
 
2088
      COMPLEX*32 IONE
 
2089
      PARAMETER (IONE=(1.0e0_16,0.0e0_16))
 
2090
 
 
2091
      W(5)=IONE
 
2092
 
 
2093
      W(1)=Q(0)
 
2094
      W(2)=Q(1)
 
2095
      W(3)=Q(2)
 
2096
      W(4)=Q(3)
 
2097
 
 
2098
      END
 
2099
 
 
2100
      SUBROUTINE MP_LCUT_S(Q,CFIG,W)
 
2101
 
 
2102
      COMPLEX*32 Q(0:3)
 
2103
      INTEGER CFIG
 
2104
      COMPLEX*32 W(20)
 
2105
      COMPLEX*32 IONE
 
2106
      PARAMETER (IONE=(1.0e0_16,0.0e0_16))
 
2107
 
 
2108
      W(5)=IONE
 
2109
 
 
2110
      W(1)=Q(0)
 
2111
      W(2)=Q(1)
 
2112
      W(3)=Q(2)
 
2113
      W(4)=Q(3)
 
2114
 
 
2115
      END
 
2116
 
 
2117
C===============================================================================
 
2118
C Subroutines to close the lorentz traces of loops, 
 
2119
C===============================================================================
 
2120
 
 
2121
      SUBROUTINE CLOSE_4(AMPS,RES)
 
2122
      
 
2123
      COMPLEX*16 RES
 
2124
      COMPLEX*16 AMPS(4)
 
2125
 
 
2126
      RES=AMPS(1)+AMPS(2)+AMPS(3)+AMPS(4)
 
2127
 
 
2128
      END
 
2129
 
 
2130
      SUBROUTINE CLOSE_1(AMPS,RES)
 
2131
      
 
2132
      COMPLEX*16 RES
 
2133
      COMPLEX*16 AMPS
 
2134
 
 
2135
      RES=AMPS
 
2136
 
 
2137
      END
 
2138
 
 
2139
      SUBROUTINE MP_CLOSE_4(AMPS,RES)
 
2140
      
 
2141
      COMPLEX*32 RES
 
2142
      COMPLEX*32 AMPS(4)
 
2143
 
 
2144
      RES=AMPS(1)+AMPS(2)+AMPS(3)+AMPS(4)
 
2145
 
 
2146
      END
 
2147
 
 
2148
      SUBROUTINE MP_CLOSE_1(AMPS,RES)
 
2149
      
 
2150
      COMPLEX*32 RES
 
2151
      COMPLEX*32 AMPS
 
2152
 
 
2153
      RES=AMPS
 
2154
 
 
2155
      END
 
2156
 
 
2157
C===============================================================================
 
2158
C OLD Subroutines to close the lorentz traces of loops, 
 
2159
c                           OBSOLETE 
 
2160
C===============================================================================
 
2161
 
 
2162
      SUBROUTINE CLOSE_V(Q,M,AMPS,RES)
 
2163
      
 
2164
      COMPLEX*16 Q(0:3)
 
2165
      COMPLEX*16 RES
 
2166
      COMPLEX*16 AMPS(4)
 
2167
      COMPLEX*16 M
 
2168
 
 
2169
      IF (M.NE.(0.D0,0.0D0)) THEN
 
2170
        STOP 'Massive vector L-cut particle not supported'
 
2171
      ENDIF
 
2172
      RES=AMPS(1)-AMPS(2)-AMPS(3)-AMPS(4)
 
2173
 
 
2174
      END
 
2175
 
 
2176
c This subroutine is to recreate the fermion propagator with 4 helicities
 
2177
c only. This has problems with certain configuration of the imaginary
 
2178
c momentum q, so it is not implemented yet.
 
2179
 
 
2180
      SUBROUTINE CLOSE_F4HEL(Q,M,AMPS,RES)      
 
2181
      
 
2182
      COMPLEX*16 Q(0:3)
 
2183
      COMPLEX*16 RES, QNORM
 
2184
      REAL*8 M
 
2185
      COMPLEX*16 AMPS(4) 
 
2186
      COMPLEX*16 PMM, PPM
 
2187
 
 
2188
      PPM=AMPS(1)+AMPS(2)
 
2189
      PMM=AMPS(3)+AMPS(4)
 
2190
      write(*,*) 'PPM=',PPM
 
2191
      write(*,*) 'PMM=',PMM      
 
2192
      IF (M.NE.0.D0) THEN
 
2193
        QNORM=SQRT(Q(0)**2-Q(1)**2-Q(2)**2-Q(3)**2)
 
2194
        write(*,*) 'Q=',Q        
 
2195
        write(*,*) 'QNORM=',QNORM
 
2196
        write(*,*) 'M=',M
 
2197
        RES=(0.D0,0.5D0)*((PPM+PMM)+(PPM-PMM)*(M/QNORM))
 
2198
        write(*,*) 'RES1=',RES
 
2199
      ELSE
 
2200
        RES=(0.D0,0.5D0)*(PPM+PMM)
 
2201
        write(*,*) 'RES2=',RES
 
2202
      ENDIF
 
2203
 
 
2204
      END
 
2205
 
 
2206
      SUBROUTINE CLOSE_F(Q,M,AMPS,RES)      
 
2207
      
 
2208
      COMPLEX*16 Q(0:3)
 
2209
      COMPLEX*16 RES
 
2210
      COMPLEX*16 M
 
2211
      COMPLEX*16 AMPS(12) 
 
2212
 
 
2213
      RES=(0.D0,0.D0)
 
2214
      RES=(Q(0)-Q(3))*AMPS(1)+
 
2215
     &    (-Q(1)+(0.0d0,1.0d0)*Q(2))*AMPS(2)+
 
2216
     &    (-Q(1)-(0.0d0,1.0d0)*Q(2))*AMPS(3)+
 
2217
     &    (Q(0)+Q(3))*AMPS(4)+
 
2218
     &    (Q(0)+Q(3))*AMPS(5)+
 
2219
     &    (Q(1)-(0.0d0,1.0d0)*Q(2))*AMPS(6)+
 
2220
     &    (Q(1)+(0.0d0,1.0d0)*Q(2))*AMPS(7)+
 
2221
     &    (Q(0)-Q(3))*AMPS(8)
 
2222
      IF (M.NE.(0.D0,0.D0)) THEN
 
2223
        RES=RES-M*(AMPS(9)+AMPS(10)+AMPS(11)+AMPS(12))
 
2224
      ENDIF
 
2225
 
 
2226
      END
 
2227
 
 
2228
      SUBROUTINE CLOSE_S(Q,AMP,RES)
 
2229
 
 
2230
      COMPLEX*16 Q(0:3)
 
2231
      COMPLEX*16 RES
 
2232
      COMPLEX*16 AMP
 
2233
 
 
2234
      RES=(1.D0,0.D0)*AMP
 
2235
      
 
2236
      END
 
2237
 
 
2238
c     // QUAD PREC VERSIONS OF THE ABOVE //
 
2239
 
 
2240
      SUBROUTINE MP_CLOSE_V(Q,M,AMPS,RES)
 
2241
      
 
2242
      COMPLEX*32 Q(0:3)
 
2243
      COMPLEX*32 RES
 
2244
      COMPLEX*32 AMPS(4)
 
2245
      COMPLEX*32 M
 
2246
 
 
2247
      IF (M.NE.(0.0e0_16,0.0e0_16)) THEN
 
2248
        STOP 'Massive vector L-cut particle not supported'
 
2249
      ENDIF
 
2250
      RES=AMPS(1)-AMPS(2)-AMPS(3)-AMPS(4)
 
2251
 
 
2252
      END
 
2253
 
 
2254
      SUBROUTINE MP_CLOSE_F(Q,M,AMPS,RES)      
 
2255
      
 
2256
      COMPLEX*32 Q(0:3)
 
2257
      COMPLEX*32 RES
 
2258
      COMPLEX*32 M
 
2259
      COMPLEX*32 AMPS(12) 
 
2260
 
 
2261
      RES=(0.0e0_16,0.0e0_16)
 
2262
      RES=(Q(0)-Q(3))*AMPS(1)+
 
2263
     &    (-Q(1)+(0.0e0_16,1.0e0_16)*Q(2))*AMPS(2)+
 
2264
     &    (-Q(1)-(0.0e0_16,1.0e0_16)*Q(2))*AMPS(3)+
 
2265
     &    (Q(0)+Q(3))*AMPS(4)+
 
2266
     &    (Q(0)+Q(3))*AMPS(5)+
 
2267
     &    (Q(1)-(0.0e0_16,1.0e0_16)*Q(2))*AMPS(6)+
 
2268
     &    (Q(1)+(0.0e0_16,1.0e0_16)*Q(2))*AMPS(7)+
 
2269
     &    (Q(0)-Q(3))*AMPS(8)
 
2270
      IF (M.NE.(0.0e0_16,0.0e0_16)) THEN
 
2271
        RES=RES-M*(AMPS(9)+AMPS(10)+AMPS(11)+AMPS(12))
 
2272
      ENDIF
 
2273
 
 
2274
      END
 
2275
 
 
2276
      SUBROUTINE MP_CLOSE_S(Q,AMP,RES)
 
2277
 
 
2278
      COMPLEX*32 Q(0:3)
 
2279
      COMPLEX*32 RES
 
2280
      COMPLEX*32 AMP
 
2281
 
 
2282
      RES=(1.0e0_16,0.0e0_16)*AMP
 
2283
      
 
2284
      END
 
2285
 
 
2286
C===============================================================================
 
2287
C OLD Subroutines to create the external wavefunctions of the L-cut particles 
 
2288
C                                 OBSOLETE
 
2289
C===============================================================================
 
2290
 
 
2291
c This subroutine is to recreate the fermion propagator with 4 helicities
 
2292
c only. This has problems with certain configuration of the imaginary
 
2293
c momentum q, so it is not implemented yet.
 
2294
 
 
2295
      SUBROUTINE LCUT_F4HEL(Q,M,CFIG,SCD,W)
 
2296
 
 
2297
      COMPLEX*16 Q(0:3)
 
2298
      INTEGER CFIG,J
 
2299
      LOGICAL SCD
 
2300
      COMPLEX*16 M
 
2301
      COMPLEX*16 W(20)
 
2302
 
 
2303
      IF (CFIG.EQ.1) THEN
 
2304
        IF (SCD) THEN
 
2305
C         UBAR, HEL=-1        
 
2306
          CALL ILXXXX(Q(0),M,-1,1,W(1))
 
2307
        ELSE
 
2308
C         U, HEL=-1
 
2309
          CALL ILXXXX(Q(0),M,-1,-1,W(1))
 
2310
          do J=1,4
 
2311
          write(*,*) 'Wcf(',j,',1)=',W(1)   
 
2312
          enddo
 
2313
        ENDIF
 
2314
      ELSEIF (CFIG.EQ.2) THEN
 
2315
        IF (SCD) THEN
 
2316
C         UBAR, HEL=1        
 
2317
          CALL ILXXXX(Q(0),M,1,1,W(1))
 
2318
        ELSE
 
2319
C         U, HEL=1        
 
2320
          CALL ILXXXX(Q(0),M,1,-1,W(1))
 
2321
        ENDIF
 
2322
      ELSEIF (CFIG.EQ.3) THEN
 
2323
        IF (SCD) THEN
 
2324
C         VBAR, HEL=-1,        
 
2325
          CALL OLXXXX(Q(0),M,-1,-1,W(1))
 
2326
        ELSE
 
2327
C         V, HEL=-1        
 
2328
          CALL OLXXXX(Q(0),M,-1,1,W(1))
 
2329
        ENDIF
 
2330
      ELSEIF (CFIG.EQ.4) THEN
 
2331
        IF (SCD) THEN
 
2332
C         VBAR, HEL=1        
 
2333
          CALL OLXXXX(Q(0),M,1,-1,W(1))
 
2334
        ELSE
 
2335
C         V, HEL=1    
 
2336
          CALL OLXXXX(Q(0),M,1,1,W(1))
 
2337
        ENDIF
 
2338
      ENDIF
 
2339
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT SPINORS      
 
2340
      IF (SCD) THEN
 
2341
        W(5)=-Q(0)
 
2342
        W(6)=-Q(1)
 
2343
        W(7)=-Q(2)
 
2344
        W(8)=-Q(3)
 
2345
      ENDIF
 
2346
 
 
2347
      END
 
2348
 
 
2349
      SUBROUTINE OLD_LCUT_F(Q,M,CFIG,SCD,W)
 
2350
 
 
2351
      COMPLEX*16 Q(0:3)
 
2352
      INTEGER CFIG
 
2353
      LOGICAL SCD
 
2354
      COMPLEX*16 M
 
2355
      COMPLEX*16 W(20)
 
2356
 
 
2357
      W(1)=(0.d0,0.d0)
 
2358
      W(2)=(0.d0,0.d0)
 
2359
      W(3)=(0.d0,0.d0)
 
2360
      W(4)=(0.d0,0.d0)
 
2361
 
 
2362
      IF (CFIG.eq.1) then
 
2363
        IF (SCD) then
 
2364
          W(3)=(1.d0,0.d0)
 
2365
        ELSE
 
2366
          W(1)=(1.d0,0.d0)
 
2367
        ENDIF
 
2368
      ELSEIF (CFIG.eq.2) then
 
2369
        IF (SCD) then
 
2370
          W(4)=(1.d0,0.d0)
 
2371
        ELSE
 
2372
          W(1)=(1.d0,0.d0)
 
2373
        ENDIF
 
2374
      ELSEIF (CFIG.eq.3) then
 
2375
        IF (SCD) then
 
2376
          W(3)=(1.d0,0.d0)
 
2377
        ELSE
 
2378
          W(2)=(1.d0,0.d0)
 
2379
        ENDIF  
 
2380
      ELSEIF (CFIG.eq.4) then
 
2381
        IF (SCD) then
 
2382
          W(4)=(1.d0,0.d0)
 
2383
        ELSE
 
2384
          W(2)=(1.d0,0.d0)
 
2385
        ENDIF
 
2386
      ELSEIF (CFIG.eq.5) then
 
2387
        IF (SCD) then
 
2388
          W(1)=(1.d0,0.d0)
 
2389
        ELSE
 
2390
          W(3)=(1.d0,0.d0)
 
2391
        ENDIF
 
2392
      ELSEIF (CFIG.eq.6) then
 
2393
        IF (SCD) then
 
2394
          W(2)=(1.d0,0.d0)
 
2395
        ELSE
 
2396
          W(3)=(1.d0,0.d0)
 
2397
        ENDIF
 
2398
      ELSEIF (CFIG.eq.7) then
 
2399
        IF (SCD) then
 
2400
          W(1)=(1.d0,0.d0)
 
2401
        ELSE
 
2402
          W(4)=(1.d0,0.d0)
 
2403
        ENDIF
 
2404
      ELSEIF (CFIG.eq.8) then
 
2405
        IF (SCD) then
 
2406
          W(2)=(1.d0,0.d0)
 
2407
        ELSE
 
2408
          W(4)=(1.d0,0.d0)
 
2409
        ENDIF
 
2410
      ELSEIF (CFIG.eq.9) then
 
2411
        IF (SCD) then
 
2412
          W(1)=(1.d0,0.d0)
 
2413
        ELSE
 
2414
          W(1)=(1.d0,0.d0)
 
2415
        ENDIF
 
2416
      ELSEIF (CFIG.eq.10) then
 
2417
        IF (SCD) then
 
2418
          W(2)=(1.d0,0.d0)
 
2419
        ELSE
 
2420
          W(2)=(1.d0,0.d0)
 
2421
        ENDIF
 
2422
      ELSEIF (CFIG.eq.11) then
 
2423
        IF (SCD) then
 
2424
          W(3)=(1.d0,0.d0)
 
2425
        ELSE
 
2426
          W(3)=(1.d0,0.d0)
 
2427
        ENDIF
 
2428
      ELSEIF (CFIG.eq.12) then
 
2429
        IF (SCD) then
 
2430
          W(4)=(1.d0,0.d0)
 
2431
        ELSE
 
2432
          W(4)=(1.d0,0.d0)
 
2433
        ENDIF
 
2434
      ENDIF
 
2435
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT SPINORS      
 
2436
      IF (SCD) THEN
 
2437
        W(5)=-Q(0)
 
2438
        W(6)=-Q(1)
 
2439
        W(7)=-Q(2)
 
2440
        W(8)=-Q(3)
 
2441
      ELSE
 
2442
        W(5)=Q(0)
 
2443
        W(6)=Q(1)
 
2444
        W(7)=Q(2)
 
2445
        W(8)=Q(3)
 
2446
      ENDIF
 
2447
 
 
2448
      END
 
2449
 
 
2450
      SUBROUTINE OLD_MP_LCUT_F(Q,M,CFIG,SCD,W)
 
2451
 
 
2452
      COMPLEX*32 Q(0:3)
 
2453
      INTEGER CFIG
 
2454
      LOGICAL SCD
 
2455
      COMPLEX*32 M
 
2456
      COMPLEX*32 W(20)
 
2457
      COMPLEX*32 IZERO
 
2458
      PARAMETER (IZERO=(0.0e0_16,0.0e0_16))
 
2459
      COMPLEX*32 IONE
 
2460
      PARAMETER (IONE=(1.0e0_16,0.0e0_16))
 
2461
 
 
2462
      W(1)=IZERO
 
2463
      W(2)=IZERO
 
2464
      W(3)=IZERO
 
2465
      W(4)=IZERO
 
2466
 
 
2467
      IF (CFIG.eq.1) then
 
2468
        IF (SCD) then
 
2469
          W(3)=IONE
 
2470
        ELSE
 
2471
          W(1)=IONE
 
2472
        ENDIF
 
2473
      ELSEIF (CFIG.eq.2) then
 
2474
        IF (SCD) then
 
2475
          W(4)=IONE
 
2476
        ELSE
 
2477
          W(1)=IONE
 
2478
        ENDIF
 
2479
      ELSEIF (CFIG.eq.3) then
 
2480
        IF (SCD) then
 
2481
          W(3)=IONE
 
2482
        ELSE
 
2483
          W(2)=IONE
 
2484
        ENDIF  
 
2485
      ELSEIF (CFIG.eq.4) then
 
2486
        IF (SCD) then
 
2487
          W(4)=IONE
 
2488
        ELSE
 
2489
          W(2)=IONE
 
2490
        ENDIF
 
2491
      ELSEIF (CFIG.eq.5) then
 
2492
        IF (SCD) then
 
2493
          W(1)=IONE
 
2494
        ELSE
 
2495
          W(3)=IONE
 
2496
        ENDIF
 
2497
      ELSEIF (CFIG.eq.6) then
 
2498
        IF (SCD) then
 
2499
          W(2)=IONE
 
2500
        ELSE
 
2501
          W(3)=IONE
 
2502
        ENDIF
 
2503
      ELSEIF (CFIG.eq.7) then
 
2504
        IF (SCD) then
 
2505
          W(1)=IONE
 
2506
        ELSE
 
2507
          W(4)=IONE
 
2508
        ENDIF
 
2509
      ELSEIF (CFIG.eq.8) then
 
2510
        IF (SCD) then
 
2511
          W(2)=IONE
 
2512
        ELSE
 
2513
          W(4)=IONE
 
2514
        ENDIF
 
2515
      ELSEIF (CFIG.eq.9) then
 
2516
        IF (SCD) then
 
2517
          W(1)=IONE
 
2518
        ELSE
 
2519
          W(1)=IONE
 
2520
        ENDIF
 
2521
      ELSEIF (CFIG.eq.10) then
 
2522
        IF (SCD) then
 
2523
          W(2)=IONE
 
2524
        ELSE
 
2525
          W(2)=IONE
 
2526
        ENDIF
 
2527
      ELSEIF (CFIG.eq.11) then
 
2528
        IF (SCD) then
 
2529
          W(3)=IONE
 
2530
        ELSE
 
2531
          W(3)=IONE
 
2532
        ENDIF
 
2533
      ELSEIF (CFIG.eq.12) then
 
2534
        IF (SCD) then
 
2535
          W(4)=IONE
 
2536
        ELSE
 
2537
          W(4)=IONE
 
2538
        ENDIF
 
2539
      ENDIF
 
2540
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT SPINORS      
 
2541
      IF (SCD) THEN
 
2542
        W(5)=-Q(0)
 
2543
        W(6)=-Q(1)
 
2544
        W(7)=-Q(2)
 
2545
        W(8)=-Q(3)
 
2546
      ELSE
 
2547
        W(5)=Q(0)
 
2548
        W(6)=Q(1)
 
2549
        W(7)=Q(2)
 
2550
        W(8)=Q(3)
 
2551
      ENDIF
 
2552
 
 
2553
      END
 
2554
 
 
2555
      SUBROUTINE OLD_LCUT_CF(Q,M,CFIG,SCD,W)
 
2556
 
 
2557
      COMPLEX*16 Q(0:3)
 
2558
      INTEGER CFIG
 
2559
      LOGICAL SCD
 
2560
      COMPLEX*16 M
 
2561
      COMPLEX*16 W(20)
 
2562
 
 
2563
      IF (CFIG.EQ.1) THEN
 
2564
        IF (SCD) THEN
 
2565
C         UBAR, HEL=-1        
 
2566
          CALL ICLXXX(Q(0),M,-1,1,W(1))
 
2567
        ELSE
 
2568
C         U, HEL=-1        
 
2569
          CALL ICLXXX(Q(0),M,-1,-1,W(1))
 
2570
        ENDIF
 
2571
      ELSEIF (CFIG.EQ.2) THEN
 
2572
        IF (SCD) THEN
 
2573
C         UBAR, HEL=1        
 
2574
          CALL ICLXXX(Q(0),M,1,1,W(1))
 
2575
        ELSE
 
2576
C         U, HEL=1        
 
2577
          CALL ICLXXX(Q(0),M,1,-1,W(1))
 
2578
        ENDIF
 
2579
      ELSEIF (CFIG.EQ.3) THEN
 
2580
        IF (SCD) THEN
 
2581
C         VBAR, HEL=-1,        
 
2582
          CALL OCLXXX(Q(0),M,-1,-1,W(1))
 
2583
        ELSE
 
2584
C         V, HEL=-1        
 
2585
          CALL OCLXXX(Q(0),M,-1,1,W(1))
 
2586
        ENDIF
 
2587
      ELSEIF (CFIG.EQ.4) THEN
 
2588
        IF (SCD) THEN
 
2589
C         VBAR, HEL=1        
 
2590
          CALL OCLXXX(Q(0),M,1,-1,W(1))
 
2591
        ELSE
 
2592
C         V, HEL=1    
 
2593
          CALL OCLXXX(Q(0),M,1,1,W(1))
 
2594
        ENDIF
 
2595
      ENDIF
 
2596
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT SPINORS      
 
2597
      IF (SCD) THEN
 
2598
        W(5)=-Q(0)
 
2599
        W(6)=-Q(1)
 
2600
        W(7)=-Q(2)
 
2601
        W(8)=-Q(3)
 
2602
      ENDIF
 
2603
 
 
2604
      END
 
2605
 
 
2606
      SUBROUTINE OLD_LCUT_V(Q,M,CFIG,SCD,W)
 
2607
 
 
2608
      COMPLEX*16 Q(0:3)
 
2609
      INTEGER CFIG
 
2610
      LOGICAL SCD      
 
2611
      COMPLEX*16 M
 
2612
      COMPLEX*16 W(20)
 
2613
 
 
2614
      IF (M.NE.0.D0) THEN
 
2615
        STOP 'Massive vector L-cut particle not supported'
 
2616
      ENDIF
 
2617
      W(1)=(0.d0,0.d0)
 
2618
      W(2)=(0.d0,0.d0)
 
2619
      W(3)=(0.d0,0.d0)
 
2620
      W(4)=(0.d0,0.d0)
 
2621
      IF (CFIG.EQ.1) THEN
 
2622
        W(1)=(1.d0,0.d0)
 
2623
      ELSEIF (CFIG.EQ.2) THEN
 
2624
        W(2)=(1.d0,0.d0)
 
2625
      ELSEIF (CFIG.EQ.3) THEN
 
2626
        W(3)=(1.d0,0.d0)
 
2627
      ELSEIF (CFIG.EQ.4) THEN
 
2628
        W(4)=(1.d0,0.d0)
 
2629
      ENDIF
 
2630
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT VECTORS      
 
2631
      IF (SCD) THEN
 
2632
        W(5)=-Q(0)
 
2633
        W(6)=-Q(1)
 
2634
        W(7)=-Q(2)
 
2635
        W(8)=-Q(3)
 
2636
      ELSE
 
2637
        W(5)=Q(0)
 
2638
        W(6)=Q(1)
 
2639
        W(7)=Q(2)
 
2640
        W(8)=Q(3)
 
2641
      ENDIF
 
2642
 
 
2643
      END
 
2644
 
 
2645
      SUBROUTINE OLD_MP_LCUT_V(Q,M,CFIG,SCD,W)
 
2646
 
 
2647
      COMPLEX*32 Q(0:3)
 
2648
      INTEGER CFIG
 
2649
      LOGICAL SCD      
 
2650
      COMPLEX*32 M
 
2651
      COMPLEX*32 W(20)
 
2652
      COMPLEX*32 IZERO
 
2653
      PARAMETER (IZERO=(0.0e0_16,0.0e0_16))
 
2654
      COMPLEX*32 IONE
 
2655
      PARAMETER (IONE=(1.0e0_16,0.0e0_16))
 
2656
 
 
2657
 
 
2658
      IF (M.NE.IZERO) THEN
 
2659
        STOP 'Massive vector L-cut particle not supported'
 
2660
      ENDIF
 
2661
      W(1)=IZERO
 
2662
      W(2)=IZERO
 
2663
      W(3)=IZERO
 
2664
      W(4)=IZERO
 
2665
      IF (CFIG.EQ.1) THEN
 
2666
        W(1)=IONE
 
2667
      ELSEIF (CFIG.EQ.2) THEN
 
2668
        W(2)=IONE
 
2669
      ELSEIF (CFIG.EQ.3) THEN
 
2670
        W(3)=IONE
 
2671
      ELSEIF (CFIG.EQ.4) THEN
 
2672
        W(4)=IONE
 
2673
      ENDIF
 
2674
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT VECTORS      
 
2675
      IF (SCD) THEN
 
2676
        W(5)=-Q(0)
 
2677
        W(6)=-Q(1)
 
2678
        W(7)=-Q(2)
 
2679
        W(8)=-Q(3)
 
2680
      ELSE
 
2681
        W(5)=Q(0)
 
2682
        W(6)=Q(1)
 
2683
        W(7)=Q(2)
 
2684
        W(8)=Q(3)
 
2685
      ENDIF
 
2686
 
 
2687
      END
 
2688
 
 
2689
      SUBROUTINE OLD_LCUT_S(Q,M,CFIG,SCD,W)
 
2690
 
 
2691
      COMPLEX*16 Q(0:3)
 
2692
      COMPLEX*16 M
 
2693
      INTEGER CFIG
 
2694
      LOGICAL SCD      
 
2695
      COMPLEX*16 W(20)
 
2696
 
 
2697
      W(1)=(1.D0,0.D0)
 
2698
 
 
2699
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND SCALAR      
 
2700
      IF (SCD) THEN
 
2701
        W(2)=-Q(0)
 
2702
        W(3)=-Q(1)
 
2703
        W(4)=-Q(2)
 
2704
        W(5)=-Q(3)
 
2705
      ELSE
 
2706
        W(2)=Q(0)
 
2707
        W(3)=Q(1)
 
2708
        W(4)=Q(2)
 
2709
        W(5)=Q(3)
 
2710
      ENDIF
 
2711
 
 
2712
      END
 
2713
 
 
2714
      SUBROUTINE OLD_MP_LCUT_S(Q,M,CFIG,SCD,W)
 
2715
 
 
2716
      COMPLEX*32 Q(0:3)
 
2717
      COMPLEX*32 M
 
2718
      INTEGER CFIG
 
2719
      LOGICAL SCD      
 
2720
      COMPLEX*32 W(20)
 
2721
      COMPLEX*32 IONE
 
2722
      PARAMETER (IONE=(1.0e0_16,0.0e0_16))
 
2723
 
 
2724
      W(1)=IONE
 
2725
 
 
2726
C     REVERSE THE MOMENTUM IN THE WF FOR THE SECOND SCALAR      
 
2727
      IF (SCD) THEN
 
2728
        W(2)=-Q(0)
 
2729
        W(3)=-Q(1)
 
2730
        W(4)=-Q(2)
 
2731
        W(5)=-Q(3)
 
2732
      ELSE
 
2733
        W(2)=Q(0)
 
2734
        W(3)=Q(1)
 
2735
        W(4)=Q(2)
 
2736
        W(5)=Q(3)
 
2737
      ENDIF
 
2738
 
 
2739
      END
 
2740
 
 
2741
C===============================================================================
 
2742
C Complex-momentum version of the subroutine to create on-shell
 
2743
C wavefunctions of particles with different spins. OBSOLETE
 
2744
C===============================================================================
 
2745
   
 
2746
C     The subroutine with charge conjugation are not yet implemented
 
2747
c     Obsolete by now too
 
2748
 
 
2749
      subroutine oclxxx(p,ffmass,nhel,nsf,fo)
 
2750
 
 
2751
      implicit none
 
2752
      double complex fo(8),p(0:3)
 
2753
      double precision ffmass
 
2754
      integer nhel,nsf
 
2755
 
 
2756
      CALL olxxxx(p,ffmass,nhel,nsf,fo)
 
2757
 
 
2758
      end
 
2759
 
 
2760
      subroutine iclxxx(p,ffmass,nhel,nsf,fi)
 
2761
 
 
2762
      implicit none
 
2763
      double complex fi(8),p(0:3)
 
2764
      double precision ffmass
 
2765
      integer nhel,nsf
 
2766
 
 
2767
      CALL ilxxxx(p,ffmass,nhel,nsf,fi)
 
2768
 
 
2769
      end
 
2770
 
 
2771
      subroutine ilxxxx(p,ffmass,nhel,nsf,fi)
 
2772
c
 
2773
c This subroutine computes a fermion wavefunction with the flowing-IN
 
2774
c fermion number and defined with complex ONSHELL momentium.
 
2775
c
 
2776
c input:
 
2777
c       complex    p(0:3)         : four-momentum of fermion
 
2778
c       real    fmass          : mass          of fermion
 
2779
c       integer nhel = -1 or 1 : helicity      of fermion
 
2780
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
2781
c
 
2782
c output:
 
2783
c       complex fi(8)          : fermion wavefunction               |fi>
 
2784
c       Note: There are 4 components for the spinor and four for the
 
2785
c             momentum. 
 
2786
      implicit none
 
2787
      double complex fi(8),chi(2), fmass
 
2788
c      double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
 
2789
c     &     pp,pp3,sqp0p3,sqm(0:1)
 
2790
      double complex sqm(0:1)
 
2791
      double precision sf(2),ffmass
 
2792
      double complex p(0:3), sfomeg(2),omega(2),
 
2793
     &     pp,pp3,sqp0p3 
 
2794
      integer nhel,nsf,ip,im,nh
 
2795
 
 
2796
      double precision rZero, rHalf, rTwo
 
2797
      parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
 
2798
      
 
2799
 
 
2800
      
 
2801
c      fi(5) = dcmplx(p(0),p(3))*nsf
 
2802
c      fi(6) = dcmplx(p(1),p(2))*nsf
 
2803
      fi(5) = p(0)*nsf
 
2804
      fi(6) = p(1)*nsf
 
2805
      fi(7) = p(2)*nsf
 
2806
      fi(8) = p(3)*nsf
 
2807
 
 
2808
      nh = nhel*nsf
 
2809
 
 
2810
      fmass = sqrt(p(0)**2-p(1)**2-p(2)**2-p(3)**2)
 
2811
 
 
2812
      if ( ffmass.ne.rZero ) then
 
2813
c special treatment for massless particles.
 
2814
c         pp = min(p(0),sqrt(p(1)**2+p(2)**2+p(3)**2))
 
2815
         pp=sqrt(p(1)**2+p(2)**2+p(3)**2)
 
2816
c for time-like four-momenta we can always think of it as the p_vec^2          
 
2817
         if ( abs(pp).eq.rZero ) then
 
2818
c particle at rest.            
 
2819
            sqm(0) = sqrt(fmass) ! possibility of negative fermion masses
 
2820
            sqm(1) = sqm(0) ! possibility of negative fermion masses
 
2821
            ip = (1+nh)/2
 
2822
            im = (1-nh)/2
 
2823
            
 
2824
            fi(1) = ip     * sqm(ip)
 
2825
            fi(2) = im*nsf * sqm(ip)
 
2826
            fi(3) = ip*nsf * sqm(im)
 
2827
            fi(4) = im     * sqm(im)
 
2828
 
 
2829
         else
 
2830
c standard spinor
 
2831
 
 
2832
            pp=sqrt(p(1)**2+p(2)**2+p(3)**2)
 
2833
            write(*,*) 'ppre=',pp            
 
2834
c            if( (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) .or.
 
2835
c     &          (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) ) then
 
2836
c            pp=-pp
 
2837
c            endif 
 
2838
            sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
 
2839
c fermion spin using HELAS conventions.            
 
2840
            sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
 
2841
            omega(1) = sqrt(p(0)+pp)
 
2842
c the omega of the definition.
 
2843
c            omega(2) = fmass/omega(1)
 
2844
            omega(2) = sqrt(p(0)-pp)
 
2845
c the prefactor
 
2846
            ip = (3+nh)/2
 
2847
            im = (3-nh)/2
 
2848
            sfomeg(1) = sf(1)*omega(ip)
 
2849
            sfomeg(2) = sf(2)*omega(im)
 
2850
c            pp3 = max(pp+p(3),rZero)
 
2851
            pp3=pp+p(3)
 
2852
            chi(1) = sqrt(pp3*rHalf/pp)
 
2853
            if ( abs(pp3).eq.rZero ) then
 
2854
               chi(2) = dcmplx(-nh )
 
2855
            else
 
2856
               chi(2) = ( (nh*p(1)) + ((0d0,1d0)*p(2)) )/
 
2857
     .sqrt(rTwo*pp*pp3)
 
2858
            endif
 
2859
            
 
2860
 
 
2861
c         Write(*,*) 'Chi=',Chi(1),' and ',Chi(2)
 
2862
 
 
2863
            fi(1) = sfomeg(1)*chi(im)
 
2864
            fi(2) = sfomeg(1)*chi(ip)
 
2865
c         Write(*,*) 'fi(2)=',fi(2)     
 
2866
            fi(3) = sfomeg(2)*chi(im)
 
2867
c         Write(*,*) 'fi(3)=',fi(3)
 
2868
            fi(4) = sfomeg(2)*chi(ip)
 
2869
            
 
2870
         endif
 
2871
         
 
2872
      else
 
2873
         
 
2874
c         if(zabs(p(1)).eq.0d0.and.zabs(p(2)).eq.0d0.and.
 
2875
c     .zabs(p(3)).lt.0d0) then
 
2876
c            sqp0p3 = 0d0
 
2877
c         else
 
2878
            sqp0p3 = sqrt(p(0)+p(3))*nsf
 
2879
c        end if
 
2880
         chi(1) = sqp0p3
 
2881
         if ( abs(sqp0p3).eq.rZero ) then
 
2882
            chi(2) = dcmplx(-nhel )*sqrt(rTwo*p(0))
 
2883
         else
 
2884
            chi(2) = ( nh*p(1) + ((0d0,1d0)*p(2) ) )/sqp0p3
 
2885
         endif
 
2886
         if ( nh.eq.1 ) then
 
2887
            fi(1) = dcmplx( rZero )
 
2888
            fi(2) = dcmplx( rZero )
 
2889
            fi(3) = chi(1)
 
2890
            fi(4) = chi(2)
 
2891
         else
 
2892
            fi(1) = chi(2)
 
2893
            fi(2) = chi(1)
 
2894
            fi(3) = dcmplx( rZero )
 
2895
            fi(4) = dcmplx( rZero )
 
2896
         endif
 
2897
      endif     
 
2898
 
 
2899
      return
 
2900
      end
 
2901
 
 
2902
      subroutine olxxxx(p,ffmass,nhel,nsf,fo)
 
2903
c
 
2904
c This subroutine computes a fermion wavefunction with the flowing-OUT
 
2905
c fermion number and defined with complex ONSHELL  momentum.
 
2906
c
 
2907
c input:
 
2908
c       complex    p(0:3)         : four-momentum of fermion
 
2909
c       real    fmass          : mass          of fermion
 
2910
c       integer nhel = -1 or 1 : helicity      of fermion
 
2911
c       integer nsf  = -1 or 1 : +1 for particle, -1 for anti-particle
 
2912
c
 
2913
c output:
 
2914
c       complex fo(8)          : fermion wavefunction               <fo|
 
2915
c     
 
2916
      implicit none
 
2917
      double complex fo(8),chi(2), fmass
 
2918
 
 
2919
      double complex sqm(0:1)
 
2920
      double precision sf(2), ffmass
 
2921
 
 
2922
      double complex p(0:3),sfomeg(2),omega(2),
 
2923
     &     pp,pp3,sqp0p3
 
2924
      integer nhel,nsf,nh,ip,im
 
2925
 
 
2926
      double precision rZero, rHalf, rTwo
 
2927
      parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
 
2928
 
 
2929
 
 
2930
c      fo(5) = dcmplx(p(0),p(3))*nsf
 
2931
c      fo(6) = dcmplx(p(1),p(2))*nsf
 
2932
      fo(5) = p(0)*(nsf)
 
2933
      fo(6) = p(1)*(nsf)
 
2934
      fo(7) = p(2)*(nsf)
 
2935
      fo(8) = p(3)*(nsf)      
 
2936
 
 
2937
      nh = nhel*nsf
 
2938
 
 
2939
      fmass=sqrt(p(0)**2-p(1)**2-p(2)**2-p(3)**2)
 
2940
 
 
2941
      if ( ffmass.ne.rZero ) then
 
2942
 
 
2943
c         pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
2944
         pp=sqrt(p(1)**2+p(2)**2+p(3)**2)
 
2945
 
 
2946
         if ( abs(pp).eq.rZero ) then
 
2947
            
 
2948
            sqm(0) = sqrt(fmass) ! possibility of negative fermion masses
 
2949
            sqm(1) = sqm(0) ! possibility of negative fermion masses
 
2950
            ip = -((1+nh)/2)
 
2951
            im =  (1-nh)/2
 
2952
            
 
2953
            fo(1) = im     * sqm(im)
 
2954
            fo(2) = ip*nsf * sqm(im)
 
2955
            fo(3) = im*nsf * sqm(-ip)
 
2956
            fo(4) = ip     * sqm(-ip)
 
2957
            
 
2958
         else
 
2959
            
 
2960
c            pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
 
2961
            pp=sqrt(p(1)**2+p(2)**2+p(3)**2) !repetition
 
2962
c            if( (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) .or.
 
2963
c     &          (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) ) then
 
2964
c            pp=-pp
 
2965
c            endif
 
2966
            sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
 
2967
            sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
 
2968
            omega(1) = sqrt(p(0)+pp)
 
2969
c            omega(2) = fmass/omega(1)
 
2970
            omega(2) = sqrt(p(0)-pp)
 
2971
            ip = (3+nh)/2
 
2972
            im = (3-nh)/2
 
2973
            sfomeg(1) = sf(1)*omega(ip)
 
2974
            sfomeg(2) = sf(2)*omega(im)
 
2975
            pp3 = pp+p(3)
 
2976
            chi(1) = sqrt(pp3*rHalf/pp)
 
2977
            if ( abs(pp3).eq.rZero ) then
 
2978
               chi(2) = dcmplx(-nh )
 
2979
            else
 
2980
               chi(2) = ( nh*p(1) - ((0d0,1d0)*p(2)) )/
 
2981
     .sqrt(rTwo*pp*pp3)
 
2982
            endif
 
2983
            
 
2984
            fo(1) = sfomeg(2)*chi(im)
 
2985
            fo(2) = sfomeg(2)*chi(ip)
 
2986
            fo(3) = sfomeg(1)*chi(im)
 
2987
            fo(4) = sfomeg(1)*chi(ip)
 
2988
 
 
2989
         endif
 
2990
         
 
2991
      else
 
2992
         
 
2993
c         if(zabs(p(1)).eq.0d0.and.zabs(p(2)).eq.0d0.and.zabs(p(3)).lt.0d0) then
 
2994
c            sqp0p3 = 0d0
 
2995
c         else
 
2996
            sqp0p3 = sqrt(p(0)+p(3))*nsf
 
2997
c         end if
 
2998
         chi(1) = sqp0p3
 
2999
         if ( abs(sqp0p3).eq.rZero ) then
 
3000
            chi(2) = dcmplx(-nhel )*sqrt(rTwo*p(0))
 
3001
         else
 
3002
            chi(2) = ( nh*p(1)-((0d0,1d0)*p(2)) )/sqp0p3
 
3003
         endif
 
3004
         if ( nh.eq.1 ) then
 
3005
            fo(1) = chi(1)
 
3006
            fo(2) = chi(2)
 
3007
            fo(3) = dcmplx( rZero )
 
3008
            fo(4) = dcmplx( rZero )
 
3009
         else
 
3010
            fo(1) = dcmplx( rZero )
 
3011
            fo(2) = dcmplx( rZero )
 
3012
            fo(3) = chi(2)
 
3013
            fo(4) = chi(1)
 
3014
         endif
 
3015
         
 
3016
      endif
 
3017
c
 
3018
      return
 
3019
      end