anchor.diff:                                                                                      !!  functions (Xd) with respect to the
                                                                                       !!  constraint states (z) [intent in to avoid deallocation]
      REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dZdz(:,:)  !< Partial derivatives of constraint
  -                                                                                    !! state functions (Z) with respect to
  -                                                                                    !!  the constraint states (z) [intent in to avoid deallocation]
      ! Initialize ErrStat
      ErrStat = ErrID_None
      ErrMsg  = ''
  -
      IF ( PRESENT( dYdz ) ) THEN
         ! Calculate the partial derivative of the output functions (Y) with respect to the constraint states (z) here:
         ! allocate and set dYdz
      END IF
  -
      IF ( PRESENT( dXdz ) ) THEN
         ! Calculate the partial derivative of the continuous state functions (X) with respect to the constraint states (z) here:
         ! allocate and set dXdz
      END IF
  -
      IF ( PRESENT( dXddz ) ) THEN
         ! Calculate the partial derivative of the discrete state functions (Xd) with respect to the constraint states (z) here:
         ! allocate and set dXddz
      END IF
  -
      IF ( PRESENT( dZdz ) ) THEN
         ! Calculate the partial derivative of the constraint state functions (Z) with respect to the constraint states (z) here:
         ! allocate and set dZdz
      END IF
  -
  -
   END SUBROUTINE ExtPtfm_JacobianPConstrState
   !----------------------------------------------------------------------------------------------------------------------------------
   !> Routine to pack the data structures representing the operating points into arrays for linearization.
  
positive.code: SUBROUTINE ExtPtfm_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdu, dXdu, dXddu, dZdu)
  !..................................................................................................................................
  
     REAL(DbKi),                                INTENT(IN   )           :: t          !< Time in seconds at operating point
     TYPE(ExtPtfm_InputType),                   INTENT(IN   )           :: u          !< Inputs at operating point (may change to inout if a mesh copy is required)
     TYPE(ExtPtfm_ParameterType),               INTENT(IN   )           :: p          !< Parameters
     TYPE(ExtPtfm_ContinuousStateType),         INTENT(IN   )           :: x          !< Continuous states at operating point
     TYPE(ExtPtfm_DiscreteStateType),           INTENT(IN   )           :: xd         !< Discrete states at operating point
     TYPE(ExtPtfm_ConstraintStateType),         INTENT(IN   )           :: z          !< Constraint states at operating point
     TYPE(ExtPtfm_OtherStateType),              INTENT(IN   )           :: OtherState !< Other states at operating point
     TYPE(ExtPtfm_OutputType),                  INTENT(IN   )           :: y          !< Output (change to inout if a mesh copy is required); 
                                                                                      !!   Output fields are not used by this routine, but type is   
                                                                                      !!   available here so that mesh parameter information (i.e.,  
                                                                                      !!   connectivity) does not have to be recalculated for dYdu.
     TYPE(ExtPtfm_MiscVarType),                 INTENT(INOUT)           :: m          !< Misc/optimization variables
     INTEGER(IntKi),                            INTENT(  OUT)           :: ErrStat    !< Error status of the operation
     CHARACTER(*),                              INTENT(  OUT)           :: ErrMsg     !< Error message if ErrStat /= ErrID_None
     REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dYdu(:,:)  !< Partial derivatives of output functions (Y) with respect 
                                                                                      !!   to the inputs (u) [intent in to avoid deallocation]
     REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dXdu(:,:)  !< Partial derivatives of continuous state functions (X) with 
                                                                                      !!   respect to the inputs (u) [intent in to avoid deallocation]
     REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dXddu(:,:) !< Partial derivatives of discrete state functions (Xd) with 
                                                                                      !!   respect to the inputs (u) [intent in to avoid deallocation]
     REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dZdu(:,:)  !< Partial derivatives of constraint state functions (Z) with 
     ! Initialize ErrStat
     ErrStat = ErrID_None
     ErrMsg  = ''
     IF ( PRESENT( dYdu ) ) THEN
        ! Calculate the partial derivative of the output functions (Y) with respect to the inputs (u) here:
        ! allocate and set dYdu
     END IF
     IF ( PRESENT( dXdu ) ) THEN
        ! Calculate the partial derivative of the continuous state functions (X) with respect to the inputs (u) here:
        ! allocate and set dXdu
     END IF
     IF ( PRESENT( dXddu ) ) THEN
        ! Calculate the partial derivative of the discrete state functions (Xd) with respect to the inputs (u) here:
        ! allocate and set dXddu
     END IF
     IF ( PRESENT( dZdu ) ) THEN
        ! Calculate the partial derivative of the constraint state functions (Z) with respect to the inputs (u) here:
        ! allocate and set dZdu
     END IF
  END SUBROUTINE ExtPtfm_JacobianPInput
  !----------------------------------------------------------------------------------------------------------------------------------
  !> Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions
  
negative.code:                                                                    !!   functions (Xd) with respect to
                                                                     !!   the continuous states (x) [intent in to avoid deallocation]
     REAL(ReKi), ALLOCATABLE, OPTIONAL,  INTENT(INOUT) :: dZdx(:,:)  !< Partial derivatives of constraint state
                                                                     !!   functions (Z) with respect to
                                                                     !!   the continuous states (x) [intent in to avoid deallocation]
     ! Initialize ErrStat
     ErrStat = ErrID_None
     ErrMsg  = ''
     IF ( PRESENT( dYdx ) ) THEN
        ! allocate and set dYdx
        if (.not. allocated(dYdx)) then
            call AllocAry(dYdx, 6, 2*p%nCB, 'dYdx', ErrStat, ErrMsg); if(Failed()) return
        end if
        dYdx(1:6,1:2*p%nCB) = p%CMat(1:6, 1:2*p%nCB)
     END IF
     IF ( PRESENT( dXdx ) ) THEN
        ! allocate and set dXdx
        if (.not. allocated(dXdx)) then
            call AllocAry(dXdx, 2*p%nCB, 2*p%nCB, 'dXdx', ErrStat, ErrMsg); if(Failed()) return
        end if
        dXdx(1:2*p%nCB,1:2*p%nCB) = p%AMat(1:2*p%nCB,1:2*p%nCB)
     END IF
     IF ( PRESENT( dXddx ) ) THEN
     END IF
     IF ( PRESENT( dZdx ) ) THEN
     END IF
  CONTAINS
      logical function Failed()
          CALL SetErrStatSimple(ErrStat, ErrMsg, 'ExtPtfm_JacobianPInput')
          Failed =  ErrStat >= AbortErrLev
      end function Failed
  END SUBROUTINE ExtPtfm_JacobianPContState
  !----------------------------------------------------------------------------------------------------------------------------------
  !> Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions
  