wrap_to_central_cell Subroutine

public subroutine wrap_to_central_cell(xyz, lattice, periodic)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: xyz(:,:)
real(kind=wp), intent(in) :: lattice(:,:)
logical, intent(in) :: periodic(:)

Source Code

subroutine wrap_to_central_cell(xyz, lattice, periodic)
   !DEC$ ATTRIBUTES DLLEXPORT :: wrap_to_central_cell
   real(wp), intent(inout) :: xyz(:, :)
   real(wp), intent(in) :: lattice(:, :)
   logical, intent(in) :: periodic(:)
   real(wp) :: invlat(3, 3), vec(3)
   integer :: iat, idir

   if (.not.any(periodic)) return

   invlat = matinv_3x3(lattice)
   do iat = 1, size(xyz, 2)
      vec(:) = matmul(invlat, xyz(:, iat))
      vec(:) = shift_back_abc(vec)
      xyz(:, iat) = matmul(lattice, vec)
   end do

end subroutine wrap_to_central_cell