      subroutine sdvini(statev,coords,nstatv,ncrds,noel,npt,layer,kspt)

      include 'aba_param.inc'

      dimension statev(nstatv), coords(ncrds)

C     real f_i=1.0e-10
C     real w_bar=0.25d0
C     real walpha=2.d0

C     real a_1, a_2

      statev(1)=5.d0

C     a_1 = (-2)*(1.d0-f_i)/0.25d0
C     a_2 = (1.d0-f_i)/(0.25**2)


      write(6,*) coords(1)
      return
      end

      subroutine umat(stress,statev,ddsdde,sse,spd,scd,
     1 rpl,ddsddt,drplde,drpldt,
     2 stran,dstran,time,dtime,temp,dtemp,predef,dpred,cmname,
     3 ndi,nshr,ntens,nstatv,props,nprops,coords,drot,pnewdt,
     4 celent,dfgrd0,dfgrd1,noel,npt,layer,kspt,kstep,kinc)

      include 'aba_param.inc'

      character*80 cmname
      dimension stress(ntens),statev(nstatv)
      dimension ddsdde(ntens,ntens),ddsddt(ntens),drplde(ntens)
      dimension stran(ntens),dstran(ntens),time(2),predef(1),dpred(1)
      dimension props(nprops),coords(3),drot(3,3),dfgrd0(3,3),dfgrd1(3,3)

      integer i,j
      real f_i=1.0e-10
      real w_bar=0.25d0
      real walpha=2.d0



      E = props(1)
      xnu = props(2)

      shear = E/2.d0/(1.d0+xnu)
      bulk = E/3.d0/(1.d0-2.d0*xnu)

      a_1 = (-2)*(1.d0-f_i)/0.25d0
      a_2 = (1.d0-f_i)/(0.25**2)

      statev(1)=5.d0

      ddsdde = 0.d0

C      omega = statev(1)

      if(ndi.eq.2 .and. nshr.eq.1) then
        ddsdde(1,1) = bulk + (10.d0/9.d0)*shear
        ddsdde(1,2) = bulk - (8.d0/9.d0)*shear
        ddsdde(2,1) = bulk - (8.d0/9.d0)*shear
        ddsdde(2,2) = bulk + (10.d0/9.d0)*shear
        ddsdde(3,3) = 2.d0*shear
        ddsdde = ddsdde*statev(1)
      end if

      do i=1,ntens
        do j=1,ntens
            stress(i) = stress(i) + ddsdde(i,j)*dstran(j)
        end do
      end do

      if(coords(1).le.0 .and. coords(2).eq.0) then
        statev(1) = (w_bar*(1-tanh(w_alpha*coords(1))))
        statev(1)=1.d0+a_1*(statev(1))+a_2*(statev(1)**2)
      elseif(coords(1).gt.0 .and. coords(2).eq.0) then
        statev(1) = (w_bar*(1+tanh(w_alpha*coords(1))))
        statev(1)=1.d0+a_1*(statev(1))+a_2*(statev(1)**2)
      else
          statev(1)=0.d0
      end if

      statev(1)=state(1) + kinc

      write(7,*) ddsdde

      return
      end
