anchor.diff:    n_singles = 1
     n_doubles = 1
     !DIR$ VECTOR ALIGNED
  -  do i=0,size_buffer-block_size, block_size
  +  do i=1,size_buffer
   
       do k=1,Nint
  -      do ii=1,block_size
  -        xorvec(ii, k) = xor( spindet(k), buffer(k,ii+i) )
  -      enddo
  +        xorvec(k) = xor( spindet(k), buffer(k,i) )
       enddo
       
  -    do ii=1,block_size
  -      if (xorvec(ii,1) /= 0_8) then
  -        degree(ii) = popcnt(xorvec(ii,1))
  -      else
  -        degree(ii) = 0
  -      endif
  -    
  -      do k=2,Nint
  -        !DIR$ VECTOR ALIGNED
  -        if ( (degree(ii) <= 4).and.(xorvec(ii,k) /= 0_8) ) then
  -          degree(ii) = degree(ii) + popcnt(xorvec(ii,k))
  -        endif
  -      enddo
  -    enddo
  -
  -    do ii=1,block_size
  -      if ( degree(ii) == 4 ) then
  -        doubles(n_doubles) = idx(i+ii)
  -        n_doubles = n_doubles+1
  -      endif
  -      if ( degree(ii) == 2 ) then
  -        singles(n_singles) = idx(i+ii)
  -        n_singles = n_singles+1
  -      endif
  -    enddo
  -
  -  enddo
  -
  -  imax = size_buffer-i
  -
  -  do k=1,Nint
  -    do ii=1,imax
  -      xorvec(ii, k) = xor( spindet(k), buffer(k,ii+i) )
  -    enddo
  -  enddo
  -  
  -  do ii=1,imax
  -    if (xorvec(ii,1) /= 0_8) then
  -      degree(ii) = popcnt(xorvec(ii,1))
  +    if (xorvec(1) /= 0_8) then
  +      degree = popcnt(xorvec(1))
       else
  -      degree(ii) = 0
  +      degree = 0
       endif
     
       do k=2,Nint
         !DIR$ VECTOR ALIGNED
  -      if ( (degree(ii) <= 4).and.(xorvec(ii,k) /= 0_8) ) then
  -        degree(ii) = degree(ii) + popcnt(xorvec(ii,k))
  +      if ( (degree <= 4).and.(xorvec(k) /= 0_8) ) then
  +        degree = degree + popcnt(xorvec(k))
         endif
       enddo
  -  enddo
  -
  -  do ii=1,imax
  -    if ( degree(ii) == 4 ) then
  -      doubles(n_doubles) = idx(i+ii)
  +
  +    if ( degree == 4 ) then
  +      doubles(n_doubles) = idx(i)
         n_doubles = n_doubles+1
  -    endif
  -    if ( degree(ii) == 2 ) then
  -      singles(n_singles) = idx(i+ii)
  +    else if ( degree == 2 ) then
  +      singles(n_singles) = idx(i)
         n_singles = n_singles+1
       endif
  -  enddo
  -
  +
  +  enddo
     n_singles = n_singles-1
     n_doubles = n_doubles-1
     
  
positive.code:   integer, external :: get_index_in_psi_det_alpha_unique
    integer, external :: get_index_in_psi_det_beta_unique
    allocate(to_sort(N_det))
    do k=1,N_det
      i = get_index_in_psi_det_alpha_unique(psi_det(1,1,k),N_int)
      j = get_index_in_psi_det_beta_unique (psi_det(1,2,k),N_int)
  
negative.code:   integer, intent(out)           :: n_singles
    integer, intent(out)           :: n_doubles
  
    integer                        :: i,k
    include 'Utils/constants.include.F'
    integer(bit_kind)              :: xorvec(N_int_max)
    integer                        :: degree
  
    integer, external              :: align_double
  
  