return_ms Function

public pure function return_ms(ilut, n_el) result(ms_local)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:NIfTot)
integer, intent(in), optional :: n_el

Return Value integer


Contents

Source Code


Source Code

    pure function return_ms(ilut, n_el) result(ms_local)

        ! Return the Ms value for the input ilut.

        ! **WARNING** This function assumes that the number of electrons in the
        ! determinant (the number of set bits in ilut) is equal to nel.

        integer(n_int), intent(in) :: ilut(0:NIfTot)
        integer, intent(in), optional :: n_el

        integer(n_int) :: ilut_alpha(0:NIfD)
        integer :: nup
        integer :: ms_local
        integer :: n_el_
        def_default(n_el_, n_el, nel)

        ilut_alpha = iand(ilut(0:NIfD), MaskAlpha)
        nup = sum(count_set_bits(ilut_alpha))
        ! *Assuming ndown = nel - nup*
        ms_local = 2 * nup - n_el_

    end function return_ms