anchor.diff:  
       misfit = 0.0d0
   
  -    if (displacement%file.eq.'none') then
  +    if (displacement%file.eq.'none'.and.displacement%flag.ne.'misfit') then
           return
       endif
   
  
positive.code:         endif
      endif
  
      ! Make sure rake_constraint%array is defined (bounds for rake angle values)
      if (rake_constraint%file.eq.'none') then
          call print_usage('!! Error: a rake constraint file is required for simulated annealing')
      else
          if (rake_constraint%nrecords.eq.1) then
              tmparray = rake_constraint%array
              deallocate(rake_constraint%array)
              allocate(rake_constraint%array(fault%nrecords,2))
              do i = 1,fault%nrecords
                  rake_constraint%array(i,1) = tmparray(1,1)
                  rake_constraint%array(i,2) = tmparray(1,2)
              enddo
          endif
      endif
  
      ! Initialize the random number generator
      idum = -timeseed()
  
      ! Allocate memory to the fault slip and rake arrays
      allocate(slip_0(fault%nrecords))
      allocate(slip_new(fault%nrecords))
      allocate(slip_best(fault%nrecords))
      allocate(dslip(fault%nrecords))
      allocate(dslip_init(fault%nrecords))
      allocate(rake_0(fault%nrecords))
      allocate(rake_new(fault%nrecords))
      allocate(rake_best(fault%nrecords))
      allocate(drake(fault%nrecords))
      allocate(drake_init(fault%nrecords))
  
      ! Initialize the fault slip solution
      if (anneal_init_mode.eq.'zero') then
          slip_0 = 0.0d0
          rake_0 = 0.0d0
      elseif (anneal_init_mode.eq.'mean') then
          do i = 1,fault%nrecords
              slip_0(i) = 0.5d0*(slip_constraint%array(i,2)-slip_constraint%array(i,1)) + &
                                   slip_constraint%array(i,1)
              rake_0(i) = 0.5d0*(rake_constraint%array(i,2)-rake_constraint%array(i,1)) + &
                                   rake_constraint%array(i,1)
          enddo
      elseif (anneal_init_mode.eq.'rand'.or.anneal_init_mode.eq.'random') then
          do i = 1,fault%nrecords
              slip_0(i) = ran2(idum)*(slip_constraint%array(i,2)-slip_constraint%array(i,1)) + &
                                   slip_constraint%array(i,1)
              rake_0(i) = ran2(idum)*(rake_constraint%array(i,2)-rake_constraint%array(i,1)) + &
                                   rake_constraint%array(i,1)
          enddo
      ! elseif (anneal_init_mode.eq.'uniform') then
      !     ! same slip on all faults
      else
          call print_usage('!! Error: no annealing mode named '//trim(anneal_init_mode))
      endif
  
      ! Set the first model to be the best model initially
      slip_best = slip_0
      rake_best = rake_0
  
      ! Initialize step sizes for slip magnitude and rake angle
      do i = 1,fault%nrecords
          dslip(i) = (slip_constraint%array(i,2)-slip_constraint%array(i,1))/20.0d0
          drake(i) = (rake_constraint%array(i,2)-rake_constraint%array(i,1))/12.0d0
      enddo
      dslip_init = dslip
      drake_init = drake
  
      if (verbosity.ge.2) then
          write(stderr,'(A)') 'initialize_annealing says: finished'
  
negative.code:         slip_ssds(j,1) = slip_0(j)*dcos(rake_0(j)*d2r)
          slip_ssds(j,2) = slip_0(j)*dsin(rake_0(j)*d2r)
      enddo
      obj_0 = misfit(slip_ssds) + stress_weight*shear_stress(slip_ssds)
      obj_best = obj_0
      last_obj_best = 0
  
  