Convert from Cartesian to fractional coordinates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | cart(3) | |||
real(kind=dp), | intent(out) | :: | frac(3) | |||
real(kind=dp), | intent(in) | :: | recip_lat(3,3) |
subroutine utility_cart_to_frac(cart, frac, recip_lat)
!==================================================================!
! !
!! Convert from Cartesian to fractional coordinates
! !
!===================================================================
use w90_constants, only: twopi
implicit none
real(kind=dp), intent(in) :: recip_lat(3, 3)
real(kind=dp), intent(out) :: frac(3)
real(kind=dp), intent(in) :: cart(3)
integer :: i
do i = 1, 3
frac(i) = recip_lat(i, 1)*cart(1) + recip_lat(i, 2)*cart(2) + recip_lat(i, 3)*cart(3)
end do
frac = frac/twopi
return
end subroutine utility_cart_to_frac