c------------------------------------------
c      REPTOAGE
c-----------------------------------------------------------------------
c conversion des Dx, Dy et Dz calculees par GAMIT issues du programme REP
c vers un fichier .dat pour utilisation avec AGE
c----------------------------------------------------------------------
c
       integer nsta(50),I,J,NB,S1,S2,X,Y,Z
       character*4 sta(50),sta1,sta2
       character*12 ncod
       character*80 ligne
       real*8 DX,RX,DY,RY,DZ,RZ,ZZ
c
       X=12
       Y=13
       Z=14
       ZZ=0.
c
       write (*,*) 'entrer nom de fichier .cod'
       read (*,'(a12)') ncod
c
       open (8,file='vicu1.dat')
       open (3,file=ncod,status='old')
       read (3,'(a80)') ligne
       open (4,file='tsta.r.xyz.bsl',status='old')
c
 100   format(A4,5x,I3)
 110   format(A4,'-',A4,10x,3(2x,F14.4,3x,F9.4))
 120   format(I2,3x,2(I3,1x),F14.4,1x,F6.4,2(2x,F2.1),2x,A4,4x,A4)
c
       I=1
   5   read (3,100,end=10) sta(I),nsta(I)
        I=I+1
       go to 5
  10   NB=I
  40   read (4,110,end=50) sta1,sta2,DX,RX,DY,RY,DZ,RZ
  20   S1=0
       S2=0
       do 30 J=1,NB
        if (sta1.eq.sta(J)) then
        S1=J
        endif 
        if (sta2.eq.sta(J)) then
        S2=J
        endif
  30   continue
c
       write (8,120) X,nsta(S1),nsta(S2),DX,RX,ZZ,ZZ,sta(S1),sta(S2)
       write (8,120) Y,nsta(S1),nsta(S2),DY,RY,ZZ,ZZ,sta(S1),sta(S2)
       write (8,120) Z,nsta(S1),nsta(S2),DZ,RZ,ZZ,ZZ,sta(S1),sta(S2)
       go to 40
  50   stop
       end
    
        












































