shift_back_abc Function

public elemental function shift_back_abc(in) result(out)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: in

fractional coordinate in (-∞,+∞)

Return Value real(kind=wp)

fractional coordinate in [0,1)


Source Code

elemental function shift_back_abc(in) result(out)
   !> fractional coordinate in (-∞,+∞)
   real(wp),intent(in) :: in
   !> fractional coordinate in [0,1)
   real(wp) :: out
   real(wp),parameter :: p_pbc_eps = 1.0e-14_wp
   out = in
   if(in < (0.0_wp - p_pbc_eps)) &
      out = in + real(ceiling(-in),wp)
   if(in > (1.0_wp + p_pbc_eps)) &
      out = in - real(floor  ( in),wp)
   if (abs(in - 1.0_wp) < p_pbc_eps) &
      out = in - 1.0_wp
end function shift_back_abc