Extract the number and indices of the periodic lattice directions
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | periodic(:) |
Periodic dimensions, a one-element mask applies to all directions |
||
| integer, | intent(out) | :: | ndim |
Number of periodic dimensions (0, 1, 2, or 3) |
||
| integer, | intent(out) | :: | p_axes(3) |
Indices of the periodic directions in 1..ndim |
pure subroutine get_periodic_axes(periodic, ndim, p_axes) !> Periodic dimensions, a one-element mask applies to all directions logical, intent(in) :: periodic(:) !> Number of periodic dimensions (0, 1, 2, or 3) integer, intent(out) :: ndim !> Indices of the periodic directions in 1..ndim integer, intent(out) :: p_axes(3) integer :: i logical :: active ndim = 0 p_axes(:) = 0 do i = 1, 3 if (size(periodic) == 1) then active = periodic(1) else active = periodic(i) end if if (active) then ndim = ndim + 1 p_axes(ndim) = i end if end do end subroutine get_periodic_axes