Compares two vectors
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | a(3) | |||
| real(kind=dp), | intent(in) | :: | b(3) | |||
| integer, | intent(out) | :: | ifpos | |||
| integer, | intent(out) | :: | ifneg |
subroutine utility_compar(a, b, ifpos, ifneg) !================================================! ! !! Compares two vectors ! !================================================ use w90_constants, only: eps8 implicit none real(kind=dp), intent(in) :: a(3) real(kind=dp), intent(in) :: b(3) integer, intent(out) :: ifpos, ifneg real(kind=dp) :: rrp, rrm rrp = (a(1) - b(1))**2 + (a(2) - b(2))**2 + (a(3) - b(3))**2 rrm = (a(1) + b(1))**2 + (a(2) + b(2))**2 + (a(3) + b(3))**2 ifpos = 0 if (abs(rrp) .lt. eps8) ifpos = 1 ifneg = 0 if (abs(rrm) .lt. eps8) ifneg = 1 return end subroutine utility_compar