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
ref='abcdefghijklmnopqrstuvwxyz'
33
call LHA_case_trap(letter)
36
if(letter .eq. ref(i:i)) islatin=.true.
41
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
43
c ++ LHA_isnum -> isnum=true if letter is a number
45
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
47
subroutine LHA_isnum(letter,isnum)
59
if(letter .eq. ref(i:i)) isnum=.true.
64
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66
c ++ LHA_firststring -> first is the first "word" of string
67
c ++ Warning: string is returned with first REMOVED!
69
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71
subroutine LHA_firststring(first,string)
77
if(len_trim(string).le.0) return
79
do while(string(1:1) .eq. ' ')
80
string=string(2:len(string))
82
if (index(string,' ').gt.1) then
83
first=string(1:index(string,' ')-1)
84
string=string(index(string,' '):len(string))
92
subroutine LHA_case_trap(name)
93
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
95
c ++ LHA_case_trap -> change string to lower case
97
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105
if(k.ge.65.and.k.le.90) then !upper case A-Z
106
k=ichar(name(i:i))+32
114
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
116
c ++ LHA_blockread -> read a LHA line and return parameter name (evntually found in
117
c ++ a ref file) and value
119
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
121
subroutine LHA_blockread(blockname,buff,par,val,found)
124
character*132 buff,buffer,curr_ref,curr_buff
125
character*20 blockname,val,par,temp,first_ref,first_line
128
logical islast,isnum,found
129
character*20 temp_val
132
c *********************************************************************
133
c Try to find a correspondance in ident_card
136
call LHA_open_file(ref_file,'ident_card.dat',fopened)
137
if(.not. fopened) goto 99 ! If the file does not exist -> no matter, use default!
141
do while(.not. found)!run over reference file
145
read(ref_file,'(a132)',end=99,err=99) buffer
147
! Seek a corresponding blockname
148
call LHA_firststring(temp,buffer)
149
call LHA_case_trap(temp)
151
if(temp .eq. blockname) then
152
! Seek for a corresponding LHA code
158
do while((.not. islast).and.(first_ref .eq. first_line))
159
call LHA_firststring(first_ref,curr_ref)
160
call LHA_firststring(first_line,curr_buff)
161
call LHA_islatin(first_ref(1:1),islast)
164
val=first_line ! If found set param name & value
176
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
178
c ++ LHA_loadcard -> Open a LHA file and load all model param in a table
180
c +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
182
subroutine LHA_loadcard(param_name,npara,param,value)
187
parameter (maxpara=1000)
188
character*20 param(maxpara),value(maxpara),val,par
189
character*20 blockname
191
logical fopened,found
192
integer iunit,GL,logfile
197
character*(*) param_name
206
! Try to open param-card file
207
call LHA_open_file(iunit,param_name,fopened)
208
if(.not.fopened) then
209
print *,'Error: Could not open file',param_name
214
! Try to open log file
215
open (unit = logfile, file = "param.log")
220
read(iunit,'(a132)',end=99,err=99) buff
222
if(buff(1:1) .ne.'#') then ! Skip comments and empty lines
225
call LHA_case_trap(tag) ! Select decay/block tag
226
if(tag .eq. 'block') then ! If we are in a block, get the blockname
228
call LHA_firststring(blockname,temp)
229
call LHA_case_trap(blockname)
230
else if (tag .eq. 'decay') then ! If we are in a decay, directly try to get back the correct name/value pair
233
call LHA_blockread(blockname,temp,par,val,found)
235
else if ((tag .eq. 'qnumbers').or.(tag.eq.'')) then! if qnumbers or empty tag do nothing
237
else ! If we are in valid block, try to get back a name/value pair
238
call LHA_blockread(blockname,buff,par,val,found)
242
!if LHA_blockread has been called, record name and value
247
call LHA_case_trap(ctemp)
251
write (logfile,*) 'Parameter ',ctemp,' has been read with value ',val
267
subroutine LHA_get_real(npara,param,value,name,var,def_value_num)
268
c----------------------------------------------------------------------------------
269
c finds the parameter named "name" in param and associate to "value" in value
270
c----------------------------------------------------------------------------------
277
parameter (maxpara=1000)
282
character*20 param(maxpara),value(maxpara)
284
real*8 var,def_value_num
285
character*20 c_param,c_name,ctemp
286
character*19 def_value
297
do while(.not.found.and.i.le.npara)
299
call LHA_firststring(c_param,ctemp)
301
call LHA_firststring(c_name,ctemp)
302
call LHA_case_trap(c_name)
303
call LHA_case_trap(c_param)
304
found = (c_param .eq. c_name)
311
write (*,*) "Warning: parameter ",name," not found"
312
write (*,*) " setting it to default value ",def_value_num
323
subroutine LHA_open_file(lun,filename,fopened)
324
c***********************************************************************
325
c ����opens file input-card.dat in current directory or above
326
c***********************************************************************
333
character*(*) filename
334
character*90 tempname
342
c ����first check that we will end in the main directory
344
open(unit=lun,file=filename,status='old',ERR=20)
345
c write(*,*) 'read model file ',filename
350
fine=index(tempname,' ')
351
if(fine.eq.0) fine=len(tempname)
352
tempname=tempname(1:fine)
354
c ��������if I have to read a card
356
if(index(filename,"_card").gt.0) then
357
tempname='./Cards/'//tempname
362
open(unit=lun,file=tempname,status='old',ERR=30)
364
c write(*,*) 'read model file ',tempname
366
30 tempname='../'//tempname
368
write(*,*) 'Warning: file ',filename,' not found in the parent directories!'