I reviewed several questions already, but none address the same point except the following:
Is Gibbs energy minimized for processes at constant temperature are pressure only?
However, this question remains unanswered until today. The derivations and equations below are from Robin Smith's Chemical Process Design (Chapter 5) and Kolt's Chemical Thermodynamics (Chapter 6 and 7)
For the calculation of the equilibrium constant, it is the case the $\Delta G$ is set to zero at the equilibrium condition. However, doing so seem improper from what I know, and I am wondering what I am getting wrong.
I am considering a reaction of ideal gases, in which the total pressure is changing while the reaction is progressing. As the reaction progress, Gibbs energy can be described by the following correct equation:
$\Delta G_{rxn} = \Delta G - \Delta G^0=RT\ln{K}$
However, it is claimed that at equilibrium $\Delta G = 0$. Therefore,
$\Delta G^0=-RT\ln{K_{eq}}$
This latter equation is the one I am concerned with due to the imposition that $\Delta G = 0$, which does not seem proper as the pressure is changing while the reaction is progressing. My concern stems from the logic detailed below.
The standard thermodynamic condition for equilibrium is $dS_{tot} = 0$. This then can lead to an equilibrium condition involving Gibbs energy as follows:
$dS_{total} = dS_{env}+dS_{sys}$
Re-Writing the equilibrium condition in terms of system variables only gives:
$dS_{sys} = \frac{DQ_{sys}}{T_{sys}} $
This assumes $T_{env} = T_{sys}$
Embedding the first law of thermodynamics and assuming only PV work leaves us with:
$dU+Pdv - TdS = 0$
Imposing the assumption of constant temperature and pressure allows adding P and T differentials since they are zeros.
$dU+PdV + VdP - TdS - SdT = 0$
Once integrated, this gives:
$\Delta U + \Delta (PV) - T\Delta S = 0 $
or equivalently
$\Delta H - T \Delta S = 0$ with $\Delta G = \Delta H - T \Delta S$
However, this final result only came to be with the assumption that $dP$ and $dT$ are zero. If this assumption is removed, the equilibrium condition differential would be as follows:
$dU+Pdv + VdP - TdS - SdT = -VdP - SdT$
or
$dG = VdP - SdT$
This latter equation does not produce $\Delta G = 0$. In fact, the $\Delta G$ and $K$ relation is derived from it. The end result is that we are applying an equation for constant pressure and another with non-constant pressure for the same system at the same time; this does not make sense to me, as pressure is either constant or not.
How is it then that $\Delta G^0=-RT\ln{K_{eq}}$?