logact.mb(Astar, nbalance, thisloga)
logact.react(Astar, av, nbalance, thisloga)
Astar
.diagram
are calculated using either the logact.mb
or logact.react
functions. The former is used if residue
in diagram
is set to TRUE
, and the latter if residue
is set to FALSE
. The input values are in a list, Astar
, all element of the list having the same dimensions, and each element contains the chemical affinities of the formation reactions of one of the species of interest at unit activity. The metastable equilibrium activities calculated using either function satisfy the constraints that 1) the resulting chemical affinities of the formation reactions of the species are all equal and 2) the total activity of the conserved component (thisloga
) is unchanged.
In logact.react
(the algorithm described in Dick, 2008 and the only one available prior to CHNOSZ-0.8), the calculations of relative abundances of species use the activities in the affinity
output as initial guesses, and attempt to solve a system of equations that represent the two constraints stated above. So, if you supply a value for thisloga
that is much different from that of the initial guess you may end up with errors from uniroot
such as "f() values at end points not of opposite sign".
In logact.mb
(available beginning with CHNOSZ-0.8), the chemical activities of species are calculated using the Maxwell-Boltzmann distribution, which is much faster than the equation-solving approach used above. However, this algorithm is limited to systems where the balance coefficients are all unity. Therefore, this function is only called by diagram
for systems of proteins when residue
in that function is set to TRUE.