Calculates the probability of picking three orbitals with total spin ms with symmetry @param[in] nI determinant the excitation was made from @param[in] ex the excitation matrix (2x3 array) @param[in] ms total spin of the picked orbitals @param[inout] pgen on call, the probability of picking the electrons, on return, the total probability

Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|

integer, | intent(in) | :: | nI(nel) |
|||

integer, | intent(in) | :: | ex(2,3) |
|||

integer, | intent(in) | :: | ms |
|||

real(kind=dp), | intent(inout) | :: | pgen |

```
subroutine calc_pgen_triple_target_sym(nI, ex, ms, pgen)
integer, intent(in) :: nI(nel)
integer, intent(in) :: ex(2, 3)
integer, intent(in) :: ms
real(dp), intent(inout) :: pgen
! Temporary: Store the probability of picking the canonical order
real(dp) :: pgen_pick
integer :: pool_sizes(3), tgt_spin, tmp_ex(2, 3)
integer :: cc_unocc(ScratchSize), cc_occ(ScratchSize), cc_ind
! manually mimick pass-by-value
tmp_ex = ex
! get the number of available orbs per symmetry sector
call construct_class_counts(nI, cc_occ, cc_unocc)
! Now, get the prob for picking these three target orbitals
! The first two are chosen uniformly, and have the majority spin
if (ms > 0) then
pool_sizes(1:2) = nUnoccAlpha
! tgt_spin is the spin of the third, assign it to majority spin
tgt_spin = 1
else
pool_sizes(1:2) = nUnoccBeta
tgt_spin = 2
end if
if (abs(ms) /= 3) then
! Now, we have to be careful: The pick-algorithm has a convention on the order
! Alpha/Beta are picked, but this order is not preserved => Sort
! The convention is: the first two orbitals have the same spin
if (G1(tmp_ex(2, 1))%MS /= G1(tmp_ex(2, 2))%MS) call swap(tmp_ex(2, 2), tmp_ex(2, 3))
! Also, the third electron has minority spin now, so swap tgt_spin
! (map 1 -> 2 and 2 -> 1
tgt_spin = 3 - tgt_spin
end if
! Get the index of the symmetry class of the third (symmetry-restricted) orb
cc_ind = ClassCountInd(tgt_spin, G1(tmp_ex(2, 3))%Sym%S, 0)
! And the from that number of available orbs
pool_sizes(3) = cc_unocc(cc_ind)
! The pool for the second is one smaller, because the first one is not available anymore
pool_sizes(2) = pool_sizes(2) - 1
pgen_pick = pgen / product(pool_sizes)
! now, account for permutations
call add_permutations_to_pgen(pgen, pgen_pick, pool_sizes, ms, tmp_ex(2, :), cc_unocc)
end subroutine calc_pgen_triple_target_sym
```