anchor.diff:       ! print the summary of the newton iteration
        !----------------------------------------------------------------!
        write(*,'(f15.2,e15.6,e15.6,e15.6,e15.6,e15.6,xi4,xi8)') &
  -          &time, update_norm, res_norm, body1%KE, body1%PE, &
  +          & time, update_norm, res_norm, body1%KE, body1%PE, &
             & body1%KE + body1%PE, newton_cnt, fcnt
   
        time = time + dT ! update the time
  
positive.code: 
          q            = get_updated_q(q, dq)
          q_dot        = get_updated_q_dot(q_dot, dq)
          ! q_double_dot = get_updated_q_double_dot(q_double_dot, dq) 
  
          !-------------------------------------------------------------!
          ! Check for convergence and stop is necessary
          !-------------------------------------------------------------!
  
          !is converged?
          if ( update_norm .le. ABS_TOL .AND. res_norm .le. ABS_TOL) &
               & exit newton
          
          ! is disverged?
          if ( update_norm .ge. 1.0d5 .AND. res_norm .le. 1.0d5) then
             call disp(" > Solution diverging - aborting time integrtn")
             exit newton
          end if
          
          !? max iters reached
          if (k .eq. MAX_NEWTON_ITER) then
             call disp(" >> Newton solution failed in ", k , "iterations")
  
negative.code: 
    ! import the necessary modules
    use global_constants, only: sp, dp, NUM_SPAT_DIM, TOT_NDOF
    use global_variables, only: ABS_TOL, REL_TOL, start_time, dT, &
         & end_time, aa, bb, MAX_NEWTON_ITER, fcnt, init, time
    use utils, only:deg2rad
    use types, only: body, vector
    use solver_utils, only: get_updated_q, get_updated_q_dot,&
         & get_updated_q_double_dot, get_approx_q, get_approx_q_dot
    use bodies, only: create_body, set_state
    use residual, only: get_residual
    use jacobian, only: get_jacobian
    use finite_diff, only: finite_difference2
    use linear_system, only: direct_solve
    use bodies, only: print_body, create_body
    use dispmodule, only: disp
    use filehandler
  
    implicit none
  