get_translations Subroutine

public pure subroutine get_translations(lat, rthr, rep)

generate a supercell based on a realspace cutoff, this subroutine

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: lat(3,3)
real(kind=wp), intent(in) :: rthr
integer, intent(out) :: rep(3)

Source Code

pure subroutine get_translations(lat, rthr, rep)
   real(wp), intent(in)  :: rthr
   real(wp), intent(in)  :: lat(3, 3)
   integer, intent(out) :: rep(3)
   real(wp) :: norm(3, 3), normy(3), normz(3)
   real(wp) :: cos10, cos21, cos32

   ! find normal to the plane...
   call crossproduct(lat(:, 2), lat(:, 3), norm(:, 1))
   call crossproduct(lat(:, 3), lat(:, 1), norm(:, 2))
   call crossproduct(lat(:, 1), lat(:, 2), norm(:, 3))
   ! ...normalize it...
   norm(:, 1) = norm(:, 1)/norm2(norm(:, 1))
   norm(:, 2) = norm(:, 2)/norm2(norm(:, 2))
   norm(:, 3) = norm(:, 3)/norm2(norm(:, 3))
   ! cos angles between normals and lattice vectors
   cos10 = sum(norm(:, 1)*lat(:, 1))
   cos21 = sum(norm(:, 2)*lat(:, 2))
   cos32 = sum(norm(:, 3)*lat(:, 3))
   rep(1) = ceiling(abs(rthr/cos10))
   rep(2) = ceiling(abs(rthr/cos21))
   rep(3) = ceiling(abs(rthr/cos32))

end subroutine get_translations