anchor.diff:    integer, allocatable           :: idx_microlist(:,:), N_microlist(:)
     integer :: mobiles(2), smallerlist
     
  -
  +  
  +  integer(bit_kind), allocatable :: microlist_gen(:,:,:,:)
  +  integer, allocatable           :: idx_microlist_gen(:,:), N_microlist_gen(:)
  +  
     allocate( minilist(Nint,2,N_det_selectors),                        &
         minilist_gen(Nint,2,N_det_generators),                         &
         idx_minilist(N_det_selectors))
  
positive.code:            c_pert,e_2_pert,H_pert_diag,Nint,N_microlist(smallerlist)+N_microlist(0),n_st,microlist(:,:,:,0),idx_microlist(:,0),N_microlist(smallerlist)+N_microlist(0)) 
      
      else
        call pt2_$PERT(psi_det_generators(1,1,i_generator),buffer(1,1,i), fock_diag_tmp,        &
          c_pert,e_2_pert,H_pert_diag,Nint,N_minilist,n_st,minilist,idx_minilist,N_minilist) 
      end if
  
negative.code:   
    do i=1,buffer_size
      
      if (is_in_wavefunction(buffer(1,1,i),Nint)) then
        cycle
      endif
        
      if(key_mask(1,1) /= 0) then
        call getMobiles(buffer(:,:,i), key_mask, mobiles, Nint) 
        if(N_microlist(mobiles(1)) < N_microlist(mobiles(2))) then
          smallerlist = mobiles(1)
        else
          smallerlist = mobiles(2)
        end if
        
        if(N_microlist(smallerlist) > 0) then
          if(is_connected_to(buffer(1,1,i), microlist_gen(:,:,:,smallerlist), Nint, N_microlist_gen(smallerlist))) then
            cycle
          end if
        end if
        
        if(is_connected_to(buffer(1,1,i), microlist_gen(:,:,:,0), Nint, N_microlist_gen(0))) then
          cycle
        end if
        
        
        if(N_microlist(smallerlist) > 0) then
          microlist(:,:,N_microlist(0)+1:N_microlist(0)+N_microlist(smallerlist),0) = microlist(:,:,1:N_microlist(smallerlist),smallerlist)
  