anchor.diff:  end interface
   
     ! "Old" variables
  -  integer i,itiono,i2,i3,ia,ia2,iar,iation,ib,ib0,ib1,ib2,ib3,id,ie,ig,ii,im,iposc,ix,izu,j,j2,jj,  &
  +  integer i,itiono,i2,i3,ia,ia2,iar,iation,ib0,ib1,ib2,ib3,id,ie,ig,ii,im,iposc,ix,izu,j,j2,jj,  &
       k,kpz,kzz,l,ll,ncorruo,ncrr,nd,nd2,ndafi2,nerror,nlino,nlinoo,nmz,nthinerr
     real(kind=fPrec) alf0s1,alf0s2,alf0s3,alf0x2,alf0x3,alf0z2,alf0z3,amp00,bet0s1,bet0s2,bet0s3,     &
  -    bet0x2,bet0x3,bet0z2,bet0z3,chi,coc,dam1,dchi,ddp1,dp0,dp00,dp10,dpsic,dps0,dsign,gam0s1,gam0s2,&
  +    bet0x2,bet0x3,bet0z2,bet0z3,chi,coc,dam1,dchi,dp0,dp00,dp10,dpsic,dps0,dsign,gam0s1,gam0s2,&
       gam0s3,gam0x1,gam0x2,gam0x3,gam0z1,gam0z2,gam0z3,phag,r0,r0a,rat0,sic,tasia56,tasiar16,tasiar26,&
       tasiar36,tasiar46,tasiar56,tasiar61,tasiar62,tasiar63,tasiar64,tasiar65,taus,x11,x13,damp
     integer idummy(6)
  
positive.code:               enddo
              endif
  
              do 170 i=1,napx
                iar=(ib-1)*napx+i
                clo6v(1,iar)=clo(1)
                clop6v(1,iar)=clop(1)
                clo6v(2,iar)=clo(2)
                clop6v(2,iar)=clop(2)
                di0xs(iar)=di0(1)
                di0zs(iar)=di0(2)
                dip0xs(iar)=dip0(1)
                dip0zs(iar)=dip0(2)
                qwcs(iar,1)=qwc(1)
                qwcs(iar,2)=qwc(2)
                qwcs(iar,3)=zero
  
                do i2=1,4
                  do j2=1,4
                    tas(iar,i2,j2)=tasm(i2,j2)
                  end do
                end do
  
    170       continue
            endif
            iar=(ib-1)*napx+1
  
  ! save tas matrix and closed orbit for later dumping of the beam
  ! distribution at the first element (i=-1)
  
negative.code:               enddo
              endif
  
              do ib1=1,napx
                !--beam-beam element
                clo6v(1,ib1)  = clo6(1)
                clo6v(2,ib1)  = clo6(2)
                clo6v(3,ib1)  = clo6(3)
                clop6v(1,ib1) = clop6(1)
                clop6v(2,ib1) = clop6(2)
                clop6v(3,ib1) = clop6(3)
                di0xs(ib1)    = di0(1)
                di0zs(ib1)    = di0(2)
                dip0xs(ib1)   = dip0(1)
                dip0zs(ib1)   = dip0(2)
                qwcs(ib1,1)   = qwc(1)
                qwcs(ib1,2)   = qwc(2)
                qwcs(ib1,3)   = qwc(3)
  
                do i2=1,6
                  do j2=1,6
                    tas(ib1,i2,j2)=tasm(i2,j2)
                  end do
                end do
              end do
  
            else
              if(idp.eq.1.and.iation.eq.1) then
                ncorruo=ncorru
                ncorru=1
                call clorb(zero)
                call betalf(zero,qw)
                call phasad(zero,qwc)
  !--beam-beam element
                if(nbeam.ge.1) then
                  nd=3
                  nd2=6
  #include "include/beamcou.f90"
                endif
                ncorru=ncorruo
                iqmodc=3
                call mydaini(2,2,6,3,6,1)
                do i=1,2
                  qwc(i)=real(int(qwc(i)),fPrec)+wxys(i)
                enddo
                if(ilin.ge.2) then
                  nlinoo=nlin
                  nlin=nlino
                  ilinc=1
                  call mydaini(2,2,6,3,6,1)
                  nlin=nlinoo
                endif
              else
  