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
106 open(unit=1,file=setpath,status='old',action='read')
108 if (( index(s2,'1.0').ne.1) &
109 .and.(index(s2,'1.1').ne.1) &
110 .and.(index(s2,'2.0').ne.1) &
111 .and.(index(s2,'2.1').ne.1) &
112 .and.(index(s2,'3.0').ne.1) &
113 .and.(index(s2,'3.1').ne.1) &
114 .and.(index(s2,'4.0').ne.1) &
115 .and.(index(s2,'5.0').ne.1) &
116 .and.(index(s2,'5.3').ne.1) &
117 .and.(index(s2,'5.4').ne.1) &
118 .and.(index(s2,'5.5').ne.1)) then
119 write(*,*) 'Version ',s2,' not supported by this version of LHAPDF'
122 if (lhasilent.eq.0) then
123 write(*,*) '*************************************'
124 write(*,*) '* LHAPDF Version ',lhaversion,' *'
125 write(*,*) '*************************************'
132 ! print *,'id = ',id,string
134 write(*,*) 'File description error:'
135 write(*,*) 'Command not understood: ',string
138 if (id.eq.1) call descriptionPDF(nset,id)
140 if (id.eq.2) call initEvolve(nset)
142 if (id.eq.3) call initAlphasPDF(nset)
144 if (id.eq.4) call initInputPDF(nset)
146 if (id.eq.5) call initListPDF(nset)
148 if (id.eq.6) call initQCDparams(nset)
150 if (id.eq.7) call initMinMax(nset)
154 ! print *,'calling InitEvolveCode',nset
155 call InitEvolveCode(nset)
157 ! Initialize the default member 0
158 call InitPDFM(nset,0)
161 entry getsetpath(setpath)
165 end subroutine InitPDFsetM
169 integer function token(s)
175 data t/'Description:','Evolution:','Alphas:', 'Parametrization:', &
176 'Parameterlist:','QCDparams:','MinMax:','End:'/
182 if (s.eq.t(i)) token=i
185 count(token)=count(token)+1
186 if (count(token).eq.2) then
187 write(*,*) 'File description error:'
188 write(*,*) 'Second definition of entry: ',s
204 subroutine LHAprint(iprint)
206 include 'commonlhacontrol.inc'
207 integer lhasilent,iprint
208 common/lhasilent/lhasilent
211 ! If using stream #6, don't silence!
212 if(iprint.ne.6) lhaparm(19)='SILENT'
214 end subroutine LHAprint
218 subroutine setPDFpath(pathname)
220 include 'commonlhapdfc.inc'
221 include 'commonlhacontrol.inc'
222 include 'parmsetup.inc'
223 character*(*) pathname
228 lhaparm(20) = 'LHAPATH'
229 do j=1,len_trim(lhapath)
234 end subroutine setPDFpath
238 subroutine lhaset(lhaparm2,lhavalue2)
240 include 'commonlhacontrol.inc'
241 character*20 lhaparm2(20)
242 double precision lhavalue2(20)
247 lhaparm(j)=lhaparm2(j)
248 lhavalue(j)=lhavalue2(j)
251 end subroutine lhaset
255 subroutine setlhaparm(lparm)
257 include 'commonlhacontrol.inc'
263 if(lparm.eq.'EKS98') then
265 else if(lparm.eq.'EPS08') then
267 else if(lparm.eq.'15') then
269 else if(lparm.eq.'NOSTAT') then
271 else if (lparm.eq.'16') then
273 else if (lparm.eq.'LHAPDF') then
275 else if (lparm.eq.'17') then
277 else if (lparm.eq.'EXTRAPOLATE') then
278 lhaparm(18)='EXTRAPOLATE'
279 else if (lparm.eq.'18') then
281 else if (lparm.eq.'SILENT') then
283 else if (lparm.eq.'LOWKEY') then
285 else if (lparm.eq.'19') then
288 print *,'WARNING from SetLHAPARM - value',lparm,'not recognized!'
292 entry getlhaparm(nparm,lparm)
293 lparm = lhaparm(nparm)
295 end subroutine setlhaparm
299 subroutine getdirpath(dirpath)
300 ! This routine is to determine the directory path for the PDFsets
301 ! directory. It has a two-fold purpose:
302 ! 1) to return the value as an argument in dirpath for the native
303 ! LHAPDF use (ie via initPDFSetByName
304 ! 2) to fill the value of lhapath in the LHAPDFC common for use in
307 include 'commonlhapdfc.inc'
308 include 'commonlhacontrol.inc'
309 include 'parmsetup.inc'
310 character*(*) dirpath
312 ! First look in the LHAPDFC array (lhaparm(20), set by setPDFpath).
313 ! Next, check environmental variable LHAPATH.
314 ! Finally, use binreloc via getdatapath(...).
315 ! Will use default path if this all fails.
316 if (lhaparm(20) /= 'LHAPATH') then
317 call getenv('LHAPATH', lhapath)
318 !call get_environment_variable('LHAPATH',lhapath)
319 if (lhapath.eq.'') then
320 call getdatapath(dirpath)
326 end subroutine getdirpath