C
C *** READ OF SOIL DATA FROM DATA FILE
C
      SUBROUTINE LOVEIN(DOM,NOM,NDOM,NSMD,NEMD,NDC)
C
C ** INPUT DATA **
C DOM   : INCREMENT OF CIRCULAR FREQUENCY ( DELTA OMEGA )
C NOM   : TOTAL NUMBER OF CIRCULAR FREQUENCY
C NDOM  : DIVISION NUMBER FROM 0 TO MAX OMEGA TO GET CUT-OFF OMEGA
C NSMD  : FIRST OUTPUT MODE OF LOVE WAVE
C NEMD  : END OUTPUT MODE OF LOVE WAVE
C NDC   : DIVISION NUMBER FROM MIN TO MAX VS TO GET PHASE VELOCITY
C DNS(I): DENSITY OF Ith LAYER ==> SM(I):SHEAR MODULUS => COMMOM SM(35)
C VS (I): VS OF Ith LAYER                              => COMMON VS(35)
C DEP(I): DEPTH ( THICKNESS ) OF Ith LAYER             => COMMON DEP(35)
C NL    : TOTAL NUMBER OF LAYERS                       => COMMON NL
C
      IMPLICIT REAL*8(A-H,O-Z)
      CHARACTER FNAME*30
      COMMON / LAYER / NL,VS(35),DEP(35),SM(35) / DNSITY / DNS(35)
     *       / MINMAX / VSMIN, VSMAX
C
C *** SOIL DATA INPUT FROM FILE DATA ***
C
      WRITE(*,*)
      WRITE(*,1000)
   10 WRITE(*,1010)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 10
 1000 FORMAT( ' From SUBROUTINE LOVEIN :')
 1010 FORMAT(/' Enter Soil Data File Name ',\)

      OPEN (7,FILE=FNAME)
      READ(7,1200)NL
      DO 100 IL=1,NL
        READ(7,1210)DNS(IL),VP,VS(IL),DEP(IL),QF
        SM(IL)=DNS(IL)*VS(IL)*VS(IL)
  100 CONTINUE
      CLOSE(7)
 1200 FORMAT(I10)
 1210 FORMAT(5F10.0)
C
C *** DATA ECHO ***
C
      WRITE(*,2000)NL
      DO 200 IL=1,NL
        WRITE(*,2010)IL,DNS(IL),VS(IL),DEP(IL)
  200 CONTINUE
 2000 FORMAT(/' Total Layers Number            =',I5)
 2010 FORMAT( ' Layer Num., Density, Vs, Depth =',I3,3F10.3)
C
C *** MIN AND MAX VS AND SOIL DATA CHECK ***
C
      VSMIN=VS(NL)
      VSMAX=0.0D0
      DO 300 IL=1,NL
        VSMIN=MIN(VSMIN,VS(IL))
        VSMAX=MAX(VSMAX,VS(IL))
  300 CONTINUE
      IF(VSMAX.NE.VS(NL))THEN
        WRITE(*,*)' FROM SUBROUTINE LOVEIN'
        WRITE(*,*)' VS(NS).NE.VSMAX, THUS STOP !!!'
        STOP
      END IF
C
      IF(NL.GT.50)THEN
        WRITE(*,*)' FROM SUBROUTINE LOVEIN'
        WRITE(*,*)' SOIL LAYERS NUMBER > 50, THUS STOP !!!'
        STOP
      END IF
C
C *** DATA INPUT FROM SCREEN ***
C
      WRITE(*,3000)
      READ(*,*)DOM,NOM
      OMMAX=DOM*DFLOAT(NOM)
      WRITE(*,3010)0.D0,OMMAX
      WRITE(*,3020)
      READ(*,*)NDOM
      WRITE(*,3030)VSMIN,VSMAX
      WRITE(*,3040)
      READ(*,*)NDC
      WRITE(*,3050)
      READ(*,*)NSMD
      WRITE(*,3060)
      READ(*,*)NEMD
      WRITE(*,3070)
      READ(*,*)IYES
      IF(IYES.NE.0)GOTO 10
 3000 FORMAT(/' Enter Delta Omega and Omega Number        ?    :',\)
 3010 FORMAT(/' Minimum Omega and Maximum Omega = ',2F8.3)
 3020 FORMAT( ' To Get Cut-Off Omega,  Enter',
     *       /' Division Number between Min and Max Omega ?    :',\)
 3030 FORMAT(/' Minimum Vs and Maximum Vs = ',2F10.3)
 3040 FORMAT( ' To Get Phase Velocity, Enter',
     *       /' Division Number between Min and Max Vs       ? :',\)
 3050 FORMAT(/' Enter Output Start Love Mode (Fundamental=0) ? :',\)
 3060 FORMAT( ' Enter Output End Love Mode ( >= Start Mode ) ? :',\)
 3070 FORMAT(/' Input Data OK ? ( yes = Enter 0 )            ? :',\)
      WRITE(*,*)
C
      RETURN
      END
