get_excitation_new Subroutine

private subroutine get_excitation_new(nI, nJ, IC, exc, tParity)

Create an excitation from nI to nJ where the excitation level is already known.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nEl)

Two Slater determinants in nI format.

integer, intent(in) :: nJ(nEl)

Two Slater determinants in nI format.

integer, intent(in) :: IC

The excitation level. (1=Excite_1_t, 2=Excite_2_t, …)

class(Excitation_t), intent(out), allocatable :: exc

An excitation of type excitation_t. By using select type(exc) one can select the actual type at runtime and statically dispatch as much as possible at compile time.

logical, intent(out) :: tParity

The parity of the excitation.


Contents

Source Code


Source Code

    subroutine get_excitation_new(nI, nJ, IC, exc, tParity)
        !> Two Slater determinants in nI format.
        integer, intent(in) :: nI(nEl), nJ(nEl)
        !>  The excitation level. (1=Excite_1_t, 2=Excite_2_t, ...)
        integer, intent(in) :: IC
        !>  An excitation of type excitation_t.
        !>      By using select type(exc) one can select the actual type at runtime
        !>      **and** statically dispatch as much as possible at compile time.
        class(Excitation_t), allocatable, intent(out) :: exc
        !>  The parity of the excitation.
        logical, intent(out) :: tParity

        exc = create_excitation(ic)

        ! The compiler has to statically know, what the type of exc is.
        select type (exc)
        type is (Excite_1_t)
            exc%val(1, 1) = 1
            call GetExcitation(nI, nJ, nel, exc%val, tParity)
        type is (Excite_2_t)
            exc%val(1, 1) = 2
            call GetExcitation(nI, nJ, nel, exc%val, tParity)
        type is (Excite_3_t)
            exc%val(1, 1) = 3
            call GetExcitation(nI, nJ, nel, exc%val, tParity)
        end select
    end subroutine get_excitation_new