anchor.diff:    integer :: tbc(0:N_det_generators)
     integer :: i, Ncomb, generator_per_task, i_generator_end
     integer, external :: pt2_find
  +  
  +  double precision :: sumabove(comb_teeth), sum2above(comb_teeth), Nabove(comb_teeth)
  +  double precision, external :: omp_get_wtime 
  +  double precision :: time0, time
  +
  +  
     provide nproc
   
  +  call random_seed()
  +  
  +  computed = .false.
  +  tbc(0) = first_det_of_comb - 1
  +  do i=1, tbc(0)
  +    tbc(i) = i
  +    computed(i) = .true.
  +  end do
  +  pt2_detail = 0d0
  +
  +  time0 = omp_get_wtime()
  +  print *, "grep - time - avg - err - n_combs"
  +  do while(.true.)
  +  
     call new_parallel_job(zmq_to_qp_run_socket,"pt2")
     call zmq_put_psi(zmq_to_qp_run_socket,1,ci_electronic_energy,size(ci_electronic_energy))
     call zmq_set_running(zmq_to_qp_run_socket)
     call create_selection_buffer(1, 1*2, b)
      
   
  -  call random_seed()
  -
  -  computed = .false.
  -  tbc(0) = first_det_of_comb - 1
  -  do i=1, tbc(0)
  -    tbc(i) = i
  -    computed(i) = .true.
  -  end do
  -  print *, "detererminist initial ", tbc(0)+1
  -  !LOOP?
  +
  +
  +
  +
     call get_carlo_workbatch(1d-3, computed, comb, Ncomb, tbc)
     generator_per_task = tbc(0)/1000 + 1
  -  print *, "TASK", tbc(0), tbc(1:tbc(0))
     do i=1,tbc(0),generator_per_task
       i_generator_end = min(i+generator_per_task-1, tbc(0))
       !print *, "TASK", (i_generator_end-i+1), tbc(i:i_generator_end)
       write(task,*) (i_generator_end-i+1), tbc(i:i_generator_end)
       call add_task_to_taskserver(zmq_to_qp_run_socket,task)
     end do
  -  pt2_detail = 0d0
     
     !$OMP PARALLEL DEFAULT(shared)  SHARED(b, pt2)  PRIVATE(i) NUM_THREADS(nproc+1)
       i = omp_get_thread_num()
  
positive.code: 
  
    type(selection_buffer), intent(inout) :: b
    double precision, intent(out)       :: pt2_detail(N_states, N_det)
    double precision                   :: pt2_mwen(N_states, N_det)
    integer(ZMQ_PTR),external      :: new_zmq_to_qp_run_socket
    integer(ZMQ_PTR)               :: zmq_to_qp_run_socket
  
negative.code:     first_det_of_teeth(i) = pt2_find(stato, cweight)
      stato -= comb_step
    end do
    first_det_of_teeth(comb_teeth+1) = N_det_generators + 1
    if(first_det_of_teeth(1) /= first_det_of_comb) stop "comb provider"
    
  END_PROVIDER
  
  
  