anchor.diff:  subroutine get_mask_phase(det, phasemask)
     use bitmasks
     implicit none
  -
  -  integer(bit_kind), intent(in) :: det(N_int, 2)
  -  integer(1), intent(out) :: phasemask(2,N_int*bit_kind_size)
  -  integer :: s, ni, i
  -  logical :: change
  -
  +  
  +  integer(bit_kind), intent(in)  :: det(N_int, 2)
  +  integer(1), intent(out)        :: phasemask(2,N_int*bit_kind_size)
  +  integer                        :: s, ni, i
  +  logical                        :: change
  +  
     phasemask = 0_1
     do s=1,2
       change = .false.
       do ni=1,N_int
         do i=0,bit_kind_size-1
  -        if(BTEST(det(ni, s), i)) change = .not. change
  -          if(change) phasemask(s, (ni-1)*bit_kind_size + i + 1) = 1_1
  +        if(BTEST(det(ni, s), i)) then
  +          change = .not. change
  +        endif
  +        if(change) then
  +          phasemask(s, ishft(ni-1,bit_kind_shift) + i + 1) = 1_1
  +        endif
         end do
       end do
     end do
  
positive.code:   integer(bit_kind),intent(in)   :: mask(N_int, 2), det(N_int, 2, N_sel)
    logical, intent(inout)         :: bannedOrb(mo_tot_num, 2), banned(mo_tot_num, mo_tot_num, 2)
    double precision, intent(inout) :: mat(N_states, mo_tot_num, mo_tot_num)
  
    integer :: i, ii, j, k, l, h(0:2,2), p(0:4,2), nt
    integer(bit_kind) :: perMask(N_int, 2), mobMask(N_int, 2), negMask(N_int, 2)
  !   logical :: bandon
  !   
  !   bandon = .false.
    PROVIDE psi_phasemask psi_selectors_coef_transp
    mat = 0d0
    
    do i=1,N_int
  
negative.code: end function
  
  
  
  subroutine assert(cond, msg)
    character(*), intent(in) :: msg
  