      program convert
c
c     Converts 73 parameter tight-binding files to the 97 parameter
c      form
c
c     Splits "d" onsite terms into t_{2g} and e_g
c
c     Adds a quadratic term to the power law expansion of the
c      hopping and overlap integrals
c
c     Note that this is a filter, i.e., it reads from standard input
c      and writes to standard output
c
c                                     --  Mike Mehl  6 Aug 1997
c
c========================================================================
c
      implicit none
c
c     The old parameters
c
      real*8 par(73)
c
c     and flags
c
      integer flag(73)
c
c     Do loop and counting variables:
c
      integer i,j
c
c     We'll need these numbers:
c
      integer single
      parameter (single = 1)
c
      real*8 zero
      parameter (zero = 0d0)
c
c========================================================================
c
c     Read in the old parameters.  If there are not 73, generate an
c      error.  If more than 73, don't check for additional input
c
      do i = 1,73
         read(*,*,err=1000,end=1000) par(i),flag(i)
      end do
c
c     The first 13 parameters remain unchanged (s, p, and d->t_{2g}
c      onsite terms):
c
      j = 0
      do i = 1,13
         j = j + 1
         write(*,'(1pe20.11,2i3)') par(i),flag(i),j
      end do
c
c     Now repeat the d onsite terms as the t_e terms:
c
      do i = 10,13
         j = j + 1
         write(*,'(1pe20.11,2i3)') par(i),flag(i),j
      end do
c
c     Now do the hopping and overlap integrals.  We need to
c      insert a "0" between the second and third parameters
c      of each term.
c
      do i = 14,73,3
         j = j + 1
         write(*,'(1pe20.11,2i3)') par(i),flag(i),j
         j = j + 1
         write(*,'(1pe20.11,2i3)') par(i+1),flag(i+1),j
         j = j + 1
         write(*,'(1pe20.11,2i3)') zero,single,j
         j = j + 1
         write(*,'(1pe20.11,2i3)') par(i+2),flag(i+2),j
      end do
c
      go to 2000
c
c     Error exit
c
 1000 stop 'Input parameter file not in 73 parameter format'
c
c     Standard exit (eliminates annoying "STOP" statement
c      which appears on some compilers)
c
 2000 continue
      end

