diff --git a/src/mode_merge.f90 b/src/mode_merge.f90 index 2118cff..afc9bba 100644 --- a/src/mode_merge.f90 +++ b/src/mode_merge.f90 @@ -130,8 +130,9 @@ module mode_merge integer :: i, ibasis, inod real(kind=dp), dimension(3) :: current_shift + character(len=3) :: alldims - + alldims = 'xyz' !Calculate the current shift which is the filenum-1 multiplied by the user specified shift current_shift = (filenum-1)*shift_vec @@ -154,9 +155,13 @@ module mode_merge !If we don't include the wrap command then we have to increase the size of the box if(.not.(wrap_flag)) then do i = 1,3 - if (current_shift(i) < -lim_zero) then - box_bd(2*i-1) = box_bd(2*i-1) - current_shift(i) - else if (current_shift(i) > lim_zero) then + if (alldims(i:i) /= trim(adjustl(dim))) then + if (current_shift(i) < -lim_zero) then + box_bd(2*i-1) = box_bd(2*i-1) - current_shift(i) + else if (current_shift(i) > lim_zero) then + box_bd(2*i) = box_bd(2*i) + current_shift(i) + end if + else if (alldims(i:i) == trim(adjustl(dim))) then box_bd(2*i) = box_bd(2*i) + current_shift(i) end if end do