anchor.diff:  
   subroutine write_solution()
   use io_module, only: stdout
  -use variable_module, only: output_file, inversion_mode, fault, fault_slip, rake_constraint
  +use variable_module, only: output_file, inversion_mode, fault, fault_slip, rake_constraint, &
  +                           disp_misfit_file
  +use anneal_module, only: misfit
   implicit none
   ! Local variables
   integer :: i, ounit
  -double precision :: slip_mag
  -
  +double precision :: slip_mag, tmp_slip_array(fault%nrecords,2)
  +
  +! Print misfit if specified
  +if (disp_misfit_file.ne.'none') then
  +    open(unit=81,file=disp_misfit_file,status='unknown')
  +
  +    ! If rake is constrained, make an array of the correct size to use with misfit function
  +    if (inversion_mode.eq.'lsqr'.and.rake_constraint%file.ne.'none') then
  +        do i = 1,fault%nrecords
  +            tmp_slip_array(i,1) = fault_slip(i,1) ! Green's functions already calculated for this rake
  +            tmp_slip_array(i,2) = 0.0d0
  +        enddo
  +        write(81,*) misfit(tmp_slip_array)
  +
  +    ! Otherwise, just use the misfit function directly
  +    else
  +        write(81,*) misfit(fault_slip)
  +    endif
  +    close(81)
  +endif
  +
  +! Print fault slip solution
   if (output_file.eq.'stdout') then
       ounit = stdout
   else
  
positive.code:     call invert_lsqr()
  elseif (inversion_mode.eq.'anneal') then
      call invert_anneal()
  else
      call print_usage('!! Error: no inversion mode named '//trim(inversion_mode))
  endif
  
negative.code:                            displacement, prestress, fault, &
                             gf_type, gf_disp, gf_stress, &
                             smoothing, rake_constraint, slip_constraint, &
                             halfspace, coord_type
  use elast_module, only: calc_plane_unit_vectors, calc_traction, calc_traction_components
  implicit none
  ! Local variables
  integer :: i
  double precision :: stress(3,3), nor(3), str(3), upd(3), traction(3), traction_comp(3)
  double precision :: reflon, reflat, dist, az
  
  if (verbosity.ge.1) then
      write(stderr,'(A)') 'read_fltinv_inputs says: starting'
  