anchor.diff:    real(kind=fPrec) :: emitX, emitY, emitZ
     integer          :: j
   
  -  ! if (iclo6.eq.0) then
  -  !   write(lout,"(a)") "COLL> ERROR DETECTED: Incompatible flag           "
  -  !   write(lout,"(a)") "COLL> in line 2 of the TRACKING block             "
  -  !   write(lout,"(a)") "COLL> of fort.3 for calculating the closed orbit  "
  -  !   write(lout,"(a)") "COLL> (iclo6 must not be =0). When using an input "
  -  !   write(lout,"(a)") "COLL> distribution in normalized coordinates for  "
  -  !   write(lout,"(a)") "COLL> collimation the closed orbit is needed for a"
  -  !   write(lout,"(a)") "COLL> correct TAS matrix for coordinate transform."
  -  !   call prror(-1)
  -  ! endif
  +  if(iclo6 == 0) then
  +    write(lout,"(a)") "COLLDIST> ERROR The 6D closed orbit (iclo6 > 0) is required for format 6."
  +    call prror
  +  endif
   
     emitX = cdist_emitX
     emitY = cdist_emitY
  -
  -  ! A normalized distribution with x,xp,y,yp,z,zp is read and
  -  ! transformed with the TAS matrix T , which is the transformation matrix
  -  ! from normalized to physical coordinates it is scaled with the geometric
  -  ! emittances in diag matrix S. x = T*S*normx
  -  ! units of TAS matrix # m,rad,m,rad,m,1
  -  ! The collimation coordinates/units are
  -  ! x[m], x'[rad], y[m], y'[rad]$, sig[mm], dE [MeV].
  +  emitZ = cdist_bunchLen*c1m3 * cdist_spreadE
  +
     do j=1,napx
  -    emitZ = cdist_bunchLen*c1m3 * cdist_spreadE
  -
  -    ! Scaling the TAS matrix entries of the longitudinal coordinate. tas(ia,j,k)
  -    ! ia=the particle for which the tas was written
   
       tmpX = &
         xv1(j)   * sqrt(emitX)*tas(1,1,1) + &
  
positive.code:       xv2(j)   * sqrt(emitY)*tas(1,4,3) + &
        yv2(j)   * sqrt(emitY)*tas(1,4,4) + &
        sigmv(j) * sqrt(emitZ)*tas(1,4,5) + &
        ejv(j)   * sqrt(emitZ)*tas(1,4,6)*c1m3
  
      tmpS = &
        xv1(j)   * sqrt(emitX)*tas(1,5,1) + &
  
negative.code: 
  end subroutine cdist_makeDist_fmt5
  
  ! ================================================================================================ !
  !  Generation of Distribution Format 6 (Read File)
  !  Written by:   K.N. Sjobak
  !  Rewritten by: V.K. Berglyd Olsen, 2019-03-26
  !  A normalized distribution with x,xp,y,yp,z,zp is read and transformed with the TAS matrix T,
  !  which is the transformation matrix from normalized to physical coordinates. It is scaled with
  !  the geometric emittances in diag matrix S. x = T*S*normx
  !  Units of TAS matrix # m,rad,m,rad,m,1
  !  The collimation coordinates/units are x[m], x'[rad], y[m], y'[rad]$, sig[mm], dE [MeV].
  ! ================================================================================================ !
  subroutine cdist_makeDist_fmt6
  
    use crcoall
    use parpro
    use mod_common, only : napx, iclo6
    use mod_common_main, only : xv1, xv2, yv1, yv2, ejv, sigmv, tas, clop6v
  
    implicit none
  