      subroutine boxdat
C-----------------------------------------------------
      INCLUDE 'basp.h'
      INCLUDE 'garr.h'
      INCLUDE 'fam.h'
      INCLUDE 'din.h'
      INCLUDE 'yarr.h'
      INCLUDE 'charr.h'
      INCLUDE 'pharr.h'
      INCLUDE 'darr.h'
      INCLUDE 'hetarr.h'
      INCLUDE 'trajarr.h'
C**********************************************************************C
C234567890123456789012345678901234567890123456789012345678901234567890
      CHARACTER AYDOL*8, npm*2
      COMMON /CHMDOL/ NUMDOL(NC),AYDOL(NC),
     *                NBNDOL(NC),SERDOL(NC),WDDOL(NC),AMDOL(NC)
      COMMON /CHMBOX/ YBOX(L,NC),
     *                PBOX(L,NY),
     *                DBOX(L,NY)
      PARAMETER (NSAD=21)
      COMMON /TA_SAD/ TA(L,M,12),H2O(L,M,12),SAD(L,M,12,NSAD)
      COMMON /NCALDL/ NCAL,NDAL,NCDL
      REAL TA39(39,M,12),H2O39(39,M,12),SAD39(39,M,12,21)
      DATA TSUT/8.64E4/
      NGOD=1  ! Otherwise causes problems when IG is 1 in RDF GM 2/00
      NUMLEV=0 ! To run several pt levels one after the other GM3/01

C     Open file to read names of input files and pt levels to run GM3/01
      OPEN(10,file='forbox.inp',status='old',err=1000)
C
C     READING FILES NAMES AND PT LEVELS TO RUN
C
      READ(10,4)FLN1,FLN2,FLN3,FLN4,FLN5,FLN6,FLN7,FLN8,FLN9,FTA,
     *FTA1,FTA2,FTA3,FTA4,FTA5,FTA7,FTA6,FTA8,FTA9,FTA10,FTA11 !,FTA11
      CLOSE(10)
 4    FORMAT(1X,A60)
C
C     GASES NAMES READING IN MAD.FOR
C
      CALL NAM
C
C     BASIC PARAMETERS READING FROM FLN6 AND DERIVING (MAD.FOR)
C
      CALL BASIN
C
C     PHOTODISSOCIATION PARAMETERS READING FROM FLN3 AND FLN7 (MAD.FOR)
C
      CALL PH_VDV
C
C     ALTITUDE AND LATITUDE PARAMETERS DERIVING (MAD.FOR)
C
      CALL PARAM_D
C
C     TEMPERATURE (TA) READING FOR 12 MONTHS
C
      OPEN(UNIT=14,FILE=FLN2,STATUS='OLD')
C      READ(14,103)TA
      READ(14,15) TA39
      CLOSE(14)
  15  FORMAT(8(1PE10.3))
C
C     WATER VAPOUR (H2O) READING FOR 12 MONTHS
C
      OPEN(UNIT=15,FILE=FLN9,STATUS='OLD')
      READ(15,103) H2O39
      CLOSE(15)
C
C     AEROSOL SURFACE AREA READING FOR 12 MONTHS
C
      OPEN(UNIT=18,FILE=FTA4,STATUS='OLD')
      READ(18,103) SAD39
      CLOSE(18)
 103  FORMAT(8(1PE10.4))
      TA(1:39,:,:)=TA39(1:39,:,:)
      H2O(1:39,:,:)=H2O39(1:39,:,:)
      SAD(1:39,:,:,:)=SAD39(1:39,:,:,:)
      do i=40,L
         TA(i,:,:)=TA39(39,:,:)
         H2O(i,:,:)=H2O39(39,:,:)*0.489542**(I-39.)
         SAD(i,:,:,:)=SAD39(39,:,:,:)
      enddo
C
C     INITIAL NUMBER DENSITIES READING FROM FLN5 (MAD.FOR)
C
      CALL INIT_R  ! 'NCDL' and 'NDAL'  not used GM 1/00
C
C     PHOTODISSOCIATION PROCESSES READING (MAD.FOR)
C
      CALL PHOT_R(13,FLN3,AY,KFE,KS,KSS,KSC,NSS,NSC)
C
C     CHEMICAL REACTION READING (PAXIM_IV.FOR)
C
      CALL PAXIM(18,FLN4,KFE,AY,NHET,NHTR)
C
C     PARAMETERS FOR CALCULATIONS OF CHEMICAL PRODUCTION AND DESTRUCTION
C       (CPHO_IVS.FOR AND SREVV_IV.FOR)
C
      CALL CPHO(N,NNR,NR,NHTR,KSC,KSS,NSC,N2+N3)
      CALL SREVV(NY)
      CALL SNDYJB(N,KS,NSS,NY,NR)
C      CALL PRPX(NY,AY,36)
C
C     GALACTIC RAYS READING FROM FTA2 (MAD.FOR)
C
      print *,' BOXDAT ',ZKM
      print *,' BOXDAT ',FI
      CALL GCR_R(23,FTA2,GCR,L,L1,M,ZKM,FI)
C
C     LIGHTNING DATA READING FROM FTA6
C
      OPEN(UNIT=17,FILE=FTA6,STATUS='OLD')
        READ(17,'(10E10.3)')PLIGNOX
      CLOSE(17)
      print *,' Lightning data read'
C
C     LOWER BOUNDARY CONDITIONS FOR GASES
C
      OPEN(UNIT=17,FILE=FTA5,STATUS='OLD')
         READ(17,'(A150)')FLVBC
      CLOSE(17)
C
C     SOLAR CYCLE PARAMETERS
C
      OPEN(UNIT=19,FILE=FTA,STATUS='OLD')
         READ(19,'(A80)')FLSSN
      CLOSE(19)
Cgal
      call gv_XSEC ( FLN8 )
Cgal

       GOTO 1001
 1000  PRINT*,'Error reading forbox.inp!'
 1001  CONTINUE

      RETURN
      END
