anchor.diff:    !-----------------------------------------------------------------------
     ! A.Mereghetti (CERN, BE-ABP-HSS), 2018-03-21
     ! initialise aperture marker to rectangle
  +  ! - ellipse/octagon intersecting rectangle at corner (m=-1)
  +  ! - no offset for racetrack
     !-----------------------------------------------------------------------
     implicit none
     integer ix
  
positive.code: #endif
  
    implicit none
  
    ! A.Mereghetti, P.Garcia Ortega and D.Sinuela Pastor, for the FLUKA Team
    ! last modified: 02-03-2018
    ! always in main code
  
    logical, save :: limifound=.false.               ! limi block in fort.3
  
  
negative.code: end subroutine aperture_initOC
  
  
  subroutine aperture_initRT( ix, aptx, apty, apex, apey )
    !-----------------------------------------------------------------------
    ! A.Mereghetti (CERN, BE-ABP-HSS), 2018-03-22
    ! initialise aperture marker to racetrack
    !-----------------------------------------------------------------------
    implicit none
    integer ix
    real(kind=fPrec) aptx, apty, apex, apey
    call aperture_nul( ix )
    kape(ix)=6
    ape(1,ix)=aptx+apex ! needed only for interpolation
    ape(2,ix)=apty+apey ! needed only for interpolation
    ape(3,ix)=apex
    ape(4,ix)=apey
    ape(5,ix)=aptx
    ape(6,ix)=apty
    ape(7,ix)=-one
    ape(8,ix)=(sqrt(ape(3,ix)**2+ape(4,ix)**2)+(ape(1,ix)-ape(3,ix)))+(ape(2,ix)-ape(4,ix))
  end subroutine aperture_initRT
  