anchor.diff:     CALL BD_CopyOtherState(OtherState, OS_tmp, MESH_NEWCOPY, ErrStat, ErrMsg)
      CALL BD_CopyInput(u, u_tmp, MESH_NEWCOPY, ErrStat, ErrMsg)
   
  -   CALL BD_MotionTensor(p%GlbRot,p%GlbPos,MoTens,0)
      DO i=1,p%elem_total
          DO j=1,p%node_elem
              temp_id = ((i-1)*(p%node_elem-1)+j-1)*p%dof_node
  
positive.code:                                     temp_Force)
     ENDIF
  
     CALL BD_MotionTensor(p%GlbRot,p%GlbPos,MoTens,1)
     temp6(:) = 0.0D0
     IF(p%analysis_type .EQ. 2) THEN
  !       temp6(:) = temp_ReactionForce(1:6)
         temp6(1:6) = -OS_tmp%Acc(1:6)
         temp6(:) = MATMUL(TRANSPOSE(MoTens),temp6)
         y%ReactionForce%Force(1:3,1) = temp6(1:3)
         y%ReactionForce%Moment(1:3,1) = temp6(4:6)
     ENDIF
     DO i=1,p%node_total
         temp_id = (i-1)*p%dof_node
         temp6(:) = 0.0D0
         temp6(:) = temp_Force(temp_id+1:temp_id+6)
         temp6(:) = MATMUL(TRANSPOSE(MoTens),temp6)
         y%BldForce%Force(1:3,i) = temp6(1:3)
         y%BldForce%Moment(1:3,i) = temp6(4:6)
     ENDDO
  
  !   CALL BD_CopyOtherState(OS_tmp, OtherState, MESH_NEWCOPY, ErrStat, ErrMsg)
  !   OtherState%Acc(1:3) = u_tmp%RootMotion%TranslationAcc(1:3,1)
  !   OtherState%Acc(4:6) = u_tmp%RootMotion%RotationAcc(1:3,1)
  !   OtherState%Xcc(:) = OtherState%Acc(:)
  
     CALL BD_DestroyInput(u_tmp, ErrStat, ErrMsg)
     CALL BD_DestroyContState(x_tmp, ErrStat, ErrMsg )
  
negative.code:            y%BldMotion%Orientation(1:3,1:3,temp_id2) = temp_R(1:3,1:3)
  
             temp_id = ((i-1)*(p%node_elem-1)+j-1)*p%dof_node
             y%BldMotion%TranslationVel(1:3,temp_id2) = MATMUL(p%GlbRot,x%dqdt(temp_id+1:temp_id+3))
             y%BldMotion%RotationVel(1:3,temp_id2) = MATMUL(p%GlbRot,x%dqdt(temp_id+4:temp_id+6))
         ENDDO
     ENDDO
  
     CALL BD_InputGlobalLocal(p,u_tmp,0)
     CALL BD_BoundaryGA2(x_tmp,p,u_tmp,t,OS_tmp,ErrStat,ErrMsg)
     IF(p%analysis_type .EQ. 2) THEN
         CALL BD_CalcForceAcc(u_tmp,p,x_tmp,OS_tmp)
         DO i=1,p%elem_total
             DO j=1,p%node_elem
                 temp_id = ((i-1)*(p%node_elem-1)+j-1)*p%dof_node
  