1
c************************************************************************
3
c** MadGraph/MadEvent Interface to FeynRules **
5
c** C. Duhr (Louvain U.) - M. Herquet (NIKHEF) **
7
c************************************************************************
9
c *************************************************************************
11
c ** LHA format reading routines **
13
c *************************************************************************
16
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18
c ++ LHA_islatin -> islatin=true if letter is a latin letter
20
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22
subroutine LHA_islatin(letter,islatin)
31
if(i.ge.65.and.i.le. 90) islatin=.true.
32
if(i.ge.97.and.i.le.122) islatin=.true.
36
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38
c ++ LHA_isnum -> isnum=true if letter is a number
40
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
42
subroutine LHA_isnum(letter,isnum)
54
if(letter .eq. ref(i:i)) isnum=.true.
59
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61
c ++ LHA_firststring -> first is the first "word" of string
62
c ++ Warning: string is returned with first REMOVED!
64
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66
subroutine LHA_firststring(first,string)
72
if(len_trim(string).le.0) return
74
do while(string(1:1) .eq. ' ')
75
string=string(2:len(string))
77
if (index(string,' ').gt.1) then
78
first=string(1:index(string,' ')-1)
79
string=string(index(string,' '):len(string))
87
subroutine LHA_case_trap(name)
88
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
90
c ++ LHA_case_trap -> change string to lower case
92
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
100
if(k.ge.65.and.k.le.90) then !upper case A-Z
101
k=ichar(name(i:i))+32
109
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
111
c ++ LHA_blockread -> read a LHA line and return parameter name (evntually found in
112
c ++ a ref file) and value
114
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
116
subroutine LHA_blockread(blockname,buff,par,val,found)
119
character*132 buff,buffer,curr_ref,curr_buff
120
character*20 blockname,val,par,temp,first_ref,first_line
123
logical islast,isnum,found
124
character*20 temp_val
127
c *********************************************************************
128
c Try to find a correspondance in ident_card
131
call LHA_open_file(ref_file,'ident_card.dat',fopened)
132
if(.not. fopened) goto 99 ! If the file does not exist -> no matter, use default!
136
do while(.not. found)!run over reference file
140
read(ref_file,'(a132)',end=98,err=98) buffer
142
! Seek a corresponding blockname
143
call LHA_firststring(temp,buffer)
144
call LHA_case_trap(temp)
146
if(temp .eq. blockname) then
147
! Seek for a corresponding LHA code
153
do while((.not. islast).and.(first_ref .eq. first_line))
154
call LHA_firststring(first_ref,curr_ref)
155
call LHA_firststring(first_line,curr_buff)
156
call LHA_islatin(first_ref(1:1),islast)
159
val=first_line ! If found set param name & value
171
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
173
c ++ LHA_loadcard -> Open a LHA file and load all model param in a table
175
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
177
subroutine LHA_loadcard(param_name,npara,param,value)
182
parameter (maxpara=1000)
183
character*20 param(maxpara),value(maxpara),val,par
184
character*20 blockname
186
logical fopened,found
187
integer iunit,GL,logfile
192
character*(*) param_name
201
! Try to open param-card file
202
call LHA_open_file(iunit,param_name,fopened)
203
if(.not.fopened) then
204
write(*,*) 'Error: Could not open file',param_name
209
! Try to open log file
210
open (unit = logfile, file = "param.log")
215
read(iunit,'(a132)',end=99,err=99) buff
217
if(buff .ne. '' .and. buff(1:1) .ne.'#') then ! Skip comments and empty lines
220
call LHA_case_trap(tag) ! Select decay/block tag
221
if(tag .eq. 'block') then ! If we are in a block, get the blockname
223
call LHA_firststring(blockname,temp)
224
call LHA_case_trap(blockname)
225
else if (tag .eq. 'decay') then ! If we are in a decay, directly try to get back the correct name/value pair
228
call LHA_blockread(blockname,temp,par,val,found)
230
else if ((tag .eq. 'qnumbers').or.(blockname.eq.'')) then! if qnumbers or empty tag do nothing
232
else ! If we are in valid block, try to get back a name/value pair
233
call LHA_blockread(blockname,buff,par,val,found)
237
!if LHA_blockread has been called, record name and value
242
call LHA_case_trap(ctemp)
246
write (logfile,*) 'Parameter ',ctemp,
247
& ' has been read with value ',val
263
subroutine LHA_get_real(npara,param,value,name,var,def_value_num)
264
c----------------------------------------------------------------------------------
265
c finds the parameter named "name" in param and associate to "value" in value
266
c----------------------------------------------------------------------------------
273
parameter (maxpara=1000)
278
character*20 param(maxpara),value(maxpara)
280
real*8 var,def_value_num
281
character*20 c_param,c_name,ctemp
282
character*19 def_value
293
do while(.not.found.and.i.le.npara)
295
call LHA_firststring(c_param,ctemp)
297
call LHA_firststring(c_name,ctemp)
298
call LHA_case_trap(c_name)
299
call LHA_case_trap(c_param)
300
found = (c_param .eq. c_name)
307
write (*,*) "Warning: parameter ",name," not found"
308
write (*,*) " setting it to default value ",
317
subroutine LHA_open_file(lun,filename,fopened)
318
c***********************************************************************
319
c ����opens file input-card.dat in current directory or above
320
c***********************************************************************
327
character*(*) filename
328
character*90 tempname
336
c ����first check that we will end in the main directory
338
open(unit=lun,file=filename,status='old',ERR=20)
339
c write(*,*) 'read model file ',filename
344
fine=index(tempname,' ')
345
if(fine.eq.0) fine=len(tempname)
346
tempname=tempname(1:fine)
348
c ��������if I have to read a card
350
if(index(filename,"_card").gt.0) then
351
tempname='./Cards/'//tempname
356
open(unit=lun,file=tempname,status='old',ERR=30)
358
c write(*,*) 'read model file ',tempname
360
30 tempname='../'//tempname
362
write(*,*) 'Warning: file ',filename,
363
& ' not found in the parent directories!'