anchor.diff:           
      CALL BD_TiSchmPredictorStep( x_tmp%q,x_tmp%dqdt,OS_tmp%acc,OS_tmp%xcc,             &
                                   p%coef,p%dt,x%q,x%dqdt,OtherState%acc,OtherState%xcc, &
  -                                p%node_total,p%dof_node )
  +                                p%node_total,p%dof_node, ErrStat2,ErrMsg2)
  +      call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
      ! find x at t+dt
  -   CALL BD_InputGlobalLocal(p,u_interp,0,ErrStat2,ErrMsg2)
  +   CALL BD_InputGlobalLocal(p,u_interp,ErrStat2,ErrMsg2)
         call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
      
      CALL BD_BoundaryGA2(x,p,u_interp,t+p%dt,OtherState,ErrStat2,ErrMsg2)
  
positive.code:        ENDDO
         CALL BD_UpdateDynamicGA2(ai,uuNf,vvNf,aaNf,xxNf,coef,node_total,dof_node)
         IF(i==1) THEN
             Eref = SQRT(abs(DOT_PRODUCT(ai_temp,feqv)))*TOLF
             IF(Eref .LE. TOLF) RETURN
         ENDIF
         IF(i .GT. 1) THEN
             Enorm = SQRT(abs(DOT_PRODUCT(ai_temp,feqv)))
             IF(Enorm .LE. Eref) RETURN
         ENDIF
  !WRITE(*,*) 'inc'
  !WRITE(*,*) ai
  
         IF(i==niter) THEN
            CALL setErrStat( ErrID_Fatal, "Solution does not converge after the maximum number of iterations", ErrStat, ErrMsg, RoutineName)
  
negative.code: 
     END SUBROUTINE BD_GenerateDynamicElementGA2
  
     SUBROUTINE BD_InputGlobalLocal( p, u, ErrStat, ErrMsg)
     !-----------------------------------------------------------------------------
     ! This subroutine tranforms the folloing quantities in Input data structure
     ! from global frame to local (blade) frame:
     ! 1 Displacements; 2 Linear/Angular velocities; 3 Linear/Angular accelerations
     ! 4 Piont forces/moments; 5 Distributed forces/moments
     ! It also transforms the DCM to rotation tensor in the input data structure
     !-----------------------------------------------------------------------------
     TYPE(BD_ParameterType), INTENT(IN   ):: p
     TYPE(BD_InputType),     INTENT(INOUT):: u
     INTEGER(IntKi),         INTENT(  OUT):: ErrStat       ! Error status of the operation
     CHARACTER(*),           INTENT(  OUT):: ErrMsg        ! Error message if ErrStat /= ErrID_None
                                                             ! 1: Blade to Global
  