anchor.diff:           
            
         do i=1,NN
  -         
  +         delta = p%dx(i)
               ! get x_op + delta x
            call HydroDyn_CopyContState( x, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 )
               call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later            
  
positive.code:    ErrStat = ErrID_None
     ErrMsg  = ''
     m%IgnoreMod = .true. ! to get true perturbations, we can't use the modulo function
     delta = PI / 90.0_R8Ki
     ! Calculate the partial derivative of the output functions (Y) with respect to the continuous states (x) here:
     NN = p%WAMIT%SS_Exctn%N+p%WAMIT%SS_Rdtn%N
        
  
negative.code:       
     if (n > p%WAMIT%SS_Exctn%N) then
        indx = n - p%WAMIT%SS_Exctn%N
        x%WAMIT%SS_Rdtn%x( indx ) = x%WAMIT%SS_Rdtn%x( indx ) + dx * perturb_sign 
     else
        indx = n
        x%WAMIT%SS_Exctn%x( indx ) = x%WAMIT%SS_Exctn%x( indx ) + dx * perturb_sign 
     end if
                                                  
     END SUBROUTINE HD_Perturb_x
  