anchor.diff:        PROGRAM flt2displacement
   C----
  -C Calculate the north, east and vertical displacements at stations
  -C due to shear dislocations in an isotropic halfspace.
  -C
  -C To run, requires the following files:
  -C     faults.txt: list of ruptures
  -C     stations.txt: list of receiver lon, lat, and depth (km)
  -C     structure.txt: vp (m/s) vs (m/s) density (kg/m^3)
  -C
  -C Produces the output file:
  -C     disp.out: stlo, stla, uN, uE, uZ
  -C
  -C MODIFICATIONS:
  -C   2013-02-21: Original file created
  -C   2013-07-22: Subroutine to check that input files exist
  -C   2013-08-08: Added verbose option
  -C   2013-08-08: Added help/usage option
  -C
  +C Calculate the north, east and vertical displacements at receivers in
  +C an isotropic elastic half-space due to shear dislocations.
   C----
         IMPLICIT NONE
  -      REAL*8 pi,d2r
  -      PARAMETER (pi=4.0d0*datan(1.0d0),d2r=pi/1.8d2)
  -
         LOGICAL verbose
         CHARACTER*20 srcfile,stafile,haffile
  -      INTEGER flt,nflt,maxflt
  -      PARAMETER (maxflt=50)
  -      INTEGER flttyp(maxflt),i,j
  +      INTEGER nflt,maxflt
  +      PARAMETER (maxflt=1500)
  +      INTEGER flttyp(maxflt)
         REAL*8 evlo(maxflt),evla(maxflt),evdp(maxflt),str(maxflt),
        1       dip(maxflt),rak(maxflt),slip(maxflt),dx(maxflt),dy(maxflt),
        2       area(maxflt)
   
  -      REAL*8 stlo,stla,stdp,dist,az,x,y
  +      REAL*8 stlo,stla,stdp
         REAL*8 vp,vs,dens
   
  -      REAL*8 ux,uy,uN,uE,uZ,uNnet,uEnet,uZnet
  +      REAL*8 uNnet,uEnet,uZnet
   
         call gcmdln(verbose)
   C----
  
positive.code:       
  C----------------------------------------------------------------------C
  
        SUBROUTINE xy2NE(uN,uE,ux,uy,str)
        
        IMPLICIT none
  
negative.code: C----
    101 read (22,*,end=103) stlo,stla,stdp
            stdp = 1.0d3*stdp
            call calcdisp(uNnet,uEnet,uZnet,stlo,stla,stdp,nflt,
       1                  evlo,evla,evdp,str,dip,rak,dx,dy,area,slip,
       2                  vp,vs,dens,flttyp)
            write (11,9999) stlo,stla,uNnet,uEnet,uZnet
            goto 101
    103 continue
  
   9999 format (2(f10.3),3(f14.4)) 
  
        END
  
  