anchor.diff:            enddo
           enddo
         enddo
  +      ! copy from hecMAT; externl
  +      ls = hecMAT%indexU(i-1)+1
  +      le = hecMAT%indexU(i)
  +      do l=ls,le
  +        ll = hecMAT%itemU(l)
  +        if (ll <= hecMAT%N) cycle  ! skip internal
  +        hecMATLag%itemU(idx) = ll + nb_lag
  +        hecMATLag%AU((idx-1)*ndof2+1:idx*ndof2)=hecMAT%AU((l-1)*ndof2+1:l*ndof2)
  +        idx = idx + 1
  +      enddo
  +      if (idx /= hecMATLag%indexU(i)+1) stop 'ERROR idx indexU'
       enddo
   
       ! Lower: itemL and AL
       allocate(hecMATLag%itemL(hecMATLag%NPL))
       allocate(hecMATLag%AL(hecMATLag%NPL*ndof2))
  -    do i = 1, hecMAT%NPL
  +    do i = 1, hecMAT%indexL(hecMAT%N)
         hecMATLag%itemL(i) = hecMAT%itemL(i)
       enddo
  -    do i = 1, hecMAT%NPL*ndof2
  +    do i = 1, hecMAT%indexL(hecMAT%N)*ndof2
         hecMATLag%AL(i) = hecMAT%AL(i)
       enddo
       ! Lag. itemL
  -    k = hecMAT%NPL + 1
  +    idx = hecMAT%indexL(hecMAT%N) + 1
       do ib_lag = 1, nb_lag
         iwLc = 0
         i = hecMAT%N + ib_lag
  
positive.code:         le=fstrMAT%indexL_lagrange(ilag)
          do l=ls,le
            j=fstrMAT%itemL_lagrange(l)
            ks=hecMATLag%indexL(i-1)+1
            ke=hecMATLag%indexL(i)
            do k = ks, ke
              if (hecMATLag%itemL(k) < j) cycle
              if (hecMATLag%itemL(k) > j) cycle
              !if (hecMATLag%itemL(k) /= j) stop 'ERROR itemL j'
  
negative.code: 
      deallocate(iwUr, iwUc, iwLr, iwLc)
  
      allocate(hecMATLag%D(hecMATLag%NP*ndof2))
      hecMATLag%D = 0.d0
      do i = 1, hecMAT%N*ndof2
        hecMATLag%D(i) = hecMAT%D(i)
      enddo
      do idof = ndof - ndofextra + 1, ndof
        hecMATLag%D((hecMATLag%N-1)*ndof2 + (idof-1)*ndof + idof) = 1.d0
      enddo
      do i = hecMAT%N*ndof2, hecMAT%NP*ndof2
        hecMATLag%D(i + nb_lag) = hecMAT%D(i)
      enddo
  
      allocate(hecMATLag%B(hecMATLag%NP*ndof))
      allocate(hecMATLag%X(hecMATLag%NP*ndof))
      hecMATLag%B = 0.d0
      hecMATLag%X = 0.d0
  
      do i = 1, hecMAT%N*ndof
        hecMATLag%B(i) = hecMAT%B(i)
      enddo
      do i = 1, fstrMAT%num_lagrange
        hecMATLag%B(hecMAT%N*ndof + i) = hecMAT%B(hecMAT%NP*ndof + i)
      enddo
      do i = hecMAT%N*ndof+1, hecMAT%NP*ndof
        hecMATlag%B(i + nb_lag) = hecMAT%B(i)
      enddo
  
      hecMATLag%Iarray=hecMAT%Iarray
  