anchor.diff:            double precision :: i_H_psi_value(N_states), i_H_psi_value2(N_states)
             i_H_psi_value = 0d0
             i_H_psi_value2 = 0d0
  +          
             integer :: sporb
   !           call i_H_psi(exc_det,psi_selectors,psi_selectors_coef,N_int,N_det_selectors,psi_selectors_size,N_states,i_H_psi_value)
             
  -!           call check_past(exc_det, microlist(1,1,ptr_microlist(sporb)), idx_microlist(ptr_microlist(sporb)), N_microlist(sporb), i_generator, nok, N_int)
  -!           if(nok) cycle
  -!           
  +          
  +          
   !           call check_past(exc_det, microlist, idx_microlist, N_microlist(0), i_generator, nok, N_int)
   !           if(nok) cycle
  -!           
  +          
  +          nok = .false.
  +          call check_past(exc_det, microlist(1,1,ptr_microlist(sporb)), idx_microlist(ptr_microlist(sporb)), N_microlist(sporb), i_generator, nok, N_int)
  +          if(nok) cycle
   
             if(N_microlist(0) > 0) call i_H_psi(exc_det,microlist,psi_coef_microlist,N_int,N_microlist(0),psi_selectors_size*4,N_states,i_H_psi_value)
             if(N_microlist(sporb) > 0) call i_H_psi(exc_det,microlist(1,1,ptr_microlist(sporb)),psi_coef_microlist(ptr_microlist(sporb), 1),N_int,N_microlist(sporb),psi_selectors_size*4,N_states,i_H_psi_value2)
             i_H_psi_value = i_H_psi_value + i_H_psi_value2
  +          
  +          integer :: c1, c2
  +          double precision :: hij
  +          c1 = ptr_tmicrolist(p1)
  +          c2 = ptr_tmicrolist(p2)
  +          do while(.true.)
  +            if(c1 >= ptr_tmicrolist(p1+1) .or. c2 >= ptr_tmicrolist(p2+1)) then
  +              call i_H_psi(exc_det,tmicrolist(1,1,c1),psi_coef_tmicrolist(c1, 1),N_int, ptr_tmicrolist(p1+1)-c1 ,psi_selectors_size*4,N_states,i_H_psi_value2)
  +              i_H_psi_value = i_H_psi_value + i_H_psi_value2
  +              
  +              call i_H_psi(exc_det,tmicrolist(1,1,c2),psi_coef_tmicrolist(c2, 1),N_int, ptr_tmicrolist(p2+1)-c2 ,psi_selectors_size*4,N_states,i_H_psi_value2)
  +              i_H_psi_value = i_H_psi_value + i_H_psi_value2
  +              exit
  +            endif
  +            
  +            if(idx_tmicrolist(c1) < idx_tmicrolist(c2)) then
  +              call i_H_j(exc_det,tmicrolist(1,1,c1),N_int,hij)
  +              do j = 1, N_states
  +                i_H_psi_value(j) = i_H_psi_value(j) + psi_coef_tmicrolist(c1,j)*hij
  +              enddo
  +              c1 += 1
  +            else
  +              call i_H_j(exc_det,tmicrolist(1,1,c2),N_int,hij)
  +              do j = 1, N_states
  +                i_H_psi_value(j) = i_H_psi_value(j) + psi_coef_tmicrolist(c2,j)*hij
  +              enddo
  +              if(idx_tmicrolist(c1) == idx_tmicrolist(c2)) c1 = c1 + 1
  +              c2 += 1
  +            end if
  +          enddo
  +          
             double precision :: Hii, diag_H_mat_elem_fock
             Hii = diag_H_mat_elem_fock(psi_det_generators(1,1,i_generator),exc_det,fock_diag_tmp,N_int)
             double precision :: delta_E, e_pert
  
positive.code: !           call i_H_psi(exc_det,psi_selectors,psi_selectors_coef,N_int,N_det_selectors,psi_selectors_size,N_states,i_H_psi_value)
  !               
            nok = .false.
            sporb = i_particle + (ispin - 1) * mo_tot_num
  ! !           
  !           if(N_microlist(sporb) > 0) call check_past(exc_det, microlist(1,1,ptr_microlist(sporb)), idx_microlist(ptr_microlist(sporb)), N_microlist(sporb), i_generator, nok, N_int)
  !           if(nok) cycle
  !         
            
            if(N_microlist(0) > 0) call i_H_psi(exc_det,microlist,psi_coef_microlist,N_int,N_microlist(0),psi_selectors_size*4,N_states,i_H_psi_value)
            if(N_microlist(sporb) > 0) call i_H_psi(exc_det,microlist(1,1,ptr_microlist(sporb)),psi_coef_microlist(ptr_microlist(sporb), 1),N_int,N_microlist(sporb),psi_selectors_size*4,N_states,i_H_psi_value2)
            i_H_psi_value(:) = i_H_psi_value(:) + i_H_psi_value2(:)
  
negative.code:   
    do i=0,mo_tot_num_2
      N_microlist(i) = 0
      N_tmicrolist(i) = 0
    enddo
    
    do i=1, N_minilist
  