anchor.diff:        enddo
         hecMAT%indexL(i) = countNon0L_node
         hecMAT%indexU(i) = countNon0U_node
  -
       end do
   
  -    if( is_contact_active ) then
  -      do i = 1, hecMAT%NP
  -        do j = 1, numI_lagrange
  -          countNon0U_lagrange = countNon0U_lagrange + 1
  -          fstrMAT%itemU_lagrange(countNon0U_lagrange) = list_nodeRelated(i)%id_lagrange(j)
  -        enddo
  -        fstrMAT%indexU_lagrange(i) = countNon0U_lagrange
  -      end do
  -    endif
  -
  -    !< finalize list_nodeRelated
       do i = 1, hecMAT%NP
         deallocate(list_nodeRelated(i)%id_node)
         if(associated(list_nodeRelated(i)%id_lagrange)) deallocate(list_nodeRelated(i)%id_lagrange)
  
positive.code:     conMAT%indexU(:)  = hecMAT%indexU(:)
  
      if( is_contact_active ) then
        countNon0L_lagrange = 0
        do i = 1, fstrMAT%num_lagrange
          numI_lagrange = list_nodeRelated(hecMAT%NP+i)%num_lagrange
          do j = 1, numI_lagrange
            countNon0L_lagrange = countNon0L_lagrange + 1
            fstrMAT%itemL_lagrange(countNon0L_lagrange) = list_nodeRelated(hecMAT%NP+i)%id_lagrange(j)
          enddo
          fstrMAT%indexL_lagrange(i) = countNon0L_lagrange
        enddo
      endif
  
      if( is_contact_active ) then
        do i = 1, fstrMAT%num_lagrange
          deallocate(list_nodeRelated(hecMAT%NP+i)%id_lagrange)
        enddo
  
negative.code: 
    end subroutine getNewListOFrelatednodesANDLagrangeMultipliers
  
    !> Construct fstrMAT structure
    subroutine construct_fstrMAT(np,ndof,num_lagrange,numNon0_lagrange,is_contact_active,list_nodeRelated,fstrMAT)
      integer(kind=kint), intent(in)                      :: np
      integer(kind=kint), intent(in)                      :: ndof
      integer(kind=kint), intent(in)                      :: num_lagrange
      integer(kind=kint), intent(in)                      :: numNon0_lagrange
      logical, intent(in)                                 :: is_contact_active
      type(nodeRelated), pointer, intent(in)              :: list_nodeRelated(:) !< nodeRelated structure of matrix
      type(fstrST_matrix_contact_lagrange), intent(inout) :: fstrMAT             !< type fstrST_matrix_contact_lagrange
  
      integer(kind=kint)  :: countNon0U_lagrange, countNon0L_lagrange !< counters of node-based number of non-zero items
      integer(kind=kint)  :: numI_lagrange
      integer(kind=kint)  :: i, j, ierr
  
      fstrMAT%num_lagrange = num_lagrange
      fstrMAT%numL_lagrange = numNon0_lagrange
      fstrMAT%numU_lagrange = numNon0_lagrange
  
      if(associated(fstrMAT%indexL_lagrange).and.associated(fstrMAT%indexU_lagrange)) &
        deallocate(fstrMAT%indexL_lagrange,fstrMAT%indexU_lagrange)
      if(associated(fstrMAT%itemL_lagrange).and.associated(fstrMAT%itemU_lagrange)) &
        deallocate(fstrMAT%itemL_lagrange,fstrMAT%itemU_lagrange)
      if( is_contact_active ) then
        allocate(fstrMAT%indexL_lagrange(0:num_lagrange), fstrMAT%indexU_lagrange(0:np), stat=ierr)
        if ( ierr /= 0) stop " Allocation error, fstrMAT%indexL_lagrange-fstrMAT%indexU_lagrange "
        fstrMAT%indexL_lagrange = 0 ; fstrMAT%indexU_lagrange = 0
        allocate(fstrMAT%itemL_lagrange(numNon0_lagrange), fstrMAT%itemU_lagrange(numNon0_lagrange), stat=ierr)
        if ( ierr /= 0) stop " Allocation error, fstrMAT%itemL_lagrange-fstrMAT%itemU_lagrange "
        fstrMAT%itemL_lagrange = 0 ; fstrMAT%itemU_lagrange = 0
      endif
  
      if( is_contact_active ) then
        ! upper
        countNon0U_lagrange = 0
        do i = 1, np
          numI_lagrange = list_nodeRelated(i)%num_lagrange
          do j = 1, numI_lagrange
            countNon0U_lagrange = countNon0U_lagrange + 1
            fstrMAT%itemU_lagrange(countNon0U_lagrange) = list_nodeRelated(i)%id_lagrange(j)
          enddo
          fstrMAT%indexU_lagrange(i) = countNon0U_lagrange
        end do
  
        ! lower
        countNon0L_lagrange = 0
        do i = 1, num_lagrange
          numI_lagrange = list_nodeRelated(np+i)%num_lagrange
          do j = 1, numI_lagrange
            countNon0L_lagrange = countNon0L_lagrange + 1
            fstrMAT%itemL_lagrange(countNon0L_lagrange) = list_nodeRelated(np+i)%id_lagrange(j)
          enddo
          fstrMAT%indexL_lagrange(i) = countNon0L_lagrange
        enddo
      endif
  
      if(associated(fstrMAT%AL_lagrange)) deallocate(fstrMAT%AL_lagrange)
      if(associated(fstrMAT%AU_lagrange)) deallocate(fstrMAT%AU_lagrange)
      if(associated(fstrMAT%Lagrange)) deallocate(fstrMAT%Lagrange)
  
      if( is_contact_active ) then
        allocate(fstrMAT%AL_lagrange(ndof*numNon0_lagrange), stat=ierr)
        if ( ierr /= 0 ) stop " Allocation error, fstrMAT%AL_lagrange "
        fstrMAT%AL_lagrange = 0.0D0
        allocate(fstrMAT%AU_lagrange(ndof*numNon0_lagrange), stat=ierr)
        if ( ierr /= 0 ) stop " Allocation error, fstrMAT%AU_lagrange "
        fstrMAT%AU_lagrange = 0.0D0
        allocate(fstrMAT%Lagrange(num_lagrange))
        fstrMAT%Lagrange = 0.0D0
      endif
  
    end subroutine
  
    !> Construct new stiffness matrix structure
    subroutine constructNewMatrixStructure(hecMAT,fstrMAT,num_lagrange,numNon0_node,numNon0_lagrange,conMAT,is_contact_active)
  
      type(hecmwST_matrix)                 :: hecMAT !< type hecmwST_matrix
      type(fstrST_matrix_contact_lagrange) :: fstrMAT !< type fstrST_matrix_contact_lagrange
  
      integer(kind=kint), intent(in)       :: num_lagrange
      integer(kind=kint)                   :: numNon0_node, numNon0_lagrange !< node-based number of non-zero items in half of the matrix
      integer(kind=kint)                   :: countNon0L_node, countNon0U_node !< counters of node-based number ofnon-zero items
      integer(kind=kint)                   :: i, j, ierr
      integer(kind=kint)                   :: numI_node
      integer(kind=kint)                   :: ndof, nn
      type(hecmwST_matrix)                 :: conMAT
      logical, intent(in)                  :: is_contact_active
  
      ndof = hecMAT%NDOF
      nn = ndof*ndof
  
      conMAT%N  = hecMAT%N
      conMAT%NP = hecMAT%NP
  