Calculates the reciprical lattice vectors and the cell volume
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | real_lat(3,3) | |||
real(kind=dp), | intent(out) | :: | recip_lat(3,3) | |||
real(kind=dp), | intent(out) | :: | volume |
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