check_momentum_sym Function

public function check_momentum_sym(elecs, orbs)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: elecs(:)
integer, intent(in) :: orbs(:)

Return Value logical


Contents

Source Code


Source Code

    logical function check_momentum_sym(elecs, orbs)
        ! routine to check the momentum conservation for double and triple
        ! spawns
        ! although this could in fact be used for a general check of
        ! symmetry adaptability
        integer, intent(in) :: elecs(:), orbs(:)
#ifdef DEBUG_
        character(*), parameter :: this_routine = "check_momentum_sym"
#endif
        integer :: i
        type(Symmetry) :: sym_1, sym_2

        ASSERT(size(elecs) == size(orbs))

        ! make this more efficient here! and do not use all the old
        ! functionality

        check_momentum_sym = .true.

        if (.not. sum(get_spin_pn(elecs)) == sum(get_spin_pn(orbs))) then
            check_momentum_sym = .false.
            return
        end if

        ! get the symmetry symbol
        sym_1 = G1(elecs(1))%Sym
        sym_2 = G1(orbs(1))%Sym
        do i = 2, size(elecs)
            ! i could ofc also use G1 here again
            sym_1 = SymTable(sym_1%s, G1(elecs(i))%sym%s)
            sym_2 = SymTable(sym_2%s, G1(orbs(i))%sym%s)
        end do

        if (sym_1%s /= sym_2%s) then
            check_momentum_sym = .false.
        end if

    end function check_momentum_sym