anchor.diff:  
   
            ! Solve for X in A*X=B to get the displacement of blade under static load.
  -       CALL LAPACK_getrf( p%dof_total-p%dof_node, p%dof_total-p%dof_node, m%LP_StifK_LU, m%LP_indx, ErrStat2, ErrMsg2);    CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
  -       CALL LAPACK_getrs( 'N',p%dof_total-p%dof_node, m%LP_StifK_LU, m%LP_indx, m%LP_RHS_LU, ErrStat2, ErrMsg2);  CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
  +       CALL LAPACK_getrf( p%dof_total-p%dof_node, p%dof_total-p%dof_node, m%LP_StifK_LU, m%LP_indx, ErrStat2, ErrMsg2)
  +            CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
  +       CALL LAPACK_getrs( 'N',p%dof_total-p%dof_node, m%LP_StifK_LU, m%LP_indx, m%LP_RHS_LU, ErrStat2, ErrMsg2)
  +            CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
   
   
            ! Reshape to BeamDyn arrays
  
positive.code:       CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
        if (ErrStat >= AbortErrLev) return
  
     i = 1
     piter = 0
     DO WHILE(i .NE. 0)
  !       k=i
            ! Gradually increase load?
         DO j=1,i         !k
             u_temp%PointLoad%Force(:,:) = u_interp%PointLoad%Force(:,:)/i*j
             u_temp%PointLoad%Moment(:,:) = u_interp%PointLoad%Moment(:,:)/i*j
             u_temp%DistrLoad%Force(:,:) = u_interp%DistrLoad%Force(:,:)/i*j
             u_temp%DistrLoad%Moment(:,:) = u_interp%DistrLoad%Moment(:,:)/i*j
             gravity_temp(:) = p%gravity(:)/i*j
             CALL BD_StaticSolution(x, gravity_temp, u_temp, p, m, piter, ErrStat2, ErrMsg2)
                 call SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg, RoutineName)
             IF(p%niter .EQ. piter) EXIT
         ENDDO
  
           ! Check if converged?
         IF(piter .LT. p%niter) THEN
             i=0
         ELSE
             IF(i .EQ. p%niter) THEN
                 call SetErrStat( ErrID_Fatal, "Solution does not converge after the maximum number of load steps.", &
                                  ErrStat,ErrMsg, RoutineName)
                 CALL WrScr( "Maxium number of load steps reached. Exit BeamDyn")
                 EXIT
             ENDIF
  
                 ! Warn the user that additional steps are needed.
            if (i==1) call WrScr( "Warning: Load may be too large, BeamDyn will attempt to solve with additional steps.")
  
                 ! Increment the number of steps
            i=i+1
            call WrScr( "  Load_Step="//trim(num2lstr(i)) )
  
                 ! Reset the displacements
            x%q = 0.0_BDKi
                 ! If we reached this point, we must reset the err status, otherwise we will report back that this
                 ! failed once a sufficient number of load steps was reached and a solution found.
            ErrStat = ErrID_None
            ErrMsg  = ""
         ENDIF
     ENDDO
  
     if (ErrStat >= AbortErrLev) then
        call cleanup()
  
negative.code:    INTEGER(IntKi)                                :: j
     INTEGER(IntKi)                                :: piter
     REAL(BDKi)                                    :: gravity_temp(3)
     REAL(BDKi)                                    :: load_works    
     REAL(BDKi)                                    :: load_works_not
     REAL(BDKi)                                    :: load_test
     TYPE(BD_ContinuousStateType)                  :: x_works
     LOGICAL                                       :: solved
     INTEGER(IntKi)                                :: ErrStat2                     ! Temporary Error status
     CHARACTER(ErrMsgLen)                          :: ErrMsg2                      ! Temporary Error message
     CHARACTER(*), PARAMETER                       :: RoutineName = 'BD_Static'
  