anchor.diff:              j = cs%occ_list(i)  ! The elec we're looking at
               if (sys%basis%basis_fns(j)%Ms == -1) then ! beta
                   nv = sys%nvirt_beta
  -                call create_weighted_excitation_list_ptr(sys, j, 0, cs%virt_list_beta, nv, cs%ia_weights(:,i), &
  -                                                         cs%ia_weights_tot(i))
  -                call generate_alias_tables(nv, cs%ia_weights(:,i), cs%ia_weights_tot(i), cs%ia_aliasU(:,i), cs%ia_aliasK(:,i))
  +                if (nv > 0) then
  +                    call create_weighted_excitation_list_ptr(sys, j, 0, cs%virt_list_beta, nv, cs%ia_weights(:,i), &
  +                                                            cs%ia_weights_tot(i))
  +                    call generate_alias_tables(nv, cs%ia_weights(:,i), cs%ia_weights_tot(i), cs%ia_aliasU(:,i), &
  +                                               cs%ia_aliasK(:,i))
  +                end if
                   do bsym = sys%sym0_tot, sys%sym_max_tot
  -                    call create_weighted_excitation_list_ptr(sys, j, 0, sys%read_in%pg_sym%sym_spin_basis_fns(:,1,bsym), &
  -                        sys%read_in%pg_sym%nbasis_sym_spin(1,bsym), cs%jb_weights(:,bsym,i), cs%jb_weights_tot(bsym,i))
  -                    call generate_alias_tables(sys%read_in%pg_sym%nbasis_sym_spin(1,bsym), cs%jb_weights(:,bsym,i), &
  -                        cs%jb_weights_tot(bsym,i), cs%jb_aliasU(:,bsym,i), cs%jb_aliasK(:,bsym,i))
  +                    if (sys%read_in%pg_sym%nbasis_sym_spin(1,bsym) > 0) then
  +                        call create_weighted_excitation_list_ptr(sys, j, 0, sys%read_in%pg_sym%sym_spin_basis_fns(:,1,bsym), &
  +                            sys%read_in%pg_sym%nbasis_sym_spin(1,bsym), cs%jb_weights(:,bsym,i), cs%jb_weights_tot(bsym,i))
  +                        call generate_alias_tables(sys%read_in%pg_sym%nbasis_sym_spin(1,bsym), cs%jb_weights(:,bsym,i), &
  +                            cs%jb_weights_tot(bsym,i), cs%jb_aliasU(:,bsym,i), cs%jb_aliasK(:,bsym,i))
  +                    end if
                   end do
               else ! alpha
                   nv = sys%nvirt_alpha
  -                call create_weighted_excitation_list_ptr(sys, j, 0, cs%virt_list_alpha, nv, cs%ia_weights(:,i), &
  -                                                         cs%ia_weights_tot(i))
  -                call generate_alias_tables(nv, cs%ia_weights(:,i), cs%ia_weights_tot(i), cs%ia_aliasU(:,i), cs%ia_aliasK(:,i))
  +                if (nv > 0) then
  +                    call create_weighted_excitation_list_ptr(sys, j, 0, cs%virt_list_alpha, nv, cs%ia_weights(:,i), &
  +                                                             cs%ia_weights_tot(i))
  +                    call generate_alias_tables(nv, cs%ia_weights(:,i), cs%ia_weights_tot(i), cs%ia_aliasU(:,i), &
  +                                               cs%ia_aliasK(:,i))
  +                end if
                   do bsym = sys%sym0_tot, sys%sym_max_tot
  -                    call create_weighted_excitation_list_ptr(sys, j, 0, sys%read_in%pg_sym%sym_spin_basis_fns(:,2,bsym), &
  -                        sys%read_in%pg_sym%nbasis_sym_spin(2,bsym), cs%jb_weights(:,bsym,i), cs%jb_weights_tot(bsym,i))
  -                    call generate_alias_tables(sys%read_in%pg_sym%nbasis_sym_spin(2,bsym), cs%jb_weights(:,bsym,i), &
  -                        cs%jb_weights_tot(bsym,i), cs%jb_aliasU(:,bsym,i), cs%jb_aliasK(:,bsym,i))
  +                    if (sys%read_in%pg_sym%nbasis_sym_spin(2,bsym) > 0) then
  +                        call create_weighted_excitation_list_ptr(sys, j, 0, sys%read_in%pg_sym%sym_spin_basis_fns(:,2,bsym), &
  +                            sys%read_in%pg_sym%nbasis_sym_spin(2,bsym), cs%jb_weights(:,bsym,i), cs%jb_weights_tot(bsym,i))
  +                        call generate_alias_tables(sys%read_in%pg_sym%nbasis_sym_spin(2,bsym), cs%jb_weights(:,bsym,i), &
  +                            cs%jb_weights_tot(bsym,i), cs%jb_aliasU(:,bsym,i), cs%jb_aliasK(:,bsym,i))
  +                    end if
                   end do
               end if
           end do
  
positive.code:         logical, intent(out) :: allowed_excitation
  
          integer ::  ij_spin, ij_sym, ierr
          logical :: found
          real(p), allocatable :: ia_weights(:), ja_weights(:), jb_weights(:)
  
          !real(p) :: ia_weights(max(sys%nalpha + sys%nel,sys%nbeta+ sys%nel)), ja_weights(max(sys%nalpha+sys%nel,sys%nbeta+sys%nel)),
  
negative.code:         integer :: ref_store(sys%nel)
          integer :: ii, jj, t
  
          logical :: found, a_found
  
          ! 1. Select single or double.
          if (get_rand_close_open(rng) < excit_gen_data%pattempt_single) then
  