Orderless
sorts your argument in canonical order and you might want to explore the possibility to use a helper function to sort only some.
With[{f = Function[, ##, {Orderless}]},
r12ExpUnit[n1_, n2_, n3_, n4_] :=
somefunc[#1, #3, #2, #4] &[f[n1, n3], f[n2, n4]]
]
Here, you use f
to specifically sort the argument pairs {n1,n3}
and {n2,n4}
. I don't find this particularly beautiful and I'm not sure that you can come up with a better overall design, but the information you have given only permit vague guesses.
Anyway, as you can easily see, somefunc
will always be called with your specific pairs in canonical order without ordering all arguments:
r12ExpUnit[n2, n1, n4, n2]
r12ExpUnit[n4, n2, n2, n1]
r12ExpUnit[n2, n2, n4, n1]
r12ExpUnit[n4, n1, n2, n2]
(* somefunc[n2, n1, n4, n2] *)
(* somefunc[n2, n1, n4, n2] *)
(* somefunc[n2, n1, n4, n2] *)
(* somefunc[n2, n1, n4, n2] *)