Hi Jiaxing,
This is because internally the forward and reverse directions of the reaction are represented separately. The backward reaction is assigned
equilibrium constant 1.0 / self._params["gamma"] and the code that you mentioned takes this into account by multiplying pKa with nubar. For the forward direction, nubar=1.0. For the reverse direction, nubar=-1.0, that is equivalent to using Ka = 1/Ka_reverse.
I believe that this has mostly historical reasons. The reaction ensemble was implemented first, and it was implemented such that forward and reverse directions had to be specified separately. The constant-pH ensemble was implemented later, using the same functions. Only then, the redundancy of specifying the forward and reverse reaction was removed. I think that what you just found is an artifact of that redundancy that makes the code more complicated but has no impact on the results or on the performance.
Perhaps Jonas Landsgesell can provide further comments.
With regards,
Peter