Count how many frozen indices there are, determine if the entry has to be added to a lower-order term and if yes, which one. and therefore, which subroutine has to be called in the following 0 - none 1 - one frozen index pair -> two-body term 2 - two frozen index pairs -> one-body term 3 - three frozen index pairs -> diagonal term
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | indices(num_inds) |
pure function count_frozen_inds(indices) result(level) integer(int64), intent(in) :: indices(num_inds) integer :: level integer :: counts integer :: ct level = 0 ! If there is an unpaired frozen orbital, the entry is discarded, it does not ! contribute to any contraction do ct = 1, num_inds if(count(indices(ct) == indices) == 1 .and. indices(ct) < 1) return end do ! Else, it contributes to a contraction according to the number of frozen indices counts = count(indices < 1) ! An even number of frozen orbital indices is required if(modulo(counts, 2) /= 0) return level = counts.div.2 end function count_frozen_inds