Gibbs Free Energy Spontaneity Criterion Derivation In Atkins's Physical Chemistry, spontaneity criterion is derived from Clauisius inequality as follows:
Firstly, system is initially at the same temperature T as surroundings. When a change in the system (its state) occurs, there is an corresponding entropy change in the system and a transfer of heat between system and surroundings and Clauisius inequality for this process can be written as: $$dS -\frac {dq}{T} \geqslant 0$$
If process is carried at the same temperature and pressure of a system than $$ dq = dH $$
If we plug dH in Clausius inequality, multiply by T and rearrange what we get is: $$ dG = dH - TdS \le 0$$
Which should prove Gibbs free energy spontaneity criterion for systems at constant p and T. Problem here is that T in the equation for G is of the surroundings not of the system and the whole point of G is to forget about surroundings. Answer you can give to this question is that surroundings and system remain at the same temperature during state change of the system, but if so how can there be any heat transfer between them, for they are already at thermal equilibrium and dq should is zero. When taking Gibbs free energy as spontaneity criterion, system needs to stay at the same pressure and temperature. To keep the system at the same temperature, heat generally needs to be exchanged with the surroundings and if so, heat exchanged with surroundings will change its temperature, so T in Clausius ineqaulity generally is not a constant, it can only be thought as constant if surroundings is uncomparably bigger than the system so that its heat capacity is uncomparably bigger than of system (which in most cases really holds) only in that case T in Clausius inequality can be taken as T of the system. Problem with this is that such an approach gives only approximate solution and equation for G as spontaneity criterion IS NOT AN APPROXIMATION, it holds always regardless of how big system is compared to the surroundings. So, I am not sure this derivation in Atkins's textbook is actually correct for all scenarios not only when surroundings is uncomparably bigger than the system. What are your thoughts?
For a system in contact with a constant temperature reservoir at the same temperature as the system in its initial state, and also in contact with a constant pressure surrounding at the same pressure as the system in its initial state, $$\Delta U=Q-W=Q-P\Delta V-W_{npv}$$where $W_{npv}$ is the amount of non-PV work done by the system.  In addition, from the 2nd law of thermodynamics, we have $$\Delta S=\frac{Q}{T}+\sigma$$where $\frac{Q}{T}$ is the amount of entropy transferred to the system from the surroundings across the interface between the system and surroundings (recall that the latter is always at the initial temperature of the material comprising the system).  Note that this does not say anything about how the temperature may be varying with location and time within the internals of the system during the process.  In addition, the parameter $\sigma$ represents the amount of entropy generated within the system due to irreversibilities during the process. Note that $\sigma$ can only be positive (irreversible process) or zero (reversible process)
If we combine these two equations, we obtain:
$$\Delta U=T\Delta S-T\sigma-P\Delta V-W_{npv}$$or$$\Delta G=-W_{npv}-T\sigma$$ According to this, if no non-PV is done by the system on the surroundings during the process, $\Delta G$ must be negative (irreversible) or zero (reversible).