anchor.diff:          !       sym_max.
   
           use const, only: i0, p, depsilon
  -        use checking, only: check_allocate
  +        use checking, only: check_allocate, check_deallocate
           use errors, only: stop_all
   
           use determinants, only: encode_det
           use symmetry, only: symmetry_orb_list
           use system
           use parallel, only: parent
  +        use ranking, only: insertion_rank
   
           type(sys_t), intent(in) :: sys
           integer, intent(inout), allocatable :: occ_list(:)
  
positive.code:                                 call stop_all('set_reference_det', &
                                      'Could not find determinant of required symmetry.')
                              end if
  
                          end if
                      end if
                  else
  
negative.code:         integer(i0) :: f(sys%basis%string_len)
          real(p) :: eigv_sum, sp_eigv_sum
          logical :: set
  
          integer, allocatable :: rank(:)
  
          ! Leave the reference determinant unchanged if it's already been
          ! allocated (and presumably set).
  