anchor.diff:           call cleanup()
            return
         end if
  +      call ED_DestroyOutput( y_p, ErrStat2, ErrMsg2 ) ! we don't need this any more
         call ED_DestroyOutput( y_m, ErrStat2, ErrMsg2 ) ! we don't need this any more
         
   
  
positive.code:             return
           end if
           
        do i=1,p%DOFs%NActvDOF*2
           
              ! get x_op + delta x
  
negative.code: 
     IF ( p%NumBl == 2 )  THEN ! the 3rd blade overwrites the DOF_Teet position of the array, so don't use an "ELSE" for this statement
        p%DOF_Flag(DOF_Teet) = InputFileData%TeetDOF
        p%DOF_Desc(DOF_Teet) = 'Hub teetering DOF (internal DOF index = DOF_Teet), rad'
     END IF !
  
  
     DO K = 1,p%NumBl
        p%DOF_Flag( DOF_BF(K,1) ) = InputFileData%FlapDOF1
        p%DOF_Desc( DOF_BF(K,1) ) = '1st flapwise bending-mode DOF of blade '//TRIM(Num2LStr( K ))// &
                                    ' (internal DOF index = DOF_BF('         //TRIM(Num2LStr( K ))//',1)), m'
  
        p%DOF_Flag( DOF_BE(K,1) ) = InputFileData%EdgeDOF
        p%DOF_Desc( DOF_BE(K,1) ) = '1st edgewise bending-mode DOF of blade '//TRIM(Num2LStr( K ))// &
                                    ' (internal DOF index = DOF_BE('         //TRIM(Num2LStr( K ))//',1)), m'
  
        p%DOF_Flag( DOF_BF(K,2) ) = InputFileData%FlapDOF2
        p%DOF_Desc( DOF_BF(K,2) ) = '2nd flapwise bending-mode DOF of blade '//TRIM(Num2LStr( K ))// &
                                    ' (internal DOF index = DOF_BF('         //TRIM(Num2LStr( K ))//',2)), m'
     ENDDO          ! K - All blades
  
     p%DOF_Flag(DOF_DrTr) = InputFileData%DrTrDOF
     p%DOF_Desc(DOF_DrTr) = 'Drivetrain rotational-flexibility DOF (internal DOF index = DOF_DrTr), rad'
     p%DOF_Flag(DOF_GeAz) = InputFileData%GenDOF
     p%DOF_Desc(DOF_GeAz) = 'Variable speed generator DOF (internal DOF index = DOF_GeAz), rad'
     p%DOF_Flag(DOF_RFrl) = InputFileData%RFrlDOF
     p%DOF_Desc(DOF_RFrl) = 'Rotor-furl DOF (internal DOF index = DOF_RFrl), rad'
     p%DOF_Flag(DOF_TFrl) = InputFileData%TFrlDOF
     p%DOF_Desc(DOF_TFrl) = 'Tail-furl DOF (internal DOF index = DOF_TFrl), rad'
     p%DOF_Flag(DOF_Yaw ) = InputFileData%YawDOF
     p%DOF_Desc(DOF_Yaw ) = 'Nacelle yaw DOF (internal DOF index = DOF_Yaw), rad'
     p%DOF_Flag(DOF_TFA1) = InputFileData%TwFADOF1
     p%DOF_Desc(DOF_TFA1) = '1st tower fore-aft bending mode DOF (internal DOF index = DOF_TFA1), m'
     p%DOF_Flag(DOF_TSS1) = InputFileData%TwSSDOF1
     p%DOF_Desc(DOF_TSS1) = '1st tower side-to-side bending mode DOF (internal DOF index = DOF_TSS1), m'
     p%DOF_Flag(DOF_TFA2) = InputFileData%TwFADOF2
     p%DOF_Desc(DOF_TFA2) = '2nd tower fore-aft bending mode DOF (internal DOF index = DOF_TFA2), m'
     p%DOF_Flag(DOF_TSS2) = InputFileData%TwSSDOF2
     p%DOF_Desc(DOF_TSS2) = '2nd tower side-to-side bending mode DOF (internal DOF index = DOF_TSS2), m'
     p%DOF_Flag(DOF_Sg  ) = InputFileData%PtfmSgDOF
     p%DOF_Desc(DOF_Sg  ) = 'Platform horizontal surge translation DOF (internal DOF index = DOF_Sg), m'
     p%DOF_Flag(DOF_Sw  ) = InputFileData%PtfmSwDOF
     p%DOF_Desc(DOF_Sw  ) = 'Platform horizontal sway translation DOF (internal DOF index = DOF_Sw), m'
     p%DOF_Flag(DOF_Hv  ) = InputFileData%PtfmHvDOF
     p%DOF_Desc(DOF_Hv  ) = 'Platform vertical heave translation DOF (internal DOF index = DOF_Hv), m'
     p%DOF_Flag(DOF_R   ) = InputFileData%PtfmRDOF
     p%DOF_Desc(DOF_R   ) = 'Platform roll tilt rotation DOF (internal DOF index = DOF_R), rad'
     p%DOF_Flag(DOF_P   ) = InputFileData%PtfmPDOF
     p%DOF_Desc(DOF_P   ) = 'Platform pitch tilt rotation DOF (internal DOF index = DOF_P), rad'
     p%DOF_Flag(DOF_Y   ) = InputFileData%PtfmYDOF
     p%DOF_Desc(DOF_Y   ) = 'Platform yaw rotation DOF (internal DOF index = DOF_Y), rad'
  
     ! ...........................................................................................................................
     ! allocate the arrays stored in the p%DOFs structure:
  