swap_excitations_higher Subroutine

private subroutine swap_excitations_higher(nI, ex, nJ, ex2)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
integer, intent(in) :: ex(:,:)
integer, intent(out) :: nJ(nel)
integer, intent(out), allocatable :: ex2(:,:)

Contents


Source Code

    subroutine swap_excitations_higher(nI, ex, nJ, ex2)
        ! routine to quickly, without make_double and make_triple
        ! create the excited determinant nJ and ex2 to go from nJ -> nI
        ! for the test of the order of matrix element calculation in the
        ! transcorrelated approach. due to non-hermiticity
        ! <i|H|j> /= <j|H|i>
        ! also make this work for triple excitations!
        integer, intent(in) :: nI(nel), ex(:, :)
        integer, intent(out) :: nJ(nel)
        integer, intent(out), allocatable :: ex2(:, :)
#ifdef DEBUG_
        character(*), parameter :: this_routine = "swap_excitations"
#endif

        ASSERT(size(ex, 1) == 2)
        ASSERT(size(ex, 2) == 2 .or. size(ex, 2) == 3)

        allocate(ex2(size(ex, 1), size(ex, 2)), source=ex)

        nJ = nI
        where (nJ == ex(1, 1)) nJ = ex(2, 1)
        where (nJ == ex(1, 2)) nJ = ex(2, 2)
        if (size(ex, 2) == 3) then
            where (nJ == ex(1, 3)) nJ = ex(2, 3)
        end if

        call sort(nJ)
        ex2 = ex
        call swap(ex2(1, 1), ex2(2, 1))
        call swap(ex2(1, 2), ex2(2, 2))
        if (size(ex, 2) == 3) then
            call swap(ex2(1, 3), ex2(2, 3))
        end if

    end subroutine swap_excitations_higher