anchor.diff:    call k2coll_soln3(ae,be,dh,rlen,s)
     if(s < h) s = h
   
  -  call k2coll_scamcs(x,xp,s,radl_mat)
  +  call k2coll_scamcs(x,xp,s)
     if(x <= zero) then
       s = (rlen0-rlen)+s
       goto 20
  
positive.code:   goto 10
  
  20 continue
    call k2coll_scamcs(z,zp,s,radl_mat)
    s  = s*radl(mat)
    x  = (x*theta)*radl(mat)
    xp = xp*theta
  
negative.code: end subroutine k2coll_soln3
  
  !>
  !! k2coll_scamcs(xx,xxp,s)
  !<
  subroutine k2coll_scamcs(xx, xxp, s)
  
    use mathlib_bouncer
    use mod_ranlux
  
    real(kind=fPrec), intent(inout) :: xx
    real(kind=fPrec), intent(inout) :: xxp
    real(kind=fPrec), intent(in)    :: s
  
    real(kind=fPrec) v1,v2,r2,a,z1,z2,ss,x0,xp0,sss
  
    x0  = xx
    xp0 = xxp
  
  10 continue
    v1 = two*rndm4() - one
    v2 = two*rndm4() - one
    r2 = v1**2 + v2**2
    if(r2 >= one) goto 10
  
    a   = sqrt((-two*log_mb(r2))/r2)
    z1  = v1*a
    z2  = v2*a
    ss  = sqrt(s)
    sss = one + 0.038_fPrec*log_mb(s)
    xx  = x0  + s*(xp0 + ((half*ss)*sss)*(z2 + z1*0.577350269_fPrec))
    xxp = xp0 + (ss*z2)*sss
  
  end subroutine k2coll_scamcs
  
  subroutine k2coll_iterat(a,b,dh,s)
  
    real(kind=fPrec), intent(in)    :: a
    real(kind=fPrec), intent(in)    :: b
    real(kind=fPrec), intent(in)    :: dh
    real(kind=fPrec), intent(inout) :: s
  
    real(kind=fPrec) ds
  
    ds = s
  
  10 continue
    ds = ds*half
  
    if(s**3 < (a+b*s)**2) then
      s = s+ds
    else
      s = s-ds
    end if
  
    if(ds < dh) then
      return
    else
      goto 10
  