7 SUBROUTINE pykfdi(KFL1,KFL2,KFL3,KF)
10 IMPLICIT DOUBLE PRECISION(a-
h, o-
z)
14 common/
pydat1/mstu(200),paru(200),mstj(200),parj(200)
15 common/
pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
20 IF(mstu(123).EQ.0.AND.mstj(12).GE.0) CALL
pykfin
29 IF(kf1a.LE.10.AND.kf2a.LE.10.AND.kfl1*kfl2.GT.0)
RETURN
30 IF(kf1a.GT.10.AND.kf2a.GT.10)
RETURN
31 IF((kf1a.GT.10.OR.kf2a.GT.10).AND.kfl1*kfl2.LT.0)
RETURN
35 IF(mstj(15).EQ.1)
THEN
36 IF(mstj(12).GE.5) CALL
pyerrm(29,
37 &
'(PYKFDI:) Sorry, option MSTJ(15)=1 not available' //
38 &
' together with MSTJ(12)>=5 modification')
40 IF(kf1a.GE.1.AND.kf1a.LE.6) ktab1=kf1a
41 kfl1a=mod(kf1a/1000,10)
42 kfl1b=mod(kf1a/100,10)
44 IF(kfl1a.GE.1.AND.kfl1a.LE.4.AND.kfl1b.GE.1.AND.kfl1b.LE.4)
45 & ktab1=6+kfl1a*(kfl1a-2)+2*kfl1b+(kfl1s-1)/2
46 IF(kfl1a.GE.1.AND.kfl1a.LE.4.AND.kfl1a.EQ.kfl1b) ktab1=ktab1-1
47 IF(kf1a.GE.1.AND.kf1a.LE.6) kfl1a=kf1a
51 IF(kf2a.GE.1.AND.kf2a.LE.6) ktab2=kf2a
52 kfl2a=mod(kf2a/1000,10)
53 kfl2b=mod(kf2a/100,10)
55 IF(kfl2a.GE.1.AND.kfl2a.LE.4.AND.kfl2b.GE.1.AND.kfl2b.LE.4)
56 & ktab2=6+kfl2a*(kfl2a-2)+2*kfl2b+(kfl2s-1)/2
57 IF(kfl2a.GE.1.AND.kfl2a.LE.4.AND.kfl2a.EQ.kfl2b) ktab2=ktab2-1
59 IF(ktab1.GE.0.AND.ktab2.GE.0) goto 140
65 IF(kfdiq.GT.10.AND.kfdiq.LT.10000) irank=0
71 IF(irank.EQ.0.AND.mstj(12).LT.5)
73 IF(mstu(121).NE.0)
THEN
90 kfl1a=mod(kf1a/1000,10)
91 kfl1b=mod(kf1a/100,10)
94 IF(kfl1a.GE.3) qawt=parf(136+kfl1a/4)
95 IF(kfl1b.GE.3) qawt=qawt/parf(136+kfl1b/4)
96 kfqpop=kfl1a+(kfl1b-kfl1a)*int(1d0/(qawt+1d0)+
pyr(0))
98 IF(kfqpop.NE.kfl1b.AND.kfqpop.NE.kfl1a)
THEN
102 kfqold=kfl1a+kfl1b-kfqpop
108 IF(kf1a.LE.10.AND.mstj(12).GT.0)
THEN
109 IF(mstu(121).EQ.-1.OR.(1d0+parj(1))*
pyr(0).GT.1d0)
THEN
113 ELSEIF(kf1a.GT.10)
THEN
115 IF(irank.EQ.0) CALL
pynmes(kf1a)
116 IF(mstu(121).GT.0) mbary=-1
120 IF(mbary.EQ.0.OR.mbary.EQ.2)
THEN
121 kfqver=1+int((2d0+parj(2))*
pyr(0))
122 kfl3=isign(kfqver,-kfin)
129 IF(mstu(121).EQ.0) idw=150
131 IF(mstu(121).GT.0) sqwt=sqwt*parf(135)*parf(138)**mstu(121)
132 kfqpop=1+int((2d0+sqwt)*
pyr(0))
134 IF(kfqpop.GE.3.AND.mstj(12).GE.5)
THEN
135 parf(194)=parf(138)*parf(139)
136 parf(193)=parj(8)+parj(9)
141 IF(mbary.EQ.-1.AND.mstj(12).GE.5)
THEN
143 mstu(121)=mstu(121)-1
145 IF(mstu(121).EQ.0)
THEN
146 ipos=3*min(kfqpop-1,2)+min(kfqold-1,2)
148 ipos=3*3+3*
max(0,min(kfqpop-2,1))+min(kfqold-1,2)
151 IF(mstu(121).EQ.0)
THEN
152 ipos=3*5+5*min(kfqpop-1,3)+min(kfqold-1,4)
154 ipos=3*5+5*4+min(kfqold-1,4)
160 rmes=
pyr(0)*parf(194)
162 rmes=rmes-parf(ipos+imes)
168 IF(rmes.GT.0d0) goto 120
171 IF(kmul.EQ.2) kfj=10003
172 IF(kmul.EQ.3) kfj=10001
173 IF(kmul.EQ.4) kfj=20003
177 IF(kfqver.GE.kfqold) kfqver=kfqver+1
183 IF(mbary.EQ.-1) idw=170
185 IF(kfqpop.EQ.3) sqwt=parf(idw+3)
186 IF(kfqpop.GT.3) sqwt=parf(idw+3)*(1d0/parf(idw+5)+1d0)/2d0
187 kfqver=min(3,1+int((2d0+sqwt)*
pyr(0)))
188 IF(kfqpop.LT.3.AND.kfqver.LT.3)
THEN
190 IF(
pyr(0).GT.parf(idw+4)) kfqver=3-kfqpop
196 IF(kfqpop.NE.kfqver)
THEN
198 IF(kfqver.EQ.3) swt=parf(idw+6)
199 IF(kfqpop.GE.3) swt=parf(idw+5)
200 IF((1d0+swt)*
pyr(0).LT.1d0) kflds=1
202 kfdiq=900*
max(kfqver,kfqpop)+100*(kfqver+kfqpop)+kflds
204 kfl3=isign(kfdiq,kfin)
207 130
IF(mbary.LE.0)
THEN
208 kfla=
max(kfqold,kfqver)
209 kflb=min(kfqold,kfqver)
211 IF(kfla.NE.kfqold) kfs=-kfs
213 IF(mbary.EQ.-1.AND.mstj(12).GE.5)
THEN
214 IF(idiag.GT.0) kf=110*idiag+kfj
215 IF(idiag.EQ.0) kf=(100*kfla+10*kflb+kfj)*kfs*(-1)**kfla
218 IF(kfla.LE.2) kmul=int(parj(11)+
pyr(0))
219 IF(kfla.EQ.3) kmul=int(parj(12)+
pyr(0))
220 IF(kfla.GE.4) kmul=int(parj(13)+
pyr(0))
221 IF(kmul.EQ.0.AND.parj(14).GT.0d0)
THEN
222 IF(
pyr(0).LT.parj(14)) kmul=2
223 ELSEIF(kmul.EQ.1.AND.parj(15)+parj(16)+parj(17).GT.0d0)
THEN
225 IF(rmul.LT.parj(15)) kmul=3
226 IF(kmul.EQ.1.AND.rmul.LT.parj(15)+parj(16)) kmul=4
227 IF(kmul.EQ.1.AND.rmul.LT.parj(15)+parj(16)+parj(17)) kmul=5
230 IF(kmul.EQ.0.OR.kmul.EQ.3) kfls=1
233 kf=(100*kfla+10*kflb+kfls)*kfs*(-1)**kfla
237 IF(kfla.LE.3) kf=110*(1+int(rmix+parf(imix-1))+
238 & int(rmix+parf(imix)))+kfls
239 IF(kfla.GE.4) kf=110*kfla+kfls
241 IF(kmul.EQ.2.OR.kmul.EQ.3) kf=kf+isign(10000,kf)
242 IF(kmul.EQ.4) kf=kf+isign(20000,kf)
246 IF(kf.EQ.221.OR.kf.EQ.331)
THEN
247 IF(
pyr(0).GT.parj(25+kf/300))
THEN
248 IF(kf2a.GT.0) goto 130
249 IF(mstj(12).LT.4) irank=0
258 IF(kf1a.LE.10) kfla=kfqold
259 kflb=mod(kfdiq/1000,10)
260 kflc=mod(kfdiq/100,10)
262 kfld=
max(kfla,kflb,kflc)
263 kflf=min(kfla,kflb,kflc)
264 kfle=kfla+kflb+kflc-kfld-kflf
273 IF(kflb.GT.2) kdmax=kdmax+2
275 IF(kfla.NE.kflb.AND.kfla.NE.kflc)
THEN
280 su6max=parf(140+kdmax)
283 IF(mstj(12).GE.5.AND.irank.EQ.0)
THEN
288 su6oct=parf(60+kbary)
289 IF(kflg.GT.
max(kfla+kflb-kflg,2))
THEN
290 su6oct=su6oct*4*su6s/(3*su6s+1)
291 IF(kbary.EQ.2) su6oct=parf(60+kbary)*4/(3*su6s+1)
293 IF(kbary.EQ.6) su6oct=su6oct*(3+su6s)/(3*su6s+1)
295 su6wt=su6oct+su6dec*parf(70+kbary)
298 IF(su6wt.LT.
pyr(0)*su6max.AND.kf2a.EQ.0)
THEN
300 IF(mstj(12).LE.2.AND.mbary.EQ.1) mstu(121)=-1
307 IF(su6wt*
pyr(0).GT.su6oct) kfls=4
308 IF(kfls.EQ.2.AND.kfld.GT.kfle.AND.kfle.GT.kflf)
THEN
310 IF(kfla.NE.kfld) ksig=int(3*su6s/(3*su6s+kflds**2)+
pyr(0))
312 kf=isign(1000*kfld+100*kfle+10*kflf+kfls,kfl1)
313 IF(ksig.EQ.0) kf=isign(1000*kfld+100*kflf+10*kfle+kfls,kfl1)
318 140
IF(ktab2.EQ.0.AND.mstj(12).LE.0)
THEN
321 ELSEIF(ktab2.EQ.0.AND.ktab1.GE.7.AND.mstj(12).LE.1)
THEN
324 ELSEIF(ktab2.EQ.0)
THEN
334 rfl=rfl+parf(120+80*ktab1+25*kts+kt3)
342 rfl=rfl-parf(120+80*ktab1+25*kts+kt3)
343 IF(rfl.LE.0d0) goto 190
352 kfl3=isign(kfl3a,kfl1*(2*ktab1-13))
355 IF(ktab3.GE.8) kfl3a=2
356 IF(ktab3.GE.11) kfl3a=3
357 IF(ktab3.GE.16) kfl3a=4
358 kfl3b=(ktab3-6-kfl3a*(kfl3a-2))/2
359 kfl3=1000*kfl3a+100*kfl3b+1
360 IF(kfl3a.EQ.kfl3b.OR.ktab3.NE.6+kfl3a*(kfl3a-2)+2*kfl3b) kfl3=
362 kfl3=isign(kfl3,kfl1*(13-2*ktab1))
366 IF(kfl3a.EQ.kfl1a.AND.kfl3b.EQ.kfl1b.AND.(kfl3a.LE.3.OR.
368 rfl=
pyr(0)*(parf(143+80*ktab1+25*ktabs)+parf(144+80*ktab1+
369 & 25*ktabs)+parf(145+80*ktab1+25*ktabs))
371 IF(rfl.GT.parf(143+80*ktab1+25*ktabs)) kf=220+2*ktabs+1
372 IF(rfl.GT.parf(143+80*ktab1+25*ktabs)+parf(144+80*ktab1+
373 & 25*ktabs)) kf=330+2*ktabs+1
374 ELSEIF(ktab1.LE.6.AND.ktab3.LE.6)
THEN
375 kfla=
max(ktab1,ktab3)
376 kflb=min(ktab1,ktab3)
378 IF(kfla.NE.kf1a) kfs=-kfs
379 kf=(100*kfla+10*kflb+2*ktabs+1)*kfs*(-1)**kfla
380 ELSEIF(ktab1.GE.7.AND.ktab3.GE.7)
THEN
382 IF(kfl1a.EQ.kfl3a)
THEN
383 kfla=
max(kfl1b,kfl3b)
384 kflb=min(kfl1b,kfl3b)
385 IF(kfla.NE.kfl1b) kfs=-kfs
386 ELSEIF(kfl1a.EQ.kfl3b)
THEN
390 ELSEIF(kfl1b.EQ.kfl3a)
THEN
393 ELSEIF(kfl1b.EQ.kfl3b)
THEN
394 kfla=
max(kfl1a,kfl3a)
395 kflb=min(kfl1a,kfl3a)
396 IF(kfla.NE.kfl1a) kfs=-kfs
398 CALL
pyerrm(2,
'(PYKFDI:) no matching flavours for qq -> qq')
401 kf=(100*kfla+10*kflb+2*ktabs+1)*kfs*(-1)**kfla
414 kfld=
max(kfla,kflb,kflc)
415 kflf=min(kfla,kflb,kflc)
416 kfle=kfla+kflb+kflc-kfld-kflf
417 IF(ktabs.EQ.0) kf=isign(1000*kfld+100*kflf+10*kfle+2,kfl1)
418 IF(ktabs.GE.1) kf=isign(1000*kfld+100*kfle+10*kflf+2*ktabs,kfl1)
425 CALL
pyerrm(2,
'(PYKFDI:) user-defined flavour probabilities '//