anchor.diff:    use string_tools
     use mathlib_bouncer
     use platofma
  -  use dump, only : dump_fname, dumpfmt, dumpunit, dumpfirst, dumplast, dumptas, dumpclo, dumptasinv
  +  use dump, only : dump_fname, dumpfmt, dumpunit, dumpfirst, dumplast, dump_getTasMatrix
     use numerical_constants, only : zero, one, c1e3
   
     use crcoall
  
positive.code:     fExist = .false.
      do j=-1,nele ! START: loop over dump files = loop over single elements
        if(fma_fname(i) == dump_fname(j)) then
          fExist = .true.
          write(lout,"(3(a,i0))") "FMA> Start FMA analysis using file '"//trim(fma_fname(i))//&
            "': Number of particles = ",napx,", first turn = ",fma_first(i),", last turn = ",fma_last(i)
  
          ! Check the format, if dumpfmt != 2,3 (physical) or 7,8 (normalised) then abort
          if(.not.(dumpfmt(j) == 2 .or. dumpfmt(j) == 3 .or. &
                   dumpfmt(j) == 7 .or. dumpfmt(j) == 8)) then
            write(lerr,"(a)") "FMA> ERROR Input file has wrong format. Choose format 2, 3, 7 or 8 in DUMP block."
            call prror
          end if
  
negative.code:           ! - write closed orbit in header of file with normalised phase space coordinates (tmpUnit)
            !   units: x,xp,y,yp,sig,dp/p = [mm,mrad,mm,mrad,1] (note: units are already changed in linopt part)
            write(tmpUnit,"(a,1x,6(1x,1pe16.9))") "# closorb", &
              dumpclo(1),dumpclo(2),dumpclo(3), &
              dumpclo(4),dumpclo(5),dumpclo(6)
  
            ! - write tas-matrix and its inverse in header of file with normalised phase space coordinates (tmpUnit)
            !   units: x,px,y,py,sig,dp/p [mm,mrad,mm,mrad,1]
            write(tmpUnit,"(a,1x,36(1x,1pe16.9))") "# tamatrix [mm,mrad,mm,mrad,1]", &
              dumptas(1,1),dumptas(1,2),dumptas(1,3),dumptas(1,4), &
              dumptas(1,5),dumptas(1,6),dumptas(2,1),dumptas(2,2), &
              dumptas(2,3),dumptas(2,4),dumptas(2,5),dumptas(2,6), &
              dumptas(3,1),dumptas(3,2),dumptas(3,3),dumptas(3,4), &
              dumptas(3,5),dumptas(3,6),dumptas(4,1),dumptas(4,2), &
              dumptas(4,3),dumptas(4,4),dumptas(4,5),dumptas(4,6), &
              dumptas(5,1),dumptas(5,2),dumptas(5,3),dumptas(5,4), &
              dumptas(5,5),dumptas(5,6),dumptas(6,1),dumptas(6,2), &
              dumptas(6,3),dumptas(6,4),dumptas(6,5),dumptas(6,6)
  
            write(tmpUnit,"(a,1x,36(1x,1pe16.9))") "# inv(tamatrix)", &
              dumptasinv(1,1),dumptasinv(1,2),dumptasinv(1,3), &
              dumptasinv(1,4),dumptasinv(1,5),dumptasinv(1,6), &
              dumptasinv(2,1),dumptasinv(2,2),dumptasinv(2,3), &
              dumptasinv(2,4),dumptasinv(2,5),dumptasinv(2,6), &
              dumptasinv(3,1),dumptasinv(3,2),dumptasinv(3,3), &
              dumptasinv(3,4),dumptasinv(3,5),dumptasinv(3,6), &
              dumptasinv(4,1),dumptasinv(4,2),dumptasinv(4,3), &
              dumptasinv(4,4),dumptasinv(4,5),dumptasinv(4,6), &
              dumptasinv(5,1),dumptasinv(5,2),dumptasinv(5,3), &
              dumptasinv(5,4),dumptasinv(5,5),dumptasinv(5,6), &
              dumptasinv(6,1),dumptasinv(6,2),dumptasinv(6,3), &
              dumptasinv(6,4),dumptasinv(6,5),dumptasinv(6,6)
  
            write(tmpUnit,"(a)") "# id turn pos[m] nx[1.e-3 sqrt(m)] npx[1.e-3 sqrt(m)] ny[1.e-3 sqrt(m)] "//&
              "npy[1.e-3 sqrt(m)] nsig[1.e-3 sqrt(m)] ndp/p[1.e-3 sqrt(m)] kt"
  