rotate_orb Function

public function rotate_orb(in_orb, rot_angle) result(out_orb)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: in_orb
real(kind=dp), intent(in) :: rot_angle

Return Value integer


Contents

Source Code


Source Code

    function rotate_orb(in_orb, rot_angle) result(out_orb)
        ! function to actually apply the rotation to the basis vectors
        integer, intent(in) :: in_orb
        real(dp), intent(in) :: rot_angle
        integer :: out_orb
#ifdef DEBUG_
        character(*), parameter :: this_routine = "rotate_orb"
#endif
        integer :: vec(3), rot_vec(3)

        ASSERT(associated(lat))

        if (near_zero(rot_angle) .or. (rot_angle.isclose.360.0_dp)) then
            out_orb = in_orb
            return
        end if

        if (lat%is_k_space()) then
            vec = lat%get_k_vec(in_orb)
        else
            vec = lat%get_r_vec(in_orb)
        end if

        rot_vec = rotate(vec, rot_angle)

        ! apply pbc (should be done within the get_orb_from_k_vec function i hope..
        out_orb = lat%get_orb_from_k_vec(rot_vec)

    end function rotate_orb