1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
Integer Function NextUnopen()
c********************************************************************
C Returns an unallocated FORTRAN i/o unit.
c********************************************************************
Logical EX
C
Do 10 N = 10, 300
INQUIRE (UNIT=N, OPENED=EX)
If (.NOT. EX) then
NextUnopen = N
Return
Endif
10 Continue
Stop ' There is no available I/O unit. '
C *************************
End
subroutine OpenData(Tablefile)
c********************************************************************
c generic subroutine to open the table files in the right directories
c********************************************************************
implicit none
c
Character Tablefile*40,up*3,lib*4,dir*8,tempname*100
data up,lib,dir/'../','lib/','Pdfdata/'/
Integer IU,NextUnopen,i
External NextUnopen
common/IU/IU
c
c-- start
c
IU=NextUnopen()
c first try in the current directory (for cluster use)
tempname=Tablefile
open(IU,file=tempname,status='old',ERR=10)
return
10 tempname=up//Tablefile
open(IU,file=tempname,status='old',ERR=20)
return
c then try PdfData directory
20 tempname=dir//Tablefile
open(IU,file=tempname,status='old',ERR=30)
return
30 tempname=lib//tempname
open(IU,file=tempname,status='old',ERR=40)
40 continue
do i=0,6
open(IU,file=tempname,status='old',ERR=50)
return
50 tempname=up//tempname
if (i.eq.6)then
write(*,*) 'Error: PDF file ',Tablefile,' not found'
stop
endif
enddo
print*,'table for the pdf NOT found!!!'
return
end
|