      SUBROUTINE ESPI(DBPWL,FREQ,CB,FKB,ATEN)
C
C     THIS SUBROUTINE USES NEWTON'S METHOD TO CONVERT DB PER WAVE 
C     LENGTH (DBPWL) TO AN IMAGINARY PART OF THE SQUARE OF THE INDEX
C     OF REFRACTION. THE RESULT (ESP) IS RETURNED IN ATEN.
C
C     GENERATE CONSTANTS
C
      IMPLICIT REAL*8 (A-H,O-Z)
      PI=2.*ACOS(0.0)
      E=EXP(1.0)
      FAC=20.*DLOG10(E)      
C
C     FIND WAVE LENGTH
C
      WL=CB/FREQ
      DBPM=DBPWL/WL
      FK=DBPM/FAC
C
C     THE FOLLOWING IS A GOOD APPROXIMATE FOR ATEN WITH
C     REASONABLE ATTENUATIONS
C
      ESP=2.*FK/FKB
      I=0
C
  100 CONTINUE
C
      IF(I .GT. 20) GO TO 500
      I=I+1
      X=(1.0+ESP**2)**.25
      Y=SIN(ATAN(ESP)/2.)
      Z=COS(ATAN(ESP)/2.)
      W=X**3
C
      F=FKB*X*Y-FK
      FP=FKB*(ESP*Y+Z)/W           
      ESP=ESP-F/FP
C
      GO TO 100
C
  500 CONTINUE
      ATEN=ESP
C
      RETURN
      END
