anchor.diff:    double precision, allocatable :: WORK(:)
     integer, allocatable :: IWORK(:)
     
  -  print *, "TI", hh_shortcut(hh_shortcut(0)+1)-1, N_det_non_ref
  -  allocate(A(N_det_non_ref, hh_shortcut(hh_shortcut(0)+1)-1))
  +  nex = hh_shortcut(hh_shortcut(0)+1)-1
  +  print *, "TI", nex, N_det_non_ref
  +  allocate(A(N_det_non_ref, nex))
     A = 0d0
     do II = 1, N_det_ref
       do hh = 1, hh_shortcut(0)
  
positive.code:     end do
    end do
    
    double precision :: B(N_det_non_ref), S(N_det_non_ref)
    integer :: rank
    B = psi_non_ref_coef(:,1)
    allocate(WORK(1), IWORK(1))
    call DGELSD(N_det_non_ref, &
                hh_shortcut(hh_shortcut(0)+1)-1, &
                1, &
                A, N_det_non_ref, &
                B, N_det_non_ref, &
                S, &
                1d-6, &
                rank, &
                WORK, -1, &
                IWORK, &
                INFO )
    wk = int(work(1))
    print *, "WORK:", wk
    deallocate(WORK, IWORK)
    allocate(WORK(wk), IWORK(wk))
    call DGELSD(N_det_non_ref, &
                hh_shortcut(hh_shortcut(0)+1)-1, &
                1, &
                A, N_det_non_ref, &
                B, N_det_non_ref, &
                S, &
                1d-6, &
                rank, &
                WORK, size(WORK), &
                IWORK, &
                INFO )
    print *, INFO, size(dIj), size(B)
    dIj(:size(dIj)) = B(:size(dIj))
    print *, "diden"
  END_PROVIDER
  
  
  
negative.code: BEGIN_PROVIDER [ double precision, dIj, (hh_shortcut(hh_shortcut(0)+1)-1) ]
    implicit none
    logical :: ok
    integer :: i, j, k, II, pp, hh, ind, wk, nex
    integer, external :: unsortedSearchDet
    integer(bit_kind) :: myDet(N_int, 2), myMask(N_int, 2)
    double precision, allocatable :: A(:,:)
  