anchor.diff:                  ! Select an occupied orbital at random.
                   i = occ_list(int(get_rand_close_open(rng)*sys%nel)+1)
                   ! Conserve symmetry (spatial and spin) in selecting a.
  -                ims = (sys%basis%basis_fns(i)%Ms+3)/2
  +                imsa = (sys%basis%basis_fns(i)%Ms+3)/2
                   ! Assume op_sym is self-conjugate.
                   ! We want
                   !   Gamma_totsym = Gamma_<D|o|D_i^a>
  
positive.code:         integer, intent(out) :: a, b
          logical, intent(out) :: allowed_excitation
  
          integer :: ims, isym, ind, shift, na, fac
  
          ! Select a virtual orbital at random.
          ! Ensure spin can be conserved...
  
negative.code:         type(sys_t), intent(in) :: sys
          integer, intent(in) :: a
  
          integer :: imsi, isymi
  
          ! We explicitly reject excitations i->a where a is already
          ! occupied, so the generation probability, pgen, is simple:
          !   pgen = p_single p(i) p(a|i)
          !        = p_single 1/nel 1/nbasis_sym_spin(ms_i, sym_i)
  
          imsi = (sys%basis%basis_fns(a)%Ms+3)/2
          isymi = sys%basis%basis_fns(a)%sym
          pgen = 1.0_p/(sys%nel*sys%read_in%pg_sym%nbasis_sym_spin(imsi,isymi))
  
      end function calc_pgen_single_mol_no_renorm
  
  