utility_recip_lattice Subroutine

public subroutine utility_recip_lattice(real_lat, recip_lat, volume)

Uses

  • proc~~utility_recip_lattice~~UsesGraph proc~utility_recip_lattice utility_recip_lattice module~w90_constants w90_constants proc~utility_recip_lattice->module~w90_constants module~w90_io w90_io proc~utility_recip_lattice->module~w90_io module~w90_io->module~w90_constants

Calculates the reciprical lattice vectors and the cell volume

Arguments

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

Calls

proc~~utility_recip_lattice~~CallsGraph proc~utility_recip_lattice utility_recip_lattice proc~io_error io_error proc~utility_recip_lattice->proc~io_error

Called by

proc~~utility_recip_lattice~~CalledByGraph proc~utility_recip_lattice utility_recip_lattice proc~k_slice k_slice proc~k_slice->proc~utility_recip_lattice

Contents

Source Code


Source Code

  subroutine utility_recip_lattice(real_lat, recip_lat, volume)  !
    !==================================================================!
    !                                                                  !
    !!  Calculates the reciprical lattice vectors and the cell volume
    !                                                                  !
    !===================================================================

    use w90_constants, only: dp, twopi, eps5
    use w90_io, only: io_error

    implicit none
    real(kind=dp), intent(in)  :: real_lat(3, 3)
    real(kind=dp), intent(out) :: recip_lat(3, 3)
    real(kind=dp), intent(out) :: volume

    recip_lat(1, 1) = real_lat(2, 2)*real_lat(3, 3) - real_lat(3, 2)*real_lat(2, 3)
    recip_lat(1, 2) = real_lat(2, 3)*real_lat(3, 1) - real_lat(3, 3)*real_lat(2, 1)
    recip_lat(1, 3) = real_lat(2, 1)*real_lat(3, 2) - real_lat(3, 1)*real_lat(2, 2)
    recip_lat(2, 1) = real_lat(3, 2)*real_lat(1, 3) - real_lat(1, 2)*real_lat(3, 3)
    recip_lat(2, 2) = real_lat(3, 3)*real_lat(1, 1) - real_lat(1, 3)*real_lat(3, 1)
    recip_lat(2, 3) = real_lat(3, 1)*real_lat(1, 2) - real_lat(1, 1)*real_lat(3, 2)
    recip_lat(3, 1) = real_lat(1, 2)*real_lat(2, 3) - real_lat(2, 2)*real_lat(1, 3)
    recip_lat(3, 2) = real_lat(1, 3)*real_lat(2, 1) - real_lat(2, 3)*real_lat(1, 1)
    recip_lat(3, 3) = real_lat(1, 1)*real_lat(2, 2) - real_lat(2, 1)*real_lat(1, 2)

    volume = real_lat(1, 1)*recip_lat(1, 1) + &
             real_lat(1, 2)*recip_lat(1, 2) + &
             real_lat(1, 3)*recip_lat(1, 3)

    if (abs(volume) < eps5) then
      call io_error(' Found almost zero Volume in utility_recip_lattice')
    end if

    recip_lat = twopi*recip_lat/volume
    volume = abs(volume)

    return

  end subroutine utility_recip_lattice