anchor.diff:      do j=comb_teeth+1,1,-1
         if(mrcc_jobs(i) <= first_det_of_teeth(j)) then
           under_det(j) = under_det(j) + 1
  -        if(under_det(j) == first_det_of_teeth(j)) then
  +        if(under_det(j) == first_det_of_teeth(j))then
             do l=done_cp_at(i)+1, N_cp
               cps(:first_det_of_teeth(j)-1, l) = 0d0
               cp_first_tooth(l) = j
             end do
  +          cps(first_det_of_teeth(j), done_cp_at(i)+1) = &
  +              cps(first_det_of_teeth(j), done_cp_at(i)+1) * fractage(j)
           end if
         else
           exit
         end if
       end do
     end do
  +  cps(:, N_cp) = 0d0
  +  cp_first_tooth(N_cp) = comb_teeth+1
  +
   ! end subroutine
   END_PROVIDER
   
   
  -subroutine get_comb_val(stato, detail, first, val)
  -  implicit none
  -  integer, intent(in)           :: first
  +subroutine get_comb_val(stato, detail, cur_cp, val)
  +  implicit none
  +  integer, intent(in)           :: cur_cp
  +  integer                       :: first
     double precision, intent(in)  :: stato, detail(N_states, N_det_generators)
     double precision, intent(out) :: val
     double precision :: curs
  
positive.code:     N_mrcc_jobs = k
    enddo
    N_cp = cur_cp
  
    if(N_mrcc_jobs /= N_det_generators) then
      stop "carlo workcarlo_workbatch"
    end if
  
  
negative.code:   do i=1,comb_teeth
      tooth_of_det(first_det_of_teeth(i):first_det_of_teeth(i+1)-1) = i
    end do
  
    !double precision :: cur
    !fractage = 1d0
    !do i=1,comb_teeth-1
    !  cur = 1d0 - dfloat(i)*comb_step
      
    !end do
  END_PROVIDER
  
  
  