get_spin_opp_neighbors Function

public function get_spin_opp_neighbors(ilut, spin_orb) result(spin_opp_neighbors)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:niftot)
integer, intent(in) :: spin_orb

Return Value real(kind=dp)


Contents


Source Code

    function get_spin_opp_neighbors(ilut, spin_orb) result(spin_opp_neighbors)
        ! function to give the number of opposite spin electron neighbors
        integer(n_int), intent(in) :: ilut(0:niftot)
        integer, intent(in) :: spin_orb
        real(dp) :: spin_opp_neighbors
#ifdef DEBUG_
        character(*), parameter :: this_routine = "get_spin_opp_neighbors"
#endif
        integer :: i
        integer, allocatable :: neighbors(:)

        ASSERT(associated(lat))

        spin_opp_neighbors = 0.0_dp

        ! get the spin-opposite neigbhors
        if (is_beta(spin_orb)) then
            neighbors = lat%get_spinorb_neighbors(spin_orb) + 1
        else
            neighbors = lat%get_spinorb_neighbors(spin_orb) - 1
        end if

        do i = 1, size(neighbors)
            if (IsOcc(ilut, neighbors(i))) spin_opp_neighbors = spin_opp_neighbors + 1.0_dp
        end do

    end function get_spin_opp_neighbors