function mirror_vec(in_vec, mirror_axis) result(out_vec)
integer, intent(in) :: in_vec(3)
character(1), intent(in) :: mirror_axis
integer :: out_vec(3)
select case (mirror_axis)
case ('x')
out_vec(1:2) = nint(matmul(mirror_x, real(in_vec(1:2))))
case ('y')
out_vec(1:2) = nint(matmul(mirror_y, real(in_vec(1:2))))
case ('d')
out_vec(1:2) = nint(matmul(mirror_d, real(in_vec(1:2))))
case ('o')
out_vec(1:2) = nint(matmul(mirror_o, real(in_vec(1:2))))
case ('0')
out_vec = in_vec
case Default
call stop_all("mirror_vec", "incorrect mirroring axis!")
end select
out_vec(3) = in_vec(3)
end function mirror_vec