Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyslha.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyslha.f
1 C*********************************************************************
2 
3 C...PYSLHA
4 C...Read/write spectrum or decay data from SLHA standard file(s).
5 C...P. Skands
6 
7 C...MUPDA=1 : READ SPECTRUM ON LUN=IMSS(21)
8 C...MUPDA=2 : LOOK FOR DECAY TABLE FOR KF=KFORIG ON LUN=IMSS(22)
9 C...MUPDA=3 : WRITE SPECTRUM ON LUN=IMSS(23)
10 C...(MUPDA=4 : WRITE DECAY TABLE FOR KF=KFORIG ON LUN=IMSS(24))
11 C...MUPDA=5 : READ MASS FOR KF=KFORIG ONLY (WITH DECAY TABLE)
12  SUBROUTINE pyslha(MUPDA,KFORIG,IRETRN)
13 
14 C...Double precision and integer declarations.
15  IMPLICIT DOUBLE PRECISION(a-h, o-z)
16  IMPLICIT INTEGER(i-n)
17  INTEGER pyk,pychge,pycomp
18  parameter(ksusy1=1000000,ksusy2=2000000,ktechn=3000000,
19  &kexcit=4000000,kdimen=5000000)
20 C...Commonblocks.
21  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
22  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
23  common/pydat3/mdcy(500,3),mdme(8000,2),brat(8000),kfdp(8000,5)
24  common/pydat4/chaf(500,2)
25  CHARACTER chaf*16
26  CHARACTER*40 isaver,visaje
27  common/pyint4/mwid(500),wids(500,5)
28  SAVE /pydat1/,/pydat2/,/pydat3/,/pydat4/,/pyint4/
29 C...SUSY blocks
30  common/pymssm/imss(0:99),rmss(0:99)
31  common/pyssmt/zmix(4,4),umix(2,2),vmix(2,2),smz(4),smw(2),
32  &sfmix(16,4),zmixi(4,4),umixi(2,2),vmixi(2,2)
33  common/pymsrv/rvlam(3,3,3), rvlamp(3,3,3), rvlamb(3,3,3)
34  SAVE /pymssm/,/pyssmt/,/pymsrv/
35 
36 C...Local arrays, character variables and data.
37  common/pylh3p/modsel(200),parmin(100),parext(200),rmsoft(0:100),
38  & au(3,3),ad(3,3),ae(3,3)
39  common/pylh3c/cpro(2),cver(2)
40  SAVE /pylh3p/,/pylh3c/
41  dimension mmod(100),mspc(100),mdec(100)
42 C...MMOD: flags to set for each block read in.
43 C... 1: MODSEL 2: MINPAR 3: EXTPAR 4: SMINPUTS
44 C...MSPC: Flags to set for each block read in.
45 C... 1: MASS 2: NMIX 3: UMIX 4: VMIX 5: SBOTMIX
46 C... 6: STOPMIX 7: STAUMIX 8: HMIX 9: GAUGE 10: AU
47 C...11: AD 12: AE 13: YU 14: YD 15: YE
48 C...16: SPINFO 17: ALPHA 18: MSOFT 19: QNUMBERS
49  CHARACTER cpro*12,cver*12,chnlin*6
50  CHARACTER doc*11, chdum*120, chblck*60
51  CHARACTER chinl*120,chkf*9,chtmp*16
52  INTEGER verbos
53  SAVE verbos
54 C...Date of last Change
55  parameter(doc='05 Mar 2007')
56 C...MQREAD(0): Number of entries I in MQREAD
57 C... (I): KF code for which a QNUMBERS block has been read.
58  dimension idc(5),kfsusy(50),mqread(0:100)
59  SAVE kfsusy,mqread
60  DATA verbos /1/
61  DATA nhello /0/
62  DATA kfsusy/
63  &1000001,1000002,1000003,1000004,1000005,1000006,
64  &2000001,2000002,2000003,2000004,2000005,2000006,
65  &1000011,1000012,1000013,1000014,1000015,1000016,
66  &2000011,2000012,2000013,2000014,2000015,2000016,
67  &1000021,1000022,1000023,1000025,1000035,1000024,
68  &1000037,1000039, 25, 35, 36, 37,
69  & 6, 24, 45, 46,1000045, 9*0/
70  rmfun(ip)=pmas(pycomp(ip),1)
71 
72 C...Hello World
73  IF (nhello.EQ.0) THEN
74  WRITE(mstu(11),5000) doc
75  nhello=1
76  ENDIF
77 
78 C...SLHA file assumed opened by user on unit LFN, stored in IMSS(20
79 C...+MUPDA).
80  lfn=imss(20+mupda)
81  IF (mupda.EQ.5) lfn=imss(21)
82  IF (mupda.EQ.0) lfn=imss(21)
83 C...Flag that we have not yet found whatever we were asked to find.
84  iretrn=1
85 
86 C...STOP IF LFN IS ZERO (i.e. if no LFN was given).
87  IF (lfn.EQ.0) THEN
88  WRITE(mstu(11),*) '* (PYSLHA:) No valid unit given in IMSS'
89  goto 9999
90  ENDIF
91 
92 C...If told to read spectrum, first zero all previous information.
93  IF (mupda.EQ.1) THEN
94 C...Zero all block read flags
95  DO 100 m=1,100
96  mmod(m)=0
97  mspc(m)=0
98  mdec(m)=0
99  100 CONTINUE
100 C...Zero all (MSSM) masses, widths, and lifetimes in PYTHIA
101  DO 110 isusy=1,36
102  kc=pycomp(kfsusy(isusy))
103  pmas(kc,1)=0d0
104  pmas(kc,2)=0d0
105  pmas(kc,3)=0d0
106  pmas(kc,4)=0d0
107  110 CONTINUE
108 C...Zero all (3rd gen sfermion + gaugino/higgsino) mixing matrices.
109  DO 130 j=1,4
110  sfmix(5,j) =0d0
111  sfmix(6,j) =0d0
112  sfmix(15,j)=0d0
113  DO 120 l=1,4
114  zmix(l,j) =0d0
115  zmixi(l,j)=0d0
116  IF (j.LE.2.AND.l.LE.2) THEN
117  umix(l,j) =0d0
118  umixi(l,j)=0d0
119  vmix(l,j) =0d0
120  vmixi(l,j)=0d0
121  ENDIF
122  120 CONTINUE
123 C...Zero signed masses.
124  smz(j)=0d0
125  IF (j.LE.2) smw(j)=0d0
126  130 CONTINUE
127 C...NB: RMSS array not zeroed.
128  WRITE(mstu(11),*)
129  & '* (PYSLHA:) Reading in SLHA spectrum from unit ', lfn
130 
131 C...If reading decays, reset PYTHIA decay counters.
132  ELSEIF (mupda.EQ.2) THEN
133  kcc=100
134  ndc=0
135  brsum=0d0
136  DO 140 kc=1,mstu(6)
137  IF(kc.GT.100.AND.kchg(kc,4).GT.100) kcc=kc
138  ndc=max(ndc,mdcy(kc,2)+mdcy(kc,3)-1)
139  140 CONTINUE
140  ELSEIF (mupda.EQ.5) THEN
141 C...Zero block read flags
142  DO 150 m=1,100
143  mspc(m)=0
144  150 CONTINUE
145  ENDIF
146 
147 C............READ
148 C...(spectrum or look for decays of KF=KFORIG or MASS of KF=KFORIG
149  IF(mupda.EQ.0.OR.mupda.EQ.1.OR.mupda.EQ.2.OR.mupda.EQ.5) THEN
150 C...Initialize program and version strings
151  IF(mupda.EQ.1.OR.mupda.EQ.2) THEN
152  cpro(mupda)=' '
153  cver(mupda)=' '
154  ENDIF
155 
156 C...Initialize read loop
157  merr=0
158  nline=0
159  chblck=' '
160 C...READ NEW LINE INTO CHINL. GOTO 300 AT END-OF-FILE.
161  160 chinl=' '
162  READ(lfn,'(A120)',end=300) chinl
163 C...Count which line number we're at.
164  nline=nline+1
165  WRITE(chnlin,'(I6)') nline
166 
167 C...Skip comment and empty lines without processing.
168  IF (chinl(1:1).EQ.'#'.OR.chinl.EQ.' ') goto 160
169 
170 C...We assume all upper case below. Rewrite CHINL to all upper case.
171  inl=0
172  igood=0
173  170 inl=inl+1
174  IF (chinl(inl:inl).NE.'#') THEN
175  DO 180 ich=97,122
176  IF (char(ich).EQ.chinl(inl:inl)) chinl(inl:inl)=char(ich-32)
177  180 CONTINUE
178 C...Extra safety. Chek for sensible input on line
179  IF (igood.EQ.0) THEN
180  DO 190 ich=48,90
181  IF (char(ich).EQ.chinl(inl:inl)) igood=1
182  190 CONTINUE
183  ENDIF
184  IF (inl.LT.120) goto 170
185  ENDIF
186  IF (igood.EQ.0) goto 160
187 
188 C...Check for BLOCK begin statement (spectrum).
189  IF (chinl(1:1).EQ.'B') THEN
190  merr=0
191  READ(chinl,'(A6,A)',err=460) chdum,chblck
192 C...Check if another of this type of block was already read.
193 C...(logarithmic interpolation not yet implemented, so duplicates always
194 C...give errors)
195  IF (chblck(1:6).EQ.'MODSEL'.AND.mmod(1).NE.0) merr=7
196  IF (chblck(1:6).EQ.'MINPAR'.AND.mmod(2).NE.0) merr=7
197  IF (chblck(1:6).EQ.'EXTPAR'.AND.mmod(3).NE.0) merr=7
198  IF (chblck(1:8).EQ.'SMINPUTS'.AND.mmod(4).NE.0) merr=7
199  IF (chblck(1:4).EQ.'MASS'.AND.mspc(1).NE.0) merr=7
200  IF (chblck(1:4).EQ.'NMIX'.AND.mspc(2).NE.0) merr=7
201  IF (chblck(1:4).EQ.'UMIX'.AND.mspc(3).NE.0) merr=7
202  IF (chblck(1:4).EQ.'VMIX'.AND.mspc(4).NE.0) merr=7
203  IF (chblck(1:7).EQ.'SBOTMIX'.AND.mspc(5).NE.0) merr=7
204  IF (chblck(1:7).EQ.'STOPMIX'.AND.mspc(6).NE.0) merr=7
205  IF (chblck(1:7).EQ.'STAUMIX'.AND.mspc(7).NE.0) merr=7
206  IF (chblck(1:4).EQ.'HMIX'.AND.mspc(8).NE.0) merr=7
207  IF (chblck(1:5).EQ.'ALPHA'.AND.mspc(17).NE.0) merr=7
208  IF (chblck(1:5).EQ.'AU'.AND.mspc(10).NE.0) merr=7
209  IF (chblck(1:5).EQ.'AD'.AND.mspc(11).NE.0) merr=7
210  IF (chblck(1:5).EQ.'AE'.AND.mspc(12).NE.0) merr=7
211  IF (chblck(1:5).EQ.'MSOFT'.AND.mspc(18).NE.0) merr=7
212 C...Check for new particles
213  IF (chblck(1:8).EQ.'QNUMBERS'.OR.chblck(1:8).EQ.'PARTICLE')
214  & THEN
215  mspc(19)=mspc(19)+1
216 C...Read PDG code
217  READ(chblck(9:60),*) kfq
218 
219  DO 121 mq=1,mqread(0)
220  IF (mqread(mq).EQ.kfq) THEN
221  merr=17
222  goto 290
223  ENDIF
224  121 CONTINUE
225  WRITE(mstu(11),'(A,I9,A,F12.3)')
226  & ' * (PYSLHA:) Reading in '//chblck(1:8)//
227  & ' for KF =',kfq
228  mqread(0)=mqread(0)+1
229  mqread(mqread(0))=kfq
230  mspc(19)=mspc(19)+1
231  kcq=pycomp(kfq)
232  IF (kcq.EQ.0) THEN
233  DO 123 kct=100,mstu(6)
234  IF(kchg(kct,4).GT.100) kcq=kct
235  123 CONTINUE
236  kcq=kcq+1
237  kcc=kcq
238  kchg(kcq,4)=kfq
239 C...First write PDG code as name
240  WRITE(chtmp,*) kfq
241 C...Then look for real name
242  icmt=9
243  90 icmt=icmt+1
244  IF (chblck(icmt:icmt).NE.'#'.AND.icmt.LT.59) goto 90
245  IF (icmt.LT.59) THEN
246  READ(chblck(icmt+1:60),'(A)',err=95) chdum
247  IF (chdum.NE.' ') chtmp=chdum
248  ENDIF
249  95 IF (chtmp(1:1).EQ.' ') THEN
250  READ(chtmp,'(1x,A)') chaf(kcq,1)
251  ELSE
252  READ(chtmp,'(A)') chaf(kcq,1)
253  ENDIF
254  mstu(20)=0
255 C...Set stable for now
256  pmas(kcq,2)=1d-6
257  mwid(kcq)=0
258  mdcy(kcq,1)=0
259  mdcy(kcq,2)=0
260  mdcy(kcq,3)=0
261  ELSE
262  WRITE(mstu(11),*)
263  & '* (PYSLHA:) KF =',kfq,' already exists: ',
264  & chaf(kcq,1), '. Entry ignored.'
265  merr=7
266  ENDIF
267  ENDIF
268 C...Finalize this line and read next.
269  goto 290
270 C...Check for DECAY begin statement (decays).
271  ELSEIF (chinl(1:1).EQ.'D') THEN
272  merr=0
273  brsum=0d0
274  chblck='DECAY'
275 C...Read KF code and WIDTH
276  mpsign=1
277  READ(chinl(7:inl),*,err=470) kf, width
278  IF (kf.LE.0) THEN
279  kf=-kf
280  mpsign=-1
281  ENDIF
282 C...If this is not the KF we're looking for...
283  IF (kf.NE.kforig.OR.mupda.NE.2) THEN
284 C...Set block skip flag and read next line.
285  merr=16
286  goto 290
287  ENDIF
288 
289 C...Determine PYTHIA KC code of particle
290  kcrep=0
291  IF(kf.LE.100) THEN
292  kcrep=kf
293  ELSE
294  DO 200 kcr=101,kcc
295  IF(kchg(kcr,4).EQ.kf) kcrep=kcr
296  200 CONTINUE
297  ENDIF
298  kc=kcrep
299  IF (kcrep.NE.0) THEN
300 C...Particle is already known. Don't do anything yet.
301  ELSE
302 C... Add new particle. Actually, this should not happen.
303 C... New particles should be added already when reading the spectrum
304 C... information, so go under previously stable category.
305  kcc=kcc+1
306  kc=kcc
307  ENDIF
308 
309  IF (width.LE.0d0) THEN
310 C...Stable (i.e. LSP)
311  WRITE(mstu(11),*)
312  & '* (PYSLHA:) Reading in SLHA stable particle: ',
313  & chaf(kcrep,1)
314  IF (width.LT.0d0) THEN
315  CALL pyerrm(19,'(PYSLHA:) Negative width forced to'//
316  & ' zero !')
317  width=0d0
318  ENDIF
319  pmas(kc,2)=1d-6
320  mwid(kc)=0
321  mdcy(kc,1)=0
322 C...Ignore any decay lines that may be present for this KF
323  merr=16
324  mdcy(kc,2)=0
325  mdcy(kc,3)=0
326 C...Return ok
327  iretrn=0
328  ENDIF
329 C...Finalize and start reading in decay modes.
330  goto 290
331  ELSEIF (mod(merr,10).GE.6) THEN
332 C...If ignore block flag set, skip directly to next line.
333  goto 160
334  ENDIF
335 
336 C...READ SPECTRUM
337  IF (mupda.EQ.0.AND.merr.EQ.0) THEN
338  IF (chblck(1:8).EQ.'QNUMBERS'.OR.chblck(1:8).EQ.'PARTICLE')
339  & THEN
340  READ(chinl,*) indx, ival
341  IF (indx.EQ.1) kchg(kcq,1)=ival
342  IF (indx.EQ.3) kchg(kcq,2)=0
343  IF (indx.EQ.3.AND.ival.EQ.3) kchg(kcq,2)=1
344  IF (indx.EQ.3.AND.ival.EQ.-3) kchg(kcq,2)=-1
345  IF (indx.EQ.3.AND.ival.EQ.8) kchg(kcq,2)=2
346  IF (indx.EQ.4) THEN
347  kchg(kcq,3)=ival
348  IF (ival.EQ.1) THEN
349  chtmp=chaf(kcq,1)
350  IF (chtmp.EQ.' ') THEN
351  WRITE(chaf(kcq,1),*) kchg(kcq,4)
352  WRITE(chaf(kcq,2),*) -kchg(kcq,4)
353  ELSE
354  ilast=17
355  116 ilast=ilast-1
356  IF (chtmp(ilast:ilast).EQ.' ') goto 116
357  IF (chtmp(ilast:ilast).EQ.'+') THEN
358  chtmp(ilast:ilast)='-'
359  ELSE
360  chtmp(ilast+1:min(16,ilast+4))='bar'
361  ENDIF
362  chaf(kcq,2)=chtmp
363  ENDIF
364  ENDIF
365  ENDIF
366  ELSE
367  merr=8
368  ENDIF
369  ELSEIF ((mupda.EQ.1.OR.mupda.EQ.5).AND.merr.EQ.0) THEN
370 C...MASS: Mass spectrum
371  IF (chblck(1:4).EQ.'MASS') THEN
372  READ(chinl,*) kf, val
373  merr=1
374  kc=0
375  IF (mupda.EQ.1.OR.kf.EQ.kforig) THEN
376 C...Read in masses for anything
377  merr=0
378  kc=pycomp(kf)
379  IF (kc.NE.0) THEN
380  mspc(1)=mspc(1)+1
381  pmas(kc,1) = abs(val)
382  IF (mupda.EQ.5) THEN
383  WRITE(mstu(11),'(A,I9,A,F12.3)')
384  & ' * (PYSLHA:) Reading in MASS entry for KF =',
385  & kf, ', pole mass =', val
386  iretrn=0
387  ENDIF
388 C... Signed masses
389  IF (kf.EQ.1000021.AND.mspc(18).EQ.0) rmss(3)=val
390  IF (kf.EQ.1000022) smz(1)=val
391  IF (kf.EQ.1000023) smz(2)=val
392  IF (kf.EQ.1000025) smz(3)=val
393  IF (kf.EQ.1000035) smz(4)=val
394  IF (kf.EQ.1000024) smw(1)=val
395  IF (kf.EQ.1000037) smw(2)=val
396  ENDIF
397  ELSEIF (mupda.EQ.5) THEN
398  merr=0
399  ENDIF
400  ELSEIF (mupda.EQ.5) THEN
401 C...Only read MASS if MUPDA = 5. Skip any other blocks.
402  merr=8
403  ELSEIF (chblck(1:8).EQ.'QNUMBERS'.OR.
404  & chblck(1:8).EQ.'PARTICLE') THEN
405 C...Don't print a warning for QNUMBERS when reading spectrum
406  merr=8
407 C... MODSEL: Model selection and global switches
408  ELSEIF (chblck(1:6).EQ.'MODSEL') THEN
409  READ(chinl,*) indx, ival
410  IF (indx.LE.200.AND.indx.GT.0) THEN
411  modsel(indx)=ival
412  mmod(1)=mmod(1)+1
413  IF (indx.EQ.3.AND.ival.EQ.1) THEN
414 C... Switch on NMSSM
415  WRITE(mstu(11),*) '* (PYSLHA:) switching on NMSSM'
416  imss(13)=max(1,imss(13))
417 C... Add NMSSM states if not already done
418 
419  kfn=25
420  kcn=kfn
421  chaf(kcn,1)='H_10'
422  chaf(kcn,2)=' '
423 
424  kfn=35
425  kcn=kfn
426  chaf(kcn,1)='H_20'
427  chaf(kcn,2)=' '
428 
429  kfn=45
430  kcn=kfn
431  chaf(kcn,1)='H_30'
432  chaf(kcn,2)=' '
433 
434  kfn=36
435  kcn=kfn
436  chaf(kcn,1)='A_10'
437  chaf(kcn,2)=' '
438 
439  kfn=46
440  kcn=kfn
441  chaf(kcn,1)='A_20'
442  chaf(kcn,2)=' '
443 
444  kfn=1000045
445  kcn=pycomp(kfn)
446  IF (kcn.EQ.0) THEN
447  DO 234 kct=100,mstu(6)
448  IF(kchg(kct,4).GT.100) kcn=kct
449  234 CONTINUE
450  kcn=kcn+1
451  kchg(kcn,4)=kfn
452  mstu(20)=0
453  ENDIF
454 C... Set stable for now
455  pmas(kcn,2)=1d-6
456  mwid(kcn)=0
457  mdcy(kcn,1)=0
458  mdcy(kcn,2)=0
459  mdcy(kcn,3)=0
460  chaf(kcn,1)='~chi_50'
461  chaf(kcn,2)=' '
462  ENDIF
463  ELSE
464  merr=1
465  ENDIF
466 C...MINPAR: Minimal model parameters
467  ELSEIF (chblck(1:6).EQ.'MINPAR') THEN
468  IF (modsel(1).NE.0) THEN
469  READ(chinl,*) indx, val
470  IF (indx.LE.100.AND.indx.GT.0) THEN
471  parmin(indx)=val
472  mmod(2)=mmod(2)+1
473  ELSE
474  merr=1
475  ENDIF
476  ELSEIF (mmod(3).NE.0) THEN
477  WRITE(mstu(11),*)
478  & '* (PYSLHA:) MINPAR after EXTPAR !'
479  merr=1
480  ELSE
481  WRITE(mstu(11),*)
482  & '* (PYSLHA:) Reading MINPAR, but no MODSEL !'
483  merr=1
484  ENDIF
485 C...tan(beta)
486  IF (indx.EQ.3) rmss(5)=val
487 C...EXTPAR: non-minimal model parameters.
488  ELSEIF (chblck(1:6).EQ.'EXTPAR') THEN
489  IF (mmod(1).NE.0) THEN
490  READ(chinl,*) indx, val
491  IF (indx.LE.200.AND.indx.GT.0) THEN
492  parext(indx)=val
493  mmod(3)=mmod(3)+1
494  ELSE
495  merr=1
496  ENDIF
497  ELSE
498  WRITE(mstu(11),*)
499  & '* (PYSLHA:) Reading EXTPAR, but no MODSEL !'
500  merr=1
501  ENDIF
502 C...tan(beta)
503  IF (indx.EQ.25) rmss(5)=val
504  ELSEIF (chblck(1:8).EQ.'SMINPUTS') THEN
505  READ(chinl,*) indx, val
506  IF (indx.LE.3.OR.indx.EQ.5.OR.indx.GE.7) THEN
507  merr=1
508  ELSEIF (indx.EQ.4) THEN
509  pmas(pycomp(23),1)=val
510  ELSEIF (indx.EQ.6) THEN
511  pmas(pycomp(6),1)=val
512  ENDIF
513  ELSEIF (chblck(1:4).EQ.'NMIX'.OR.chblck(1:4).EQ.'VMIX'.or
514  $ .chblck(1:4).EQ.'UMIX'.OR.chblck(1:7).EQ.'STOPMIX'.or
515  $ .chblck(1:7).EQ.'SBOTMIX'.OR.chblck(1:7).EQ.'STAUMIX')
516  $ THEN
517 C...NMIX,UMIX,VMIX,STOPMIX,SBOTMIX, and STAUMIX. Mixing.
518  im=0
519  IF (chblck(5:6).EQ.'IM') im=1
520  250 READ(chinl,*) indx1, indx2, val
521  IF (chblck(1:1).EQ.'N'.AND.indx1.LE.4.AND.indx2.LE.4) THEN
522  IF (im.EQ.0) zmix(indx1,indx2) = val
523  IF (im.EQ.1) zmixi(indx1,indx2)= val
524  mspc(2)=mspc(2)+1
525  ELSEIF (chblck(1:1).EQ.'U') THEN
526  IF (im.EQ.0) umix(indx1,indx2) = val
527  IF (im.EQ.1) umixi(indx1,indx2)= val
528  mspc(3)=mspc(3)+1
529  ELSEIF (chblck(1:1).EQ.'V') THEN
530  IF (im.EQ.0) vmix(indx1,indx2) = val
531  IF (im.EQ.1) vmixi(indx1,indx2)= val
532  mspc(4)=mspc(4)+1
533  ELSEIF (chblck(1:4).EQ.'STOP'.OR.chblck(1:4).EQ.'SBOT'.or
534  $ .chblck(1:4).EQ.'STAU') THEN
535  IF (chblck(1:4).EQ.'STOP') THEN
536  kfsm=6
537  ispc=6
538  ELSEIF (chblck(1:4).EQ.'SBOT') THEN
539  kfsm=5
540  ispc=5
541  ELSEIF (chblck(1:4).EQ.'STAU') THEN
542  kfsm=15
543  ispc=7
544  ENDIF
545 C...Set SFMIX element
546  sfmix(kfsm,2*(indx1-1)+indx2)=val
547  mspc(ispc)=mspc(ispc)+1
548  ENDIF
549 C...Running parameters
550  ELSEIF (chblck(1:4).EQ.'HMIX') THEN
551  READ(chblck(8:25),*,err=510) q
552  READ(chinl,*) indx, val
553  mspc(8)=mspc(8)+1
554  IF (indx.EQ.1) THEN
555  rmss(4) = val
556  ELSE
557  merr=1
558  mspc(8)=mspc(8)-1
559  ENDIF
560  ELSEIF (chblck(1:5).EQ.'ALPHA') THEN
561  READ(chinl,*,err=520) val
562  rmss(18)= val
563  mspc(17)=mspc(17)+1
564 C...Higgs parameters set manually or with FeynHiggs.
565  imss(4)=max(2,imss(4))
566  ELSEIF (chblck(1:2).EQ.'AU'.OR.chblck(1:2).EQ.'AD'.or
567  & .chblck(1:2).EQ.'AE') THEN
568  READ(chblck(9:26),*,err=510) q
569  READ(chinl,*) indx1, indx2, val
570  IF (chblck(2:2).EQ.'U') THEN
571  au(indx1,indx2)=val
572  IF (indx1.EQ.3.AND.indx2.EQ.3) rmss(16)=val
573  mspc(11)=mspc(11)+1
574  ELSEIF (chblck(2:2).EQ.'D') THEN
575  ad(indx1,indx2)=val
576  IF (indx1.EQ.3.AND.indx2.EQ.3) rmss(15)=val
577  mspc(10)=mspc(10)+1
578  ELSEIF (chblck(2:2).EQ.'E') THEN
579  ae(indx1,indx2)=val
580  IF (indx1.EQ.3.AND.indx2.EQ.3) rmss(17)=val
581  mspc(12)=mspc(12)+1
582  ELSE
583  merr=1
584  ENDIF
585  ELSEIF (chblck(1:5).EQ.'MSOFT') THEN
586  IF (mspc(18).EQ.0) THEN
587  READ(chblck(9:25),*,err=510) q
588  rmsoft(0)=q
589  ENDIF
590  READ(chinl,*) indx, val
591  rmsoft(indx)=val
592  mspc(18)=mspc(18)+1
593  ELSEIF (chblck(1:5).EQ.'GAUGE') THEN
594  merr=8
595  ELSEIF (chblck(1:2).EQ.'YU'.OR.chblck(1:2).EQ.'YD'.or
596  & .chblck(1:2).EQ.'YE') THEN
597  merr=8
598  ELSEIF (chblck(1:6).EQ.'SPINFO') THEN
599  READ(chinl(1:6),*) indx
600  it=0
601  mird=0
602  260 it=it+1
603  IF (chinl(it:it).EQ.' ') goto 260
604 C...Don't read index
605  IF (chinl(it:it).EQ.char(indx+48).AND.mird.EQ.0) THEN
606  mird=1
607  goto 260
608  ENDIF
609  IF (indx.EQ.1) cpro(1)=chinl(it:it+12)
610  IF (indx.EQ.2) cver(1)=chinl(it:it+12)
611  ELSE
612 C... Set unrecognized block flag.
613  merr=6
614  ENDIF
615 
616 C...DECAY TABLES
617 C...Read in decay information
618  ELSEIF (mupda.EQ.2.AND.merr.EQ.0) THEN
619 C...Read new decay chanel
620  IF(chinl(1:1).EQ.' '.AND.chblck(1:5).EQ.'DECAY') THEN
621  ndc=ndc+1
622 C...Read in branching ratio and number of daughters for this mode.
623  READ(chinl(4:50),*,err=480) brat(ndc)
624  READ(chinl(4:50),*,err=490) dum, nda
625  IF (nda.LE.5) THEN
626  IF(ndc.GT.mstu(7)) CALL pyerrm(27,
627  & '(PYSLHA:) Decay data arrays full by KF ='
628  $ //chaf(kc,1))
629 C...If first decay chanel, set decays start point in decay table
630  IF(brsum.LE.0d0.AND.brat(ndc).NE.0d0) THEN
631  WRITE(mstu(11),*)
632  & '* (PYSLHA:) Reading in SLHA decay table for ',
633  & chaf(kcrep,1)
634 C...Set particle parameters (mass set when reading BLOCK MASS above)
635  pmas(kc,2)=width
636  IF (kf.EQ.25.OR.kf.EQ.35.OR.kf.EQ.36) THEN
637  WRITE(mstu(11),*)
638  & '* Note: the Pythia gg->h/H/A cross section'//
639  & ' is proportional to the h/H/A->gg width'
640  ENDIF
641  pmas(kc,3)=0d0
642  pmas(kc,4)=paru(3)*1d-12/width
643  mwid(kc)=2
644  mdcy(kc,1)=1
645  mdcy(kc,2)=ndc
646  mdcy(kc,3)=0
647 C...Return ok
648  iretrn=0
649  ENDIF
650 C... Count up number of decay modes for this particle
651  mdcy(kc,3)=mdcy(kc,3)+1
652 C... Read in decay daughters.
653  READ(chinl(4:120),*,err=500) dum,idm, (idc(ida),ida=1,nda)
654 C... Flip sign if reading antiparticle decays (if antipartner exists)
655  DO 270 ida=1,nda
656  IF (kchg(pycomp(idc(ida)),3).NE.0)
657  & idc(ida)=mpsign*idc(ida)
658  270 CONTINUE
659 C...Switch on decay channel, with products ordered in decreasing ABS(KF)
660  mdme(ndc,1)=1
661  IF (brat(ndc).LE.0d0) mdme(ndc,1)=0
662  brsum=brsum+abs(brat(ndc))
663  brat(ndc)=abs(brat(ndc))
664  274 iflip=0
665  DO 277 ida=1,nda-1
666  IF (iabs(idc(ida+1)).GT.iabs(idc(ida))) THEN
667  itmp=idc(ida)
668  idc(ida)=idc(ida+1)
669  idc(ida+1)=itmp
670  iflip=iflip+1
671  ENDIF
672  277 CONTINUE
673  IF (iflip.GT.0) goto 274
674 C WRITE(MSTU(11),7510) BRAT(NDC), NDA, (IDC(IDA),IDA=1,NDA)
675 C...Treat as ordinary decay, no fancy stuff.
676  mdme(ndc,2)=0
677  DO 280 ida=1,5
678  IF (ida.LE.nda) THEN
679  kfdp(ndc,ida)=idc(ida)
680  ELSE
681  kfdp(ndc,ida)=0
682  ENDIF
683  280 CONTINUE
684  ELSE
685  CALL pyerrm(7,'(PYSLHA:) Too many daughters on line '//
686  & chnlin)
687  merr=11
688  ndc=ndc-1
689  ENDIF
690  ELSEIF(chinl(1:1).EQ.'+') THEN
691  merr=11
692  ELSEIF(chblck(1:6).EQ.'DCINFO') THEN
693  merr=16
694  ELSE
695  merr=16
696  ENDIF
697  ENDIF
698 C... Error check.
699  290 IF (mod(merr,10).EQ.1.AND.(mupda.EQ.1.OR.mupda.EQ.2)) THEN
700  WRITE(mstu(11),*) '* (PYSLHA:) Ignoring line '//chnlin//': '
701  & //chinl(1:40)
702  merr=0
703  ELSEIF (merr.EQ.6.AND.mupda.EQ.1) THEN
704  WRITE(mstu(11),*) '* (PYSLHA:) Ignoring BLOCK '//
705  & chblck(1:inl)//'... on line'//chnlin
706  ELSEIF (merr.EQ.8.AND.mupda.EQ.1) THEN
707  WRITE(mstu(11),*) '* (PYSLHA:) PYTHIA will not use BLOCK '
708  & //chblck(1:inl)//'... on line'//chnlin
709  ELSEIF (merr.EQ.16.AND.mupda.EQ.2.AND.imss(21).EQ.0.AND.
710  & chblck(1:1).NE.'D'.AND.verbos.EQ.1) THEN
711  WRITE(mstu(11),*) '* (PYSLHA:) Ignoring BLOCK '//chblck(1:inl)
712  & //'... on line'//chnlin
713  ELSEIF (merr.EQ.7.AND.mupda.EQ.1) THEN
714  WRITE(mstu(11),*) '* (PYSLHA:) Ignoring extra BLOCK '/
715  & /chblck(1:inl)//'... on line'//chnlin
716  ELSEIF (merr.EQ.2.AND.mupda.EQ.1) THEN
717  WRITE (chtmp,*) kf
718  WRITE(mstu(11),*)
719  & '* (PYSLHA:) Ignoring extra MASS entry for KF='//
720  & chtmp(1:9)//' on line'//chnlin
721  ENDIF
722 C... End of loop
723  goto 160
724  300 CONTINUE
725 C...Set flag that KC codes have been rearranged.
726  mstu(20)=0
727  verbos=0
728 
729 C...Perform possible tests that new information is consistent.
730  IF (mupda.EQ.1) THEN
731  mstu23=mstu(23)
732  mstu27=mstu(27)
733 C...Check Z and top masses
734  IF (abs(pmas(pycomp(23),1)-91.2d0).GT.1d0) THEN
735  WRITE(chtmp,*) pmas(pycomp(23),1)
736  CALL pyerrm(19,'(PYSLHA:) note Z boson mass, M ='//chtmp)
737  ENDIF
738  IF (abs(pmas(pycomp(6),1)-175d0).GT.25d0) THEN
739  WRITE(chtmp,*) pmas(pycomp(6),1)
740  CALL pyerrm(19,'(PYSLHA:) note top quark mass, M ='
741  & //chtmp//'GeV')
742  ENDIF
743 C...Check masses
744  DO 310 isusy=1,37
745  kf=kfsusy(isusy)
746 C...Don't complain about right-handed neutrinos
747  IF (kf.EQ.ksusy2+12.OR.kf.EQ.ksusy2+14.OR.kf.EQ.ksusy2
748  & +16) goto 310
749 C...Only check gravitino in GMSB scenarios
750  IF (modsel(1).NE.2.AND.kf.EQ.ksusy1+39) goto 310
751  kc=pycomp(kf)
752  IF (pmas(kc,1).EQ.0d0) THEN
753  WRITE(chtmp,*) kf
754  CALL pyerrm(9
755  & ,'(PYSLHA:) No mass information found for KF = '
756  & //chtmp)
757  ENDIF
758  310 CONTINUE
759 C...Check mixing matrices (MSSM only)
760  IF (imss(13).EQ.0) THEN
761  IF (mspc(2).NE.16.AND.mspc(2).NE.32) CALL pyerrm(9
762  & ,'(PYSLHA:) Inconsistent # of elements in NMIX')
763  IF (mspc(3).NE.4.AND.mspc(3).NE.8) CALL pyerrm(9
764  & ,'(PYSLHA:) Inconsistent # of elements in UMIX')
765  IF (mspc(4).NE.4.AND.mspc(4).NE.8) CALL pyerrm(9
766  & ,'(PYSLHA:) Inconsistent # of elements in VMIX')
767  IF (mspc(5).NE.4) CALL pyerrm(9
768  & ,'(PYSLHA:) Inconsistent # of elements in SBOTMIX')
769  IF (mspc(6).NE.4) CALL pyerrm(9
770  & ,'(PYSLHA:) Inconsistent # of elements in STOPMIX')
771  IF (mspc(7).NE.4) CALL pyerrm(9
772  & ,'(PYSLHA:) Inconsistent # of elements in STAUMIX')
773  IF (mspc(8).LT.1) CALL pyerrm(9
774  & ,'(PYSLHA:) Too few elements in HMIX')
775  IF (mspc(10).EQ.0) CALL pyerrm(9
776  & ,'(PYSLHA:) Missing A_b trilinear coupling')
777  IF (mspc(11).EQ.0) CALL pyerrm(9
778  & ,'(PYSLHA:) Missing A_t trilinear coupling')
779  IF (mspc(12).EQ.0) CALL pyerrm(9
780  & ,'(PYSLHA:) Missing A_tau trilinear coupling')
781  IF (mspc(17).LT.1) CALL pyerrm(9
782  & ,'(PYSLHA:) Missing Higgs mixing angle alpha')
783  ENDIF
784 C...Check wavefunction normalizations.
785 C...Sfermions
786  DO 320 ispc=5,7
787  IF (mspc(ispc).EQ.4) THEN
788  kfsm=ispc
789  IF (ispc.EQ.7) kfsm=15
790  check=abs(sfmix(kfsm,1)*sfmix(kfsm,4)-sfmix(kfsm,2)
791  & *sfmix(kfsm,3))
792  IF (abs(1d0-check).GT.1d-3) THEN
793  kcsm=pycomp(kfsm)
794  CALL pyerrm(17
795  & ,'(PYSLHA:) Non-orthonormal mixing matrix for ~'
796  & //chaf(kcsm,1))
797  ENDIF
798  ENDIF
799  320 CONTINUE
800 C...Neutralinos + charginos
801  DO 340 j=1,4
802  cn1=0d0
803  cn2=0d0
804  cu1=0d0
805  cu2=0d0
806  cv1=0d0
807  cv2=0d0
808  DO 330 l=1,4
809  cn1=cn1+zmix(j,l)**2
810  cn2=cn2+zmix(l,j)**2
811  IF (j.LE.2.AND.l.LE.2) THEN
812  cu1=cu1+umix(j,l)**2
813  cu2=cu2+umix(l,j)**2
814  cv1=cv1+vmix(j,l)**2
815  cv2=cv2+vmix(l,j)**2
816  ENDIF
817  330 CONTINUE
818 C...NMIX normalization
819  IF (mspc(2).EQ.16.AND.(abs(1d0-cn1).GT.1d-3.OR.abs(1d0-cn2)
820  & .GT.1d-3).AND.imss(13).EQ.0) THEN
821  CALL pyerrm(19,
822  & '(PYSLHA:) NMIX: Inconsistent normalization.')
823  WRITE(mstu(11),'(7x,I2,1x,":",2(1x,F7.4))') j, cn1, cn2
824  ENDIF
825 C...UMIX, VMIX normalizations
826  IF (mspc(3).EQ.4.OR.mspc(4).EQ.4.AND.imss(13).EQ.0) THEN
827  IF (j.LE.2) THEN
828  IF (abs(1d0-cu1).GT.1d-3.OR.abs(1d0-cu2).GT.1d-3) THEN
829  CALL pyerrm(19
830  & ,'(PYSLHA:) UMIX: Inconsistent normalization.')
831  WRITE(mstu(11),'(7x,I2,1x,":",2(1x,F6.2))') j, cu1,
832  & cu2
833  ENDIF
834  IF (abs(1d0-cv1).GT.1d-3.OR.abs(1d0-cv2).GT.1d-3) THEN
835  CALL pyerrm(19,
836  & '(PYSLHA:) VMIX: Inconsistent normalization.')
837  WRITE(mstu(11),'(7x,I2,1x,":",2(1x,F6.2))') j, cv1,
838  & cv2
839  ENDIF
840  ENDIF
841  ENDIF
842  340 CONTINUE
843  IF (mstu(27).EQ.mstu27.AND.mstu(23).EQ.mstu23) THEN
844  WRITE(mstu(11),'(1x,"*"/1x,A/1x,"*")')
845  & '* PYSLHA: No spectrum inconsistencies were found.'
846  ELSE
847  WRITE(mstu(11),'(1x,"*"/1x,A/1x,"*",A/1x,"*",A/)')
848  & '* (PYSLHA:) INCONSISTENT SPECTRUM WARNING.'
849  & ,'Warning: one or more (serious)'//
850  & ' inconsistencies were found in the spectrum!!!'
851  & ,'Read the error messages above and check your'//
852  & ' input file.'
853  ENDIF
854 C...Increase precision in Higgs sector using FeynHiggs
855  IF (imss(4).EQ.3) THEN
856 C...FeynHiggs needs MSOFT.
857  ierr=0
858  IF (mspc(18).EQ.0) THEN
859  WRITE(mstu(11),'(1x,"*"/1x,A/)')
860  & '* (PYSLHA:) BLOCK MSOFT not found in SLHA file.'//
861  & ' Cannot call FeynHiggs.'
862  ierr=-1
863  ELSE
864  WRITE(mstu(11),'(1x,/1x,A/)')
865  & '* (PYSLHA:) Now calling FeynHiggs.'
866  CALL pyfeyn(ierr)
867  IF (ierr.NE.0) imss(4)=2
868  ENDIF
869  ENDIF
870  ELSEIF (mupda.EQ.2.AND.iretrn.EQ.0) THEN
871  kf=kforig
872  kc=pycomp(kf)
873  WRITE(chkf,8300) kf
874  IF(min(pmas(kc,1),pmas(kc,2),pmas(kc,3),pmas(kc,1)-pmas(kc,3
875  $ ),pmas(kc,4)).LT.0d0.OR.mdcy(kc,3).LT.0.OR.(mdcy(kc,3)
876  $ .EQ.0.AND.mdcy(kc,1).GE.1)) CALL pyerrm(17
877  $ ,'(PYSLHA:) Mass/width/life/(# channels) wrong for KF='
878  $ //chkf)
879  brsum=0d0
880  bropn=0d0
881  DO 360 ida=mdcy(kc,2),mdcy(kc,2)+mdcy(kc,3)-1
882  IF(mdme(ida,2).GT.80) goto 360
883  kq=kchg(kc,1)
884  pms=pmas(kc,1)-pmas(kc,3)-parj(64)
885  merr=0
886  DO 350 j=1,5
887  kp=kfdp(ida,j)
888  IF(kp.EQ.0.OR.kp.EQ.81.OR.iabs(kp).EQ.82) THEN
889  IF(kp.EQ.81) kq=0
890  ELSEIF(pycomp(kp).EQ.0) THEN
891  merr=3
892  ELSE
893  kq=kq-pychge(kp)
894  kpc=pycomp(kp)
895  pms=pms-pmas(kpc,1)
896  IF(mstj(24).GT.0) pms=pms+0.5d0*min(pmas(kpc,2),
897  & pmas(kpc,3))
898  ENDIF
899  350 CONTINUE
900  IF(kq.NE.0) merr=max(2,merr)
901  IF(mwid(kc).EQ.0.AND.kf.NE.311.AND.pms.LT.0d0)
902  & merr=max(1,merr)
903  IF(merr.EQ.3) CALL pyerrm(17,
904  & '(PYSLHA:) Unknown particle code in decay of KF ='
905  $ //chkf)
906  IF(merr.EQ.2) CALL pyerrm(17,
907  & '(PYSLHA:) Charge not conserved in decay of KF ='
908  $ //chkf)
909  IF(merr.EQ.1) CALL pyerrm(7,
910  & '(PYSLHA:) Kinematically unallowed decay of KF ='
911  $ //chkf)
912  brsum=brsum+brat(ida)
913  IF (mdme(ida,1).GT.0) bropn=bropn+brat(ida)
914  360 CONTINUE
915 C...Check branching ratio sum.
916  IF (bropn.LE.0d0) THEN
917 C...If zero, set stable.
918  WRITE(chtmp,8500) bropn
919  CALL pyerrm(7
920  & ,"(PYSLHA:) Effective BR sum for KF="//chkf//' is '//
921  & chtmp(9:16)//'. Changed to stable.')
922  pmas(kc,2)=1d-6
923  mwid(kc)=0
924 C...If BR's > 1, rescale.
925  ELSEIF (brsum.GT.(1d0+1d-6)) THEN
926  WRITE(chtmp,8500) brsum
927  CALL pyerrm(7
928  & ,"(PYSLHA:) Forced rescaling of BR's for KF="//chkf//
929  & ' ; sum was'//chtmp(9:16)//'.')
930  fac=1d0/brsum
931  DO 370 ida=mdcy(kc,2),mdcy(kc,2)+mdcy(kc,3)-1
932  IF(mdme(ida,2).GT.80) goto 370
933  brat(ida)=fac*brat(ida)
934  370 CONTINUE
935  ELSEIF (brsum.LT.(1d0-1d-6)) THEN
936 C...If BR's < 1, insert dummy mode for proper cross section rescaling.
937  WRITE(chtmp,8500) brsum
938  CALL pyerrm(7
939  & ,"(PYSLHA:) Sum of BR's for KF="//chkf//' is '//
940  & chtmp(9:16)//'. Dummy mode will be inserted.')
941 C... Insert dummy mode
942  mdcy(kc,3)=mdcy(kc,3)+1
943  ida=mdcy(kc,2)+mdcy(kc,3)-1
944  brat(ida)=1d0-brsum
945  kfdp(ida,1)=0
946  kfdp(ida,2)=0
947  kfdp(ida,3)=0
948  kfdp(ida,4)=0
949  kfdp(ida,5)=0
950  mdme(ida,1)=0
951  brsum=1d0
952  ENDIF
953  ENDIF
954 
955 C...WRITE SPECTRUM ON SLHA FILE
956  ELSEIF(mupda.EQ.3) THEN
957 C...If SPYTHIA or ISASUSY runtime was called for SUGRA, update PARMIN.
958  IF (imss(1).EQ.2.OR.imss(1).EQ.12) THEN
959  modsel(1)=1
960  parmin(1)=rmss(8)
961  parmin(2)=rmss(1)
962  parmin(3)=rmss(5)
963  parmin(4)=sign(1d0,rmss(4))
964  parmin(5)=rmss(36)
965  ENDIF
966 C...Write spectrum
967  WRITE(lfn,7000) 'SLHA MSSM spectrum'
968  WRITE(lfn,7000) 'Pythia 6.4: T. Sjostrand, S. Mrenna,'
969  & // ' P. Skands.'
970  WRITE(lfn,7010) 'MODSEL', 'Model selection'
971  WRITE(lfn,7110) 1, modsel(1)
972  WRITE(lfn,7010) 'MINPAR', 'Parameters for minimal model.'
973  IF (modsel(1).EQ.1) THEN
974  WRITE(lfn,7210) 1, parmin(1), 'm0'
975  WRITE(lfn,7210) 2, parmin(2), 'm12'
976  WRITE(lfn,7210) 3, parmin(3), 'tan(beta)'
977  WRITE(lfn,7210) 4, parmin(4), 'sign(mu)'
978  WRITE(lfn,7210) 5, parmin(5), 'a0'
979  ELSEIF(modsel(2).EQ.2) THEN
980  WRITE(lfn,7210) 1, parmin(1), 'Lambda'
981  WRITE(lfn,7210) 2, parmin(2), 'M'
982  WRITE(lfn,7210) 3, parmin(3), 'tan(beta)'
983  WRITE(lfn,7210) 4, parmin(4), 'sign(mu)'
984  WRITE(lfn,7210) 5, parmin(5), 'N5'
985  WRITE(lfn,7210) 6, parmin(6), 'c_grav'
986  ENDIF
987  WRITE(lfn,7000) ' '
988  WRITE(lfn,7010) 'MASS', 'Mass spectrum'
989  DO 380 i=1,36
990  kf=kfsusy(i)
991  kc=pycomp(kf)
992  IF (kf.EQ.1000039.AND.modsel(1).NE.2) goto 380
993  kfsm=kf-ksusy1
994  IF (kfsm.GE.22.AND.kfsm.LE.37) THEN
995  IF (kfsm.EQ.22) WRITE(lfn,7220) kf, smz(1), chaf(kc,1)
996  IF (kfsm.EQ.23) WRITE(lfn,7220) kf, smz(2), chaf(kc,1)
997  IF (kfsm.EQ.25) WRITE(lfn,7220) kf, smz(3), chaf(kc,1)
998  IF (kfsm.EQ.35) WRITE(lfn,7220) kf, smz(4), chaf(kc,1)
999  IF (kfsm.EQ.24) WRITE(lfn,7220) kf, smw(1), chaf(kc,1)
1000  IF (kfsm.EQ.37) WRITE(lfn,7220) kf, smw(2), chaf(kc,1)
1001  ELSE
1002  WRITE(lfn,7220) kf, pmas(kc,1), chaf(kc,1)
1003  ENDIF
1004  380 CONTINUE
1005 C...SUSY scale
1006  rmsusy=sqrt(pmas(pycomp(ksusy1+6),1)*pmas(pycomp(ksusy2+6),1))
1007  WRITE(lfn,7020) 'HMIX',rmsusy,'Higgs parameters'
1008  WRITE(lfn,7210) 1, rmss(4),'mu'
1009  WRITE(lfn,7010) 'ALPHA',' '
1010  WRITE(lfn,7210) 1, rmss(18), 'alpha'
1011  WRITE(lfn,7020) 'AU',rmsusy
1012  WRITE(lfn,7410) 3, 3, rmss(16), 'A_t'
1013  WRITE(lfn,7020) 'AD',rmsusy
1014  WRITE(lfn,7410) 3, 3, rmss(15), 'A_b'
1015  WRITE(lfn,7020) 'AE',rmsusy
1016  WRITE(lfn,7410) 3, 3, rmss(17), 'A_tau'
1017  WRITE(lfn,7010) 'STOPMIX','~t mixing matrix'
1018  WRITE(lfn,7410) 1, 1, sfmix(6,1)
1019  WRITE(lfn,7410) 1, 2, sfmix(6,2)
1020  WRITE(lfn,7410) 2, 1, sfmix(6,3)
1021  WRITE(lfn,7410) 2, 2, sfmix(6,4)
1022  WRITE(lfn,7010) 'SBOTMIX','~b mixing matrix'
1023  WRITE(lfn,7410) 1, 1, sfmix(5,1)
1024  WRITE(lfn,7410) 1, 2, sfmix(5,2)
1025  WRITE(lfn,7410) 2, 1, sfmix(5,3)
1026  WRITE(lfn,7410) 2, 2, sfmix(5,4)
1027  WRITE(lfn,7010) 'STAUMIX','~tau mixing matrix'
1028  WRITE(lfn,7410) 1, 1, sfmix(15,1)
1029  WRITE(lfn,7410) 1, 2, sfmix(15,2)
1030  WRITE(lfn,7410) 2, 1, sfmix(15,3)
1031  WRITE(lfn,7410) 2, 2, sfmix(15,4)
1032  WRITE(lfn,7010) 'NMIX','~chi0 mixing matrix'
1033  DO 400 i1=1,4
1034  DO 390 i2=1,4
1035  WRITE(lfn,7410) i1, i2, zmix(i1,i2)
1036  390 CONTINUE
1037  400 CONTINUE
1038  WRITE(lfn,7010) 'UMIX','~chi^+ U mixing matrix'
1039  DO 420 i1=1,2
1040  DO 410 i2=1,2
1041  WRITE(lfn,7410) i1, i2, umix(i1,i2)
1042  410 CONTINUE
1043  420 CONTINUE
1044  WRITE(lfn,7010) 'VMIX','~chi^+ V mixing matrix'
1045  DO 440 i1=1,2
1046  DO 430 i2=1,2
1047  WRITE(lfn,7410) i1, i2, vmix(i1,i2)
1048  430 CONTINUE
1049  440 CONTINUE
1050  WRITE(lfn,7010) 'SPINFO'
1051  IF (imss(1).EQ.2) THEN
1052  cpro(1)='PYTHIA'
1053  cver(1)='6.4'
1054  ELSEIF (imss(1).EQ.12) THEN
1055  isaver=visaje()
1056  cpro(1)='ISASUSY'
1057  cver(1)=isaver(1:12)
1058  ENDIF
1059  WRITE(lfn,7310) 1, cpro(1), 'Spectrum Calculator'
1060  WRITE(lfn,7310) 2, cver(1), 'Version number'
1061  ENDIF
1062 
1063 C...Print user information about spectrum
1064  IF (mupda.EQ.1.OR.mupda.EQ.3) THEN
1065  IF (cpro(mod(mupda,2)).NE.' '.AND.cver(mod(mupda,2)).NE.' ')
1066  & WRITE(mstu(11),5030) cpro(1), cver(1)
1067  IF (imss(4).EQ.3) WRITE(mstu(11),5040)
1068  IF (mupda.EQ.1) THEN
1069  WRITE(mstu(11),5020) lfn
1070  ELSE
1071  WRITE(mstu(11),5010) lfn
1072  ENDIF
1073 
1074  WRITE(mstu(11),5400)
1075  WRITE(mstu(11),5500) 'Pole masses'
1076  WRITE(mstu(11),5700) (rmfun(ksusy1+ip),ip=1,6)
1077  $ ,(rmfun(ksusy2+ip),ip=1,6)
1078  WRITE(mstu(11),5800) (rmfun(ksusy1+ip),ip=11,16)
1079  $ ,(rmfun(ksusy2+ip),ip=11,16)
1080  IF (imss(13).EQ.0) THEN
1081  WRITE(mstu(11),5900) rmfun(ksusy1+21),rmfun(ksusy1+22)
1082  $ ,rmfun(ksusy1+23),rmfun(ksusy1+25),rmfun(ksusy1+35),
1083  $ rmfun(ksusy1+24),rmfun(ksusy1+37)
1084  WRITE(mstu(11),6000) chaf(25,1),chaf(35,1),chaf(36,1),
1085  & chaf(37,1), ' ', ' ',' ',' ',
1086  & rmfun(25), rmfun(35), rmfun(36), rmfun(37)
1087  ELSEIF (imss(13).EQ.1) THEN
1088  kf1=ksusy1+21
1089  kf2=ksusy1+22
1090  kf3=ksusy1+23
1091  kf4=ksusy1+25
1092  kf5=ksusy1+35
1093  kf6=ksusy1+45
1094  kf7=ksusy1+24
1095  kf8=ksusy1+37
1096  WRITE(mstu(11),6000) chaf(pycomp(kf1),1),chaf(pycomp(kf2),1),
1097  & chaf(pycomp(kf3),1),chaf(pycomp(kf4),1),
1098  & chaf(pycomp(kf5),1),chaf(pycomp(kf6),1),
1099  & chaf(pycomp(kf7),1),chaf(pycomp(kf8),1),
1100  & rmfun(kf1),rmfun(kf2),rmfun(kf3),rmfun(kf4),
1101  & rmfun(kf5),rmfun(kf6),rmfun(kf7),rmfun(kf8)
1102  WRITE(mstu(11),6000) chaf(25,1), chaf(35,1), chaf(45,1),
1103  & chaf(36,1), chaf(46,1), chaf(37,1),' ',' ',
1104  & rmfun(25), rmfun(35), rmfun(45), rmfun(36), rmfun(46),
1105  & rmfun(37)
1106  ENDIF
1107  WRITE(mstu(11),5400)
1108  WRITE(mstu(11),5500) 'Mixing structure'
1109  WRITE(mstu(11),6100) ((zmix(i,j), j=1,4),i=1,4)
1110  WRITE(mstu(11),6200) (umix(1,j), j=1,2),(vmix(1,j),j=1,2)
1111  & ,(umix(2,j), j=1,2),(vmix(2,j),j=1,2)
1112  WRITE(mstu(11),6300) (sfmix(5,j), j=1,2),(sfmix(6,j),j=1,2)
1113  & ,(sfmix(15,j), j=1,2),(sfmix(5,j),j=3,4),(sfmix(6,j), j=3,4
1114  & ),(sfmix(15,j),j=3,4)
1115  WRITE(mstu(11),5400)
1116  WRITE(mstu(11),5500) 'Couplings'
1117  WRITE(mstu(11),6400) rmss(15),rmss(16),rmss(17)
1118  WRITE(mstu(11),6450) rmss(18), rmss(5), rmss(4)
1119  WRITE(mstu(11),5400)
1120  WRITE(mstu(11),6500)
1121 
1122  ENDIF
1123 
1124 C...Only rewind when reading
1125  IF (mupda.LE.2.OR.mupda.EQ.5) rewind(lfn)
1126 
1127  9999 RETURN
1128 
1129 C...Serious error catching
1130  460 write(*,*) '* (PYSLHA:) read BLOCK error on line',nline
1131  write(*,*) chinl(1:80)
1132  CALL pystop(106)
1133  470 WRITE(*,*) '* (PYSLHA:) read DECAY error on line',nline
1134  WRITE(*,*) chinl(1:72)
1135  CALL pystop(106)
1136  480 WRITE(*,*) '* (PYSLHA:) read BR error on line',nline
1137  WRITE(*,*) chinl(1:80)
1138  CALL pystop(106)
1139  490 WRITE(*,*) '* (PYSLHA:) read NDA error on line',nline
1140  WRITE(*,*) chinl(1:80)
1141  CALL pystop(106)
1142  500 WRITE(*,*) '* (PYSLHA:) decay daughter read error on line',nline
1143  WRITE(*,*) chinl(1:80)
1144  510 WRITE(*,*) '* (PYSLHA:) read Q error in BLOCK ',chblck
1145  CALL pystop(106)
1146  520 WRITE(*,*) '* (PYSLHA:) read error in line ',nline,':'
1147  WRITE(*,*) chinl(1:80)
1148  CALL pystop(106)
1149 
1150  8300 FORMAT(i9)
1151  8500 FORMAT(f16.5)
1152 
1153 C...Formats for user information printout.
1154  5000 FORMAT(1x,15('*'),1x,'PYSLHA v1.09: SUSY/BSM SPECTRUM '
1155  & ,'INTERFACE',1x,15('*')/1x,'*',2x
1156  & ,'PYSLHA: Last Change',1x,a,1x,'-',1x,'P.Z. Skands')
1157  5010 FORMAT(1x,'*',3x,'Wrote spectrum file on unit: ',i3)
1158  5020 FORMAT(1x,'*',3x,'Read spectrum file on unit: ',i3)
1159  5030 FORMAT(1x,'*',3x,'Spectrum Calculator was: ',a,' version ',a)
1160  5040 FORMAT(1x,'*',3x,'Higgs sector corrected with FeynHiggs')
1161  5100 FORMAT(1x,'*',1x,'Model parameters:'/1x,'*',1x,'----------------')
1162  5200 FORMAT(1x,'*',1x,3x,'M_0',6x,'M_1/2',5x,'A_0',3x,'Tan(beta)',
1163  & 3x,'Sgn(mu)',3x,'M_t'/1x,'*',1x,4(f8.2,1x),i8,2x,f8.2)
1164  5300 FORMAT(1x,'*'/1x,'*',1x,'Model spectrum :'/1x,'*',1x
1165  & ,'----------------')
1166  5400 FORMAT(1x,'*',1x,a)
1167  5500 FORMAT(1x,'*',1x,a,':')
1168  5600 FORMAT(1x,'*',2x,2x,'M_GUT',2x,2x,'g_GUT',2x,1x,'alpha_GUT'/
1169  & 1x,'*',2x,1p,2(1x,e8.2),2x,e8.2)
1170  5700 FORMAT(1x,'*',4x,4x,'~d',2x,1x,4x,'~u',2x,1x,4x,'~s',2x,1x,
1171  & 4x,'~c',2x,1x,1x,'~b(12)',1x,1x,1x,'~t(12)'/1x,'*',2x,'L',1x
1172  & ,6(f8.2,1x)/1x,'*',2x,'R',1x,6(f8.2,1x))
1173  5800 FORMAT(1x,'*'/1x,'*',4x,4x,'~e',2x,1x,2x,'~nu_e',2x,1x,3x,'~mu',2x
1174  & ,1x,1x,'~nu_mu',1x,1x,'~tau(12)',1x,1x,'~nu_tau'/1x,'*',2x
1175  & ,'L',1x,6(f8.2,1x)/1x,'*',2x,'R',1x,6(f8.2,1x))
1176  5900 FORMAT(1x,'*'/1x,'*',4x,4x,'~g',2x,1x,1x,'~chi_10',1x,1x,'~chi_20'
1177  & ,1x,1x,'~chi_30',1x,1x,'~chi_40',1x,1x,'~chi_1+',1x
1178  & ,1x,'~chi_2+'/1x,'*',3x,1x,7(f8.2,1x))
1179  6000 FORMAT(1x,'*'/1x,'*',3x,1x,8(1x,a7,1x)/1x,'*',3x,1x,8(f8.2,1x))
1180  6100 FORMAT(1x,'*',11x,'|',3x,'~B',3x,'|',2x,'~W_3',2x,'|',2x
1181  & ,'~H_1',2x,'|',2x,'~H_2',2x,'|'/1x,'*',3x,'~chi_10',1x,4('|'
1182  & ,1x,f6.3,1x),'|'/1x,'*',3x,'~chi_20',1x,4('|'
1183  & ,1x,f6.3,1x),'|'/1x,'*',3x,'~chi_30',1x,4('|'
1184  & ,1x,f6.3,1x),'|'/1x,'*',3x,'~chi_40',1x,4('|'
1185  & ,1x,f6.3,1x),'|')
1186  6200 FORMAT(1x,'*'/1x,'*',6x,'L',4x,'|',3x,'~W',3x,'|',3x,'~H',3x,'|'
1187  & ,12x,'R',4x,'|',3x,'~W',3x,'|',3x,'~H',3x,'|'/1x,'*',3x
1188  & ,'~chi_1+',1x,2('|',1x,f6.3,1x),'|',9x,'~chi_1+',1x,2('|',1x
1189  & ,f6.3,1x),'|'/1x,'*',3x,'~chi_2+',1x,2('|',1x,f6.3,1x),'|',9x
1190  & ,'~chi_2+',1x,2('|',1x,f6.3,1x),'|')
1191  6300 FORMAT(1x,'*'/1x,'*',8x,'|',2x,'~b_L',2x,'|',2x,'~b_R',2x,'|',8x
1192  & ,'|',2x,'~t_L',2x,'|',2x,'~t_R',2x,'|',10x
1193  & ,'|',1x,'~tau_L',1x,'|',1x,'~tau_R',1x,'|'/
1194  & 1x,'*',3x,'~b_1',1x,2('|',1x,f6.3,1x),'|',3x,'~t_1',1x,2('|'
1195  & ,1x,f6.3,1x),'|',3x,'~tau_1',1x,2('|',1x,f6.3,1x),'|'/
1196  & 1x,'*',3x,'~b_2',1x,2('|',1x,f6.3,1x),'|',3x,'~t_2',1x,2('|'
1197  & ,1x,f6.3,1x),'|',3x,'~tau_2',1x,2('|',1x,f6.3,1x),'|')
1198  6400 FORMAT(1x,'*',3x,' A_b = ',f8.2,4x,' A_t = ',f8.2,4x
1199  & ,'A_tau = ',f8.2)
1200  6450 FORMAT(1x,'*',3x,'alpha = ',f8.2,4x,'tan(beta) = ',f8.2,4x
1201  & ,' mu = ',f8.2)
1202  6500 FORMAT(1x,32('*'),1x,'END OF PYSLHA',1x,31('*'))
1203 
1204 C...Format to use for comments
1205  7000 FORMAT('# ',a)
1206 C...Format to use for block statements
1207  7010 FORMAT('Block',1x,a,3x,'#',1x,a)
1208  7020 FORMAT('Block',1x,a,1x,'Q=',1p,e16.8,0p,3x,'#',1x,a)
1209 C...Indexed Int
1210  7110 FORMAT(1x,i4,1x,i4,3x,'#')
1211 C...Non-Indexed Double
1212  7200 FORMAT(9x,1p,e16.8,0p,3x,'#',1x,a)
1213 C...Indexed Double
1214  7210 FORMAT(1x,i4,3x,1p,e16.8,0p,3x,'#',1x,a)
1215 C...Long Indexed Double (PDG + double)
1216  7220 FORMAT(1x,i9,3x,1p,e16.8,0p,3x,'#',1x,a)
1217 C...Indexed Char(12)
1218  7310 FORMAT(1x,i4,3x,a12,3x,'#',1x,a)
1219 C...Single matrix
1220  7410 FORMAT(1x,i2,1x,i2,3x,1p,e16.8,0p,3x,'#',1x,a)
1221 C...Double Matrix
1222  7420 FORMAT(1x,i2,1x,i2,3x,1p,e16.8,3x,e16.8,0p,3x,'#',1x,a)
1223 C...Write Decay Table
1224  7500 FORMAT('Decay',1x,i9,1x,'WIDTH=',1p,e16.8,0p,3x,'#',1x,a)
1225  7510 FORMAT(4x,1p,e16.8,0p,3x,i2,3x,'IDA=',1x,5(1x,i9),3x,'#',1x,a)
1226 
1227  END