
subroutine tstep(params, anm_, an_, anp_, bnm_, bn_, bnp_, &
     cnm_, cn_, cnp_, dnm_, dn_, dnp_, phim_, phi, phip_, temp)
  use input_params
  implicit none

  INTERFACE

     subroutine leapfrogA(params, anm,an,anp, bn,cn,dn)
       use input_params
       implicit none
       real*8, dimension(100) :: params
       real*8, dimension(:,:,:) :: anm,an,anp, bn,cn,dn
     end subroutine leapfrogA
     
     subroutine leapfrogBCD(params, an, bnm, bn, bnp, cnm, cn, cnp,&
          dnm, dn, dnp)
       use input_params
       implicit none
       real*8, dimension(100):: params
       real*8, dimension(:,:,:) :: an, bnm, bn, bnp, cnm, cn, cnp, dnm, dn, dnp
     end subroutine leapfrogBCD
     
     subroutine updatephi(params, an, phip, phim)
       use input_params
       implicit none
       real*8, dimension(100) :: params
       real*8, dimension(:,:,:) :: an, phip, phim
     end subroutine updatephi

     subroutine boundupdt(params, an, anp, bn, bnp, cn, cnp, dn, dnp, phip)
       use input_params
       implicit none
       real*8, dimension(100)   :: params
       real*8, dimension(:,:,:) :: an, anp, bn, bnp, &
            cn, cnp, dn, dnp, phip
     end subroutine boundupdt

     subroutine dump_2d(params, name, u)
       use input_params  
       implicit none
       real*8, dimension(100) :: params
       character*(*) name
       real*8, dimension(:,:,:) :: u
     end subroutine dump_2d

     subroutine swaptime(anm,an,anp, bnm,bn,bnp,&
          cnm,cn,cnp, dnm,dn,dnp, phim,phi,phip)
       implicit none
       real*8, dimension(:,:,:) :: anm,an,anp, bnm,bn,bnp,&
          cnm,cn,cnp, dnm,dn,dnp, phim,phi,phip
     end subroutine swaptime
     
  END INTERFACE

  real*8, dimension(100)     :: params
  real*8, dimension(:,:,:)  :: anm_, an_, anp_, &
       bnm_, bn_, bnp_, cnm_, cn_, cnp_, dnm_, dn_, dnp_, &
       phim_, phi, phip_, temp

  write(6,*) '. '

!  call boundupdt(params, an_, anp_, bn_, bnp_, cn_,cnp_, dn_, dnp_, phip_)

  call leapfrogA(params, anm_,an_,anp_, bn_,cn_,dn_)
  
  call leapfrogBCD(params, an_, bnm_,bn_,bnp_, cnm_,cn_,cnp_, &
       dnm_,dn_,dnp_)
  
  call updatephi(params, an_, phip_,phim_)

  call swaptime(anm_,an_,anp_, bnm_,bn_,bnp_, cnm_,cn_,cnp_, &
       dnm_,dn_,dnp_, phim_,phi,phip_)

!  call dump_2d(params, "Phi", phi) 

  return  
end subroutine tstep

