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:    if ( allocated(InitOut%DerivOrder_x) ) InitOut%DerivOrder_x = 1
     
     ! set perturbation sizes: p%dx
     p%dx  = 2.0_R8Ki * D2R_D 
  
     modLabels = (/'Exctn     ','Rdtn      '/)
     dofLabels = (/'PtfmSg    ','PtfmSw    ','PtfmHv    ','PtfmR     ','PtfmP     ','PtfmY     '/)
     
        ! set linearization state names:
     do k = 1, 2
        if (k == 2) spdof = p%WAMIT%SS_Rdtn%N  / 6
          
        do j = 1, 6
  
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
  