anchor.diff:             
               if (allowed_excitation) then
   
  -                ! 4b. Parity of permutation required to line up determinants.
  +                ! Parity of permutation required to line up determinants.
                   ! NOTE: connection%from_orb and connection%to_orb *must* be ordered.
                   call find_excitation_permutation2(sys%basis%excit_mask, cdet%f, connection)
   
  -                ! 5b. Find the connecting matrix element.
  +                ! Find the connecting matrix element.
                   hmatel = slater_condon2_excit_ptr(sys, connection%from_orb(1), connection%from_orb(2), &
                                               connection%to_orb(1), connection%to_orb(2), connection%perm)
               else
  
positive.code:                     end if
                  end do
      
                  ! Convert ims which is in {-1, +1} notation to imsa which is {1, 2}.
                  imsa = (3 + sys%basis%basis_fns(i_cdet)%ms)/2
                  isyma = sys%read_in%cross_product_sym_ptr(sys%read_in, sys%basis%basis_fns(i_cdet)%sym, &
  
negative.code:         integer :: i_tmp, j_tmp, a_tmp, b_tmp, nall
          real(p) :: i_weight, ij_weight
          
          ! Store weights and alias tables.
          ! pp%ppn_i_d%weights(:) selects i from orbitals occupied in the reference in a double excitation.
          allocate(pp%ppn_i_d%aliasU(sys%nel))
          allocate(pp%ppn_i_d%aliasK(sys%nel))
          allocate(pp%ppn_i_d%weights(sys%nel))
          ! allocate(pp%ppn_i_d%weights_tot)
          ! pp%ppn_i_s%weights(:) selects i from orbitals occupied in the reference in a single excitation.
          allocate(pp%ppn_i_s%aliasU(sys%nel))
          allocate(pp%ppn_i_s%aliasK(sys%nel))
          allocate(pp%ppn_i_s%weights(sys%nel))
          ! allocate(pp%ppn_i_s%weights_tot) 
          ! pp%ppn_ij_d%weights(:,i) selects j from orbitals occupied in the reference in a double excitation.
          allocate(pp%ppn_ij_d%aliasU(sys%nel,sys%basis%nbasis))
          allocate(pp%ppn_ij_d%aliasK(sys%nel,sys%basis%nbasis))
          allocate(pp%ppn_ij_d%weights(sys%nel,sys%basis%nbasis))
          allocate(pp%ppn_ij_d%weights_tot(sys%basis%nbasis))
          ! pp%ppn_ia_d%weights(:,i) select a from all orbitals in a double excitation.
          ! Note that the alias table values for this are allocated further below.
          allocate(pp%ppn_ia_d%weights_tot(sys%basis%nbasis))
          ! pp%ppn_ia_s%weights(:,i) selects a from all orbitals in a single excitation.
          allocate(pp%ppn_ia_s%weights_tot(sys%basis%nbasis))
          allocate(pp%ppn_ia_s%aliasU(maxval(sys%read_in%pg_sym%nbasis_sym_spin),sys%basis%nbasis))
          allocate(pp%ppn_ia_s%aliasK(maxval(sys%read_in%pg_sym%nbasis_sym_spin),sys%basis%nbasis))
          allocate(pp%ppn_ia_s%weights(maxval(sys%read_in%pg_sym%nbasis_sym_spin),sys%basis%nbasis))
          ! pp%ppn_jb_d%weights(:,symb,j) selects b from orbitals with j's spin and symmetry symb in a double excitation.
          allocate(pp%ppn_jb_d%aliasU(maxval(sys%read_in%pg_sym%nbasis_sym_spin), sys%sym0_tot:sys%sym_max_tot, sys%basis%nbasis))
          allocate(pp%ppn_jb_d%aliasK(maxval(sys%read_in%pg_sym%nbasis_sym_spin), sys%sym0_tot:sys%sym_max_tot, sys%basis%nbasis))
          allocate(pp%ppn_jb_d%weights(maxval(sys%read_in%pg_sym%nbasis_sym_spin), sys%sym0_tot:sys%sym_max_tot, sys%basis%nbasis))
  