Working shift command for merge

This commit is contained in:
Alex Selimov 2020-01-15 16:44:13 -05:00
parent 14dd8ad755
commit cde96402e2
3 changed files with 94 additions and 2 deletions

View file

@ -249,4 +249,23 @@ module subroutines
end do
end subroutine siftdown
subroutine apply_periodic(r)
!This function checks if an atom is outside the box and wraps it back in. This is generally used when some
!kind of displacement is applied but the simulation cell is desired to be maintained as the same size.
real(kind=dp), dimension(3), intent(inout) :: r
integer :: j
do j = 1, 3
if (r(j) > box_bd(2*j)) then
r(j) = r(j) - box_bd(2*j)
else if (r(j) < box_bd(2*j-1)) then
r(j) = r(j) + box_bd(2*j-1)
end if
end do
end subroutine
end module subroutines