anchor.diff:        is_single_b(N_det_beta_unique),                                &
         idx(maxab), idx0(maxab))
     
  +  do i=1,maxab
  +    idx0(i) = i
  +  enddo
  +
  +  ! Prepare the array of all alpha single excitations
  +  ! -------------------------------------------------
  +
  +  n_singles_max = 0
  +  do i=1,N_det_alpha_unique
  +    spindet(1:N_int) = psi_det_alpha_unique(1:N_int, i)
  +    call get_all_spin_singles(                                       &
  +        psi_det_alpha_unique, idx0, spindet, N_int, N_det_alpha_unique,&
  +        singles, n_singles)
  +    n_singles_max = max(n_singles_max, n_singles)
  +  enddo
  +
  +  allocate (singles_a(0:n_singles_max, N_det_alpha_unique))
  +  do i=1,N_det_alpha_unique
  +    spindet(1:N_int) = psi_det_alpha_unique(1:N_int, i)
  +    call get_all_spin_singles(                                       &
  +        psi_det_alpha_unique, idx0, spindet, N_int, N_det_alpha_unique,&
  +        singles_a(1,i), singles_a(0,i))
  +  enddo
  +
     v_0 = 0.d0
     do k_a=1,N_det
       
  
positive.code: 
            call i_H_j_double_alpha_beta(tmp_det,tmp_det2,N_int,hij)
            v_0(k_a, 1:N_st) += hij * psi_bilinear_matrix_values(l_a,1:N_st)
          endif
          l_a += 1
  
  
negative.code:   ! Alpha/Beta double excitations
    ! =============================
      
    do k_a=1,N_det
  
      krow = psi_bilinear_matrix_rows(k_a)
      kcol = psi_bilinear_matrix_columns(k_a)
      
  