isProperCSF_sys Function

private function isProperCSF_sys(ilut, sysFlag, t_print_in) result(flag)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:GugaBits%len_tot)
logical, intent(in) :: sysFlag
logical, intent(in), optional :: t_print_in

Return Value logical


Contents

Source Code


Source Code

    function isProperCSF_sys(ilut, sysFlag, t_print_in) result(flag)
        ! function to check if provided CSF in ilut format is a proper CSF
        ! checks b vector positivity and is total S is correct
        integer(n_int), intent(in) :: ilut(0:GugaBits%len_tot)
        logical, intent(in):: sysFlag
        logical, intent(in), optional :: t_print_in
        logical :: flag

        logical :: t_print

        if (present(t_print_in)) then
            t_print = t_print_in
        else
            t_print = .false.
        end if

        flag = .true.

        ! check if b value drops below zero
        if (any(calcB_vector_int(ilut(0:GugaBits%len_orb)) < 0)) flag = .false.

        ! if system flag is also given as input also check if the CSF fits
        ! concerning total S and the number of electrons
        if (sysFlag) then
            if (abs(return_ms(ilut)) /= STOT) then
                if (t_print) then
                    print *, "CSF does not have correct total spin!:"
                    call write_det_guga(stdout, ilut)
                    print *, "System S: ", STOT
                    print *, "CSF S: ", abs(return_ms(ilut))
                end if
                flag = .false.
            end if

            if (int(sum(calcOcc_vector_ilut(ilut(0:GugaBits%len_orb)))) /= nEl) then
                if (t_print) then
                    print *, "CSF does not have right number of electrons!:"
                    call write_det_guga(stdout, ilut)
                    print *, "System electrons: ", nEl
                    print *, "CSF electrons: ", &
                        int(sum(calcOcc_vector_ilut(ilut(0:GugaBits%len_orb))))
                end if
                flag = .false.
            end if
        end if

    end function isProperCSF_sys