anchor.diff:  #endif
       write(coll_scatterUnit,'(1x,i2,2x,i4,2x,i5,2x,i1,3(2x,e18.10))') icoll,iturn,ipart,nabs_tmp,(p-pBef)/pBef,xp-xpBef,zp-zpBef
   #ifdef HDF5
  -    endif
  -#endif
  -  end if
  -
  -!++  Calculate the remaining interaction length and close the iteration
  -!++  loop.
  -  rlen=rlen-zlm1
  +    end if
  +#endif
  +  end if
  +
  +  ! Calculate the remaining interaction length and close the iteration loop.
  +  rlen = rlen-zlm1
     goto 10
   
   end subroutine k2coll_jaw
  
positive.code: #endif
      write(coll_scatterUnit,'(1x,i2,2x,i4,2x,i5,2x,i1,3(2x,e14.6))') icoll,iturn,ipart,nabs_tmp,-one,zero,zero
  #ifdef HDF5
      endif
  #endif
      return
    end if
  
  !++  Now treat the other types of interaction, as determined by ICHOIX:
  
  !++      Nuclear-Elastic:          inter = 2
  !++      pp Elastic:               inter = 3
  !++      Single-Diffractive:       inter = 4    (changes momentum p)
  !++      Coulomb:                  inter = 5
  
  !++  As the single-diffractive interaction changes the momentum, save
  !++  input momentum in p1.
    p1 = p
  
  !++  Gettran returns some monte carlo number, that, as I believe, gives
  !++  the rms transverse momentum transfer.
    t = k2coll_gettran(inter,mat,p)
  
  !++  Tetat calculates from the rms transverse momentum transfer in
  !++  monte-carlo fashion the angle changes for x and z planes. The
  !++  angle change is proportional to SQRT(t) and 1/p, as expected.
    call k2coll_tetat(t,p,dxp,dzp)
  
  !++  Apply angle changes
    xp=xp+dxp
    zp=zp+dzp
  
  !++  Treat single-diffractive scattering.
    if(inter.eq.4) then
  
  !++ added update for s
      s=(zlm-rlen)+zlm1
      xpsd=dxp
      zpsd=dzp
      psd=p1
  !
  !++  Add this code to get the momentum transfer also in the calling
  !++  routine...
      dpop=(p-p0)/p0
    end if
  
    if(dowrite_impact) then
  
negative.code: #endif
        write(coll_scatterUnit,'(1x,i2,2x,i4,2x,i5,2x,i1,3(2x,e14.6))') icoll, iturn, ipart, nabs_tmp, -one, zero, zero
  #ifdef HDF5
        end if
  #endif
      end if
      return
    else if(mat == nmat-1) then
      ! Collimator treated as drift
      s = zlm
      x = x+s*xp
      z = z+s*zp
  
      if(dowrite_impact) then
        ! write coll_scatter.dat for complete scattering histories
  