C
C *** READ OF SOIL DATA FROM DATA FILE
C 
      SUBROUTINE MLIN(FOM,DOM,NOM,DNS,VS,DEP,QF,NQF,NL,ML,THETA,NSF)
C
C ** FOM    : FIRST CIRCULAR FREQUENCY (OMEGA)
C ** DOM    : INCREMENT OF CIRCULAR FREQUENCY (DELTA OMEGA)
C ** NOM    : TOTAL NUMBER OF CIRCULAR FREQUENCY
C ** DNS(I) : DENSITY OF Ith LAYER
C ** VS (I) : VS OF Ith LAYER
C ** DEP(I) : DEPTH (THICKNESS) OF Ith LAYER
C ** QF(I)  : QUALITY FACTER = 1/(2*H)
C ** NQF    : = 1 : QF ENTER,   = 0 : QF NOT NOT ENTER
C ** NL     : TOTAL NUMBER OF LAYERS
C ** ML     : NL IN MAIN PROGRAM DIMENSION
C ** THETA  : INCIDENT ANGLE OF SH WAVE (DEGREE --> RADIAN)
C ** NSF    : =0:OUTPUT POINT IS ON SURFACE, =1:OUTPUT POINT IS IN SOIL
C
      IMPLICIT REAL*8(A-H,O-Z)
      CHARACTER FNAME*30
      DIMENSION DNS(ML),DEP(ML),VS(ML),QF(ML)
C
C *** SOIL DATA INPUT ***
C 
      WRITE(*,9)
      WRITE(*,10)
    9 FORMAT(/' From SUBROUTINE MLIN : ')
   10 FORMAT(/' Enter Soil Data File Name ',\)
   11 READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 11
   
      OPEN (5,FILE=FNAME)
      READ(5,1000)NL
      DO 100 IL=1,NL
      READ(5,1010)DNS(IL),VP,VS(IL),DEP(IL),QF(IL)
  100 CONTINUE
      CLOSE(5)
 1000 FORMAT(I10)
 1010 FORMAT(5F10.0)
C
      WRITE(5,1100)NL
      WRITE(5,1110)
      DO 150 IL=1,NL
      WRITE(*,1120)IL,DNS(IL),VS(IL),DEP(IL),QF(IL)
  150 CONTINUE
 1100 FORMAT(/'SOIL DATA : LAYER NUMBER =',I5)
 1110 FORMAT(/' LAYER DENSITY   VS     DEPTH     QF') 
 1120 FORMAT(I5,F9.3,2F8.2,F8.3)
C
C *** OMEGA,THETA AND QF INPUT FROM SCREEN ***
C
   20 WRITE(*,2000)
      READ(*,*)FOM,DOM
      WRITE(*,2010)
      READ(*,*)NOM
      WRITE(*,2020)
      READ(*,*)NSF
      WRITE(*,2030)
      READ(*,*)NQF
      WRITE(*,2040)
      READ(*,*)NTHETA
      IF(NTHETA.EQ.0)THEN
        THET1=0.D0
      ELSE
        WRITE(*,2050)
        READ(*,*)THET1
      END IF
      WRITE(*,2060)
      READ(*,*)IYES
      IF(IYES.NE.0)GOTO 20
 2000 FORMAT(/' Enter First Omega and Delta Omega             ? :',\)
 2010 FORMAT( ' Enter Omega Number (including First Omega)    ? :',\)
 2020 FORMAT(/' Free Surface (=0:*2) or Medium Inside (=1:*1) ? :',\)
 2030 FORMAT( ' Include Quality Factor (Enter No=0,Yes=1)     ? :',\)
 2040 FORMAT( ' Incident Angle = 0 (degree: Enter Yes=0,No=1) ? :',\)
 2050 FORMAT( ' Enter Incident Angle (degree)                 ? :',\)
 2060 FORMAT(/' All Input Data OK ? (Enter yes = 0)           ? :',\)
C
C *** CHANGE THETA FROM DEGREE TO RADIAN ***
C
      THETA=THET1*0.017453292520D0
C
      RETURN
      END
