anchor.diff:          xp    = xp + Dxp + (two*(rndm4()-half))*xpcrit
           y     = y  + yp * Sdech
   
  -        call calc_ion_loss_cry(is,pc,ldech,dest)
  +        call cry_calcIonLoss(is,pc,ldech,dest)
           pc = pc - half*dest*Ldech ! Energy loss to ionization while in CH [GeV]
           x  = x  + (half*(s_length-Sdech))*xp
           y  = y  + (half*(s_length-Sdech))*yp
   
  -        call calc_ion_loss_cry(is,pc,s_length-sdech,dest)
  -        call move_am(is,nam,s_length-sdech,dest,dlyi(is),dlri(is),xp,yp,pc)
  +        call cry_calcIonLoss(is,pc,s_length-sdech,dest)
  +        call cry_moveAM(is,nam,s_length-sdech,dest,dlyi(is),dlri(is),xp,yp,pc)
           x = x + (half*(s_length-Sdech))*xp
           y = y + (half*(s_length-Sdech))*yp
         else
  
positive.code:     x     = x0 + xp*s
      y     = y0 + yp*s
      iProc = proc_AM
      call calc_ion_loss_cry(is,pc,am_len,dest)
      call move_am(is,nam,am_len,dest,dlyi(is),dlri(is),xp,yp,pc)
      x = x + xp*(s_length-s)
      y = y + yp*(s_length-s)
      return
  
    else if(x > c_xmax-c_alayer .and. x < c_xmax) then
      iProc = proc_AM
      call calc_ion_loss_cry(is,pc,s_length,dest)
      call move_am(is,nam,s_length,dest,dlyi(is),dlri(is),xp,yp,pc)
      return
  
    end if
  
negative.code:             x = x + (half*Rlength)*XP
              y = y + (half*Rlength)*YP
  
              call cry_calcIonLoss(is,pc,rlength,dest)
              pc = pc - dest*Rlength
            else
              Dxp = (Length-Lrefl)/c_rcurv
  