~maddevelopers/mg5amcnlo/WWW5_caching

« back to all changes in this revision

Viewing changes to users/mardelcourt/PROC_141512/PROC_141512/Source/PDF/opendata.f

  • Committer: John Doe
  • Date: 2013-03-25 20:27:02 UTC
  • Revision ID: john.doe@gmail.com-20130325202702-5sk3t1r8h33ca4p4
first clean version

Show diffs side-by-side

added added

removed removed

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