anchor.diff:    double precision, intent(inout) :: delta_ii_(Nstates,Ndet_ref)
   
     integer(bit_kind), intent(in)  :: det_buffer(Nint,2,n_selected)
  -  integer                        :: i,j,k,l
  -  integer                        :: degree_alpha(psi_det_size)
  -  integer                        :: idx_alpha(0:psi_det_size)
  +  integer                        :: i,j,k,l,m
  +  integer                        :: degree_alpha(psi_det_size), degree_alpha_tmp(psi_det_size)
  +  integer                        :: idx_alpha(0:psi_det_size), idx_alpha_tmp(0:psi_det_size)
     logical                        :: good, fullMatch
   
     integer(bit_kind)              :: tq(Nint,2,n_selected)
  
positive.code:     return
    end if
    
    
    call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq,miniList,N_minilist)
    
    allocate (dIa_hla(Nstates,Ndet_non_ref))
    
  
negative.code:       call omp_unset_lock( psi_ref_lock(i_I) )
      enddo
    enddo
    !deallocate (dIa_hla,hij_cache)
    !deallocate(miniList, idx_miniList)
  end
  
  
  
  subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq,miniList,N_miniList)
  