!---------------------------------------------------------------------

         subroutine middle(x1,y1,z1,x2,y2,z2,xtmp,ytmp,ztmp)
      
          implicit none

          real,intent(in)::x1,y1,z1,x2,y2,z2
          real,intent(out)::xtmp,ytmp,ztmp

           ztmp=0.5*(z1+z2)
           ytmp=0.5*(y1+y2)
 
           xtmp=sqrt(1-ztmp*ztmp-ytmp*ytmp)

          end subroutine middle


