c&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
      Function Atang(y,x,pihlf)
c     ******************************************************************
c     *                                                                *
c     *                   Arctan(y/x)                                  *
c     *                                                                *
c     ******************************************************************
c-----------------------------------------------------------------------
      If(x.eq.0.) Then
        If(y.eq.0) Then
           Atang=0.
        Else If(y.gt.0.) Then
           Atang=pihlf
        Else
           Atang=-pihlf
        End If
      Else
           Atang=Atan(y/x)+(Sign(1.,-x)+1)*pihlf
      End If
c-----------------------------------------------------------------------
      Return
      End 

      function Atang1(y,x)
c     ******************************************************************
c     *                                                                *
c     *               Arctan (y/x) in range of (0,2*pi)                *
c     *                                                                *
c     ******************************************************************
                               P a r a m e t e r
     & (pi=3.14159265359,pi2=pi*2.,pi05=pi*0.5,pi305=3.*pi05)
c-----------------------------------------------------------------------
      If(y.lt.0.) Then
        If(x.lt.0.) Then
          Atang1=pi+Atan(y/x)
          Return
        Else If(x.gt.0.) Then
          Atang1=pi2+Atan(y/x)
          Return
        Else
          Atang1=pi305
          Return
        End If
      Else If(y.gt.0.) Then
        If(x.lt.0.) Then
          Atang1=pi+Atan(y/x)
          Return
        Else If(x.gt.0.) Then
          Atang1=Atan(y/x)
          Return
        Else
          Atang1=pi05
          Return
        End If
      Else
        If(x.ge.0.) Then
          Atang1=0.
          Return
        Else
          Atang1=pi
          Return
        End If
      End If

c-----------------------------------------------------------------------
                               End

