subroutine apply_pbc_tilted(array, pbc_1, pbc_2, ur, dr, ul, dl, rr, ll)
! intermediate routine to apply the periodic boundary conditions for
! the rectangular tilted lattice
integer, intent(in) :: array(:, :), pbc_1(2), pbc_2(2)
integer, intent(out) :: ur(:, :), dr(:, :), ul(:, :), dl(:, :), rr(:, :), ll(:, :)
integer :: plus(2)
plus = pbc_1 + pbc_2
! i have to do this properly, so it still works with the old
! tilted implementation:
! cshfting along the 2nd dimension is the x-axis shift on my
! derivation
! and along the 1-direction i should shift with -pbc to move it
! actually up..
! i think something is wrong with this routine still!
rr = cshift(cshift(array, -plus(2), 1), plus(1), 2)
ll = cshift(cshift(array, plus(2), 1), -plus(1), 2)
ur = cshift(cshift(array, -pbc_1(2), 1), pbc_1(1), 2)
dr = cshift(cshift(array, -pbc_2(2), 1), pbc_2(1), 2)
ul = cshift(cshift(array, pbc_2(2), 1), -pbc_2(1), 2)
dl = cshift(cshift(array, pbc_1(2), 1), -pbc_1(1), 2)
end subroutine apply_pbc_tilted