      program test
      
      implicit none
      
      integer i, j

      real*8 Vmat(10,8), Rarr(10), Hso1(8,8), Hso2(8,8), Hso3(8,8),
     +  NA(10)
      data Rarr / 1.8d0,
     +            2.5d0, 
     +            2.7d0, 
     +            2.9d0, 
     +            3.1d0, 
     +            3.5d0, 
     +            5.0d0, 
     +            7.0d0,
     +            1.1d1,
     +            2.0d1/

c     potential curves
      do i = 1, 8
        do j = 1, 10
          call O2_V (Rarr(j), i, Vmat(j,i))
        end do
      end do

      write (*,*) 'O2 potential energy curves'
      write (*,*) '      I ='
      write (*,fmt=100) 1,2,3
100   format ('   R  ', 8X, I1, 18X, I1, 18X, I1)
      do i = 1, 10
        write (*,fmt=200) Rarr(i), (Vmat(i,j),j=1,3)
      end do
200   format (1X, F4.1, 3(1X, E18.10))
      write(*,*)
      write (*,*) '      I ='
      write (*,fmt=100) 4,5,6
      do i = 1, 10
        write (*,fmt=200) Rarr(i), (Vmat(i,j),j=4,6)
      end do
      write(*,*)
      write (*,*) '      I ='
      write (*,fmt=100) 7,8
      do i = 1, 10
        write (*,fmt=200) Rarr(i), (Vmat(i,j),j=7,8)
      end do
      write(*,*)
      write(*,*)

c     spin orbit reduced matrix elements
      do i = 1, 8
        do j = 1, 8
          call O2_SO (1.6d0, i, j, Hso1(i,j))
          call O2_SO (5.0d0, i, j, Hso2(i,j))
          call O2_SO (1.1d1, i, j, Hso3(i,j))
          Hso1(i,j) = 1.0d6*Hso1(i,j)
          Hso2(i,j) = 1.0d6*Hso2(i,j)
          Hso3(i,j) = 1.0d6*Hso3(i,j)
        end do
      end do

      write (*,*) 
     +  'O2 Spin Orbit matrix elements in micro-Eh at R = 1.6d0 a_0'
      write (*,*) '   I = '
      write (*,fmt=300) (i,i=1,8)
300   format (' J ', 4X, 8(I1, 14X))
      do j = 1,8
        write (*,fmt=400) j, (Hso1(j,i), i=1,8)
      end do
400   format (1X, I1, 8(1X, F14.8))
      write (*,*)
      write (*,*) 
     +  'O2 Spin Orbit matrix elements in micro-Eh at R = 5.0d0 a_0'
      write (*,*) '   I = '
      write (*,fmt=300) (i,i=1,8)
      do j = 1,8
        write (*,fmt=400) j, (Hso2(j,i), i=1,8)
      end do
      write (*,*)
      write (*,*) 
     +  'O2 Spin Orbit matrix elements in micro-Eh at R = 1.1d1 a_0'
      write (*,*) '   I = '
      write (*,fmt=300) (i,i=1,8)
      do j = 1,8
        write (*,fmt=400) j, (Hso3(j,i), i=1,8)
      end do
      write (*,*)
      write (*,*)

c     non-adiabatic radial derivative coupling
      do i = 1, 10
        call O2_NA (Rarr(i), 6, 5, NA(i))
      end do

      write (*,*) 
     +  'non-adiabatic radial derivative coupling matrix element '
      write (*,*) '< 2 3Sigma | d / dR | A 3Sigma >'
      write (*,'(1X, A4, 2X, A5)') '   R ', 'NACME' 
      do i = 1,10
        write (*,fmt=500) Rarr(i), NA(i)
      end do
500   format (1X, F4.1, 2X, E20.12)     

      end
