4 ! Initialize a PDF set, determining the path to the PDF set directory automatically
5 ! subroutine InitPDFsetByCodes(code1, code2, code3)
6 ! write(*,*) "Not implemented yet: this will move the 'glue' interface to ", &
7 ! "LHAPDF proper and use the InitPDFsetByName function to ", &
8 ! "get the path automatically."
10 ! end subroutine InitPDFsetByCodes
14 ! Initialize a PDF set, determining the path to the PDF set
15 ! directory automatically
16 subroutine InitPDFsetByName(setname)
22 call InitPDFsetByNameM(nset,setname)
24 end subroutine InitPDFsetByName
28 ! Initialize a PDF set, determining the path to the PDF set
29 ! directory automatically
30 subroutine InitPDFsetByNameM(nset,setname)
32 include 'parmsetup.inc'
33 include 'commonlhapdfc.inc'
34 include 'commonlhacontrol.inc'
37 character*512 dirpath, setpath
40 ! Initialise common blocks
43 ! Find the directory with the PDFsets
44 call getdirpath(dirpath)
46 ! Now build the path to the PDF set
47 setpath = dirpath(:len_trim(dirpath)) // "/" // setname(:len_trim(setname))
49 ! Initialize using the detected PDF set
50 call InitPDFsetM(nset, setpath(:len_trim(setpath)))
52 end subroutine InitPDFsetByNameM
56 subroutine InitPDFset(setpath)
62 call InitPDFsetM(nset,setpath)
64 end subroutine InitPDFset
67 subroutine InitLHAPDF()
69 end subroutine InitLHAPDF
72 subroutine InitPDFsetM(nset,setpath)
74 include 'parmsetup.inc'
75 include 'commonlhacontrol.inc'
77 character*512 inputfile
80 character*10 lhaversion
81 integer id,token,Ctoken
83 save lhaonce,inputfile
86 common/lhasilent/lhasilent
89 ! Initialise common blocks
91 call getlhapdfversion(lhaversion)
95 if (lhaparm(19).eq.'SILENT') then
97 elseif (lhaparm(19).eq.'LOWKEY') then
98 if (lhaonce .eq. 0) then
107 open(unit=1,file=setpath,status='old',action='read')
109 open(unit=1,file=setpath,status='old')
112 if (( index(s2,'1.0').ne.1) &
113 .and.(index(s2,'1.1').ne.1) &
114 .and.(index(s2,'2.0').ne.1) &
115 .and.(index(s2,'2.1').ne.1) &
116 .and.(index(s2,'3.0').ne.1) &
117 .and.(index(s2,'3.1').ne.1) &
118 .and.(index(s2,'4.0').ne.1) &
119 .and.(index(s2,'5.0').ne.1) &
120 .and.(index(s2,'5.3').ne.1) &
121 .and.(index(s2,'5.4').ne.1) &
122 .and.(index(s2,'5.5').ne.1)) then
123 write(*,*) 'Version ',s2,' not supported by this version of LHAPDF'
126 if (lhasilent.eq.0) then
127 write(*,*) '*************************************'
128 write(*,*) '* LHAPDF Version ',lhaversion,' *'
129 write(*,*) '*************************************'
136 ! print *,'id = ',id,string
138 write(*,*) 'File description error:'
139 write(*,*) 'Command not understood: ',string
142 if (id.eq.1) call descriptionPDF(nset,id)
144 if (id.eq.2) call initEvolve(nset)
146 if (id.eq.3) call initAlphasPDF(nset)
148 if (id.eq.4) call initInputPDF(nset)
150 if (id.eq.5) call initListPDF(nset)
152 if (id.eq.6) call initQCDparams(nset)
154 if (id.eq.7) call initMinMax(nset)
158 ! print *,'calling InitEvolveCode',nset
159 call InitEvolveCode(nset)
161 ! Initialize the default member 0
162 call InitPDFM(nset,0)
165 entry getsetpath(setpath)
169 end subroutine InitPDFsetM
173 integer function token(s)
179 data t/'Description:','Evolution:','Alphas:', 'Parametrization:', &
180 'Parameterlist:','QCDparams:','MinMax:','End:'/
186 if (s.eq.t(i)) token=i
189 count(token)=count(token)+1
190 if (count(token).eq.2) then
191 write(*,*) 'File description error:'
192 write(*,*) 'Second definition of entry: ',s
208 subroutine LHAprint(iprint)
210 include 'commonlhacontrol.inc'
211 integer lhasilent,iprint
212 common/lhasilent/lhasilent
215 ! If using stream #6, don't silence!
216 if(iprint.ne.6) lhaparm(19)='SILENT'
218 end subroutine LHAprint
222 subroutine setPDFpath(pathname)
224 include 'commonlhapdfc.inc'
225 include 'commonlhacontrol.inc'
226 include 'parmsetup.inc'
227 character*(*) pathname
232 lhaparm(20) = 'LHAPATH'
233 do j=1,len_trim(lhapath)
238 end subroutine setPDFpath
242 subroutine lhaset(lhaparm2,lhavalue2)
244 include 'commonlhacontrol.inc'
245 character*20 lhaparm2(20)
246 double precision lhavalue2(20)
251 lhaparm(j)=lhaparm2(j)
252 lhavalue(j)=lhavalue2(j)
255 end subroutine lhaset
259 subroutine setlhaparm(lparm)
261 include 'commonlhacontrol.inc'
267 if(lparm.eq.'EKS98') then
269 else if(lparm.eq.'EPS08') then
271 else if(lparm.eq.'15') then
273 else if(lparm.eq.'NOSTAT') then
275 else if (lparm.eq.'16') then
277 else if (lparm.eq.'LHAPDF') then
279 else if (lparm.eq.'17') then
281 else if (lparm.eq.'EXTRAPOLATE') then
282 lhaparm(18)='EXTRAPOLATE'
283 else if (lparm.eq.'18') then
285 else if (lparm.eq.'SILENT') then
287 else if (lparm.eq.'LOWKEY') then
289 else if (lparm.eq.'19') then
292 print *,'WARNING from SetLHAPARM - value',lparm,'not recognized!'
296 entry getlhaparm(nparm,lparm)
297 lparm = lhaparm(nparm)
299 end subroutine setlhaparm
303 subroutine getdirpath(dirpath)
304 ! This routine is to determine the directory path for the PDFsets
305 ! directory. It has a two-fold purpose:
306 ! 1) to return the value as an argument in dirpath for the native
307 ! LHAPDF use (ie via initPDFSetByName
308 ! 2) to fill the value of lhapath in the LHAPDFC common for use in
311 include 'commonlhapdfc.inc'
312 include 'commonlhacontrol.inc'
313 include 'parmsetup.inc'
314 character*(*) dirpath
316 ! First look in the LHAPDFC array (lhaparm(20), set by setPDFpath).
317 ! Next, check environmental variable LHAPATH.
318 ! Finally, use binreloc via getdatapath(...).
319 ! Will use default path if this all fails.
320 if (lhaparm(20) /= 'LHAPATH') then
321 call getenv('LHAPATH', lhapath)
322 !call get_environment_variable('LHAPATH',lhapath)
323 if (lhapath.eq.'') then
324 call getdatapath(dirpath)
330 end subroutine getdirpath