utility_cart_to_frac Subroutine

public subroutine utility_cart_to_frac(cart, frac, recip_lat)

Uses

  • proc~~utility_cart_to_frac~~UsesGraph proc~utility_cart_to_frac utility_cart_to_frac module~w90_constants w90_constants proc~utility_cart_to_frac->module~w90_constants

Convert from Cartesian to fractional coordinates

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: cart(3)
real(kind=dp), intent(out) :: frac(3)
real(kind=dp), intent(in) :: recip_lat(3,3)

Called by

proc~~utility_cart_to_frac~~CalledByGraph proc~utility_cart_to_frac utility_cart_to_frac proc~r_wz_sc R_wz_sc proc~r_wz_sc->proc~utility_cart_to_frac proc~utility_translate_home utility_translate_home proc~utility_translate_home->proc~utility_cart_to_frac

Contents

Source Code


Source Code

  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