anchor.diff:  #ifdef FLUKA
         if(nlostp(j).le.aperture_napxStart) then
   #else
  -      if(((nlostp(j).le.aperture_napxStart) .and. do_coll) &
  -           .or. .not.do_coll) then
  -#endif
  -         pstop(nlostp(j))=.true.
  -         ! Record for postpr
  -         if(.not.limifound.or.kape(ix).eq.0) then
  -           aperv(nlostp(j),1) = aper(1)
  -           aperv(nlostp(j),2) = aper(2)
  -         else
  -           aperv(nlostp(j),1) = min(ape(1,ix),ape(3,ix))
  -           aperv(nlostp(j),2) = min(ape(2,ix),ape(4,ix))
  -         end if
  -         ixv(nlostp(j))     = ix
  -         xvl(1,nlostp(j))   = xlos(1)
  -         xvl(2,nlostp(j))   = xlos(2)
  -         yvl(1,nlostp(j))   = ylos(1)
  -         yvl(2,nlostp(j))   = ylos(2)
  -         dpsvl(nlostp(j))   = dpsvlos
  -         ejvl(nlostp(j))    = ejvlos
  -         sigmvl(nlostp(j))  = sigmvlos
  -         numxv(nlostp(j))   = numx
  -         nnumxv(nlostp(j))  = numx
  -
  -      end if !  (nlostp(j).le.aperture_napxStart) OR
  -             ! ((nlostp(j).le.aperture_napxStart) .and. do_coll)
  +      if(((nlostp(j).le.aperture_napxStart) .and. do_coll) .or. .not.do_coll) then
  +#endif
  +        pstop(nlostp(j))=.true.
  +        ! Record for postpr
  +        if(.not.limifound.or.kape(ix).eq.0) then
  +          aperv(nlostp(j),1) = aper(1)
  +          aperv(nlostp(j),2) = aper(2)
  +        else
  +          aperv(nlostp(j),1) = min(ape(1,ix),ape(3,ix))
  +          aperv(nlostp(j),2) = min(ape(2,ix),ape(4,ix))
  +        end if
  +        ixv(nlostp(j))     = ix
  +        xvl(1,nlostp(j))   = xlos(1)
  +        xvl(2,nlostp(j))   = xlos(2)
  +        yvl(1,nlostp(j))   = ylos(1)
  +        yvl(2,nlostp(j))   = ylos(2)
  +        dpsvl(nlostp(j))   = dpsvlos
  +        ejvl(nlostp(j))    = ejvlos
  +        sigmvl(nlostp(j))  = sigmvlos
  +        numxv(nlostp(j))   = numx
  +        nnumxv(nlostp(j))  = numx
  +#ifdef FLUKA
  +      end if ! nlostp(j).le.aperture_napxStart
  +#else
  +      end if ! (nlostp(j).le.aperture_napxStart .and. do_coll) .or. .not.do_coll
  +#endif
   
   1982  continue
   
  
positive.code:           if(plost(jj).ne.0) then
  #ifdef FLUKA
              if( fluka_uid(j).eq.plost(jj).or. fluka_gen(j).eq.plost(jj) ) then
  #else
              if ( (     do_coll .and. (  ipart(j) .eq. plost(jj) )) .or. &
                   (.not.do_coll .and. ( nlostp(j) .eq. plost(jj) ))       ) then
  #endif
                lparID=.true.
              end if
  
              jjx=jj+1 !points to the last zero
            end if
  
negative.code:         this_name = trim(adjustl(bez(ix))) // C_NULL_CHAR
  #if defined(FLUKA)
          call ApertureCheckWriteLossParticleF(turn, i, ix, this_name, len_trim(this_name), slos, &
            fluka_uid(j), fluka_gen(j), fluka_weight(j), &
            xlos(1)*c1m3, ylos(1)*c1m3, xlos(2)*c1m3, ylos(2)*c1m3, ejfvlos*c1m3, (ejvlos-e0)*c1e6, &
            -c1m3 * (sigmvlos/clight) * (e0/e0f), naalos, nzzlos)
  #else
          call ApertureCheckWriteLossParticle(turn, i, ix, this_name, len_trim(this_name), slos, plost(j),&
            xlos(1)*c1m3, ylos(1)*c1m3, xlos(2)*c1m3, ylos(2)*c1m3, ejfvlos*c1m3, (ejvlos-e0)*c1e6, &
            -c1m3 * (sigmvlos/clight) * (e0/e0f), naalos, nzzlos)
  #endif
        end if
  #endif
  