Thermodynamics of a capacitor I'm trying to understand a capacitor as a thermodynamic system. The voltage across a capacitor is
$$V=\frac QC$$
where, lets say, the -ve plate is grounded at zero volts, the +ve plate is at V volts, and Q is the amount of positive charge on the +ve plate, always equal in magnitude to the amount of negative charge on the -ve plate. The internal energy of a capacitor is 
$$U = \frac 12QV$$
so differentiating, we get 
$$dU = \frac12(QdV+VdQ) = VdQ$$ 
The fundamental equation states that $dU = TdS-PdV+X$ where X is other terms I'm not sure of. The $PdV$ term is zero (no energy stored in volume change). 
The entropy of a capacitor is a function of $V$ and $Q$ such that for a small negative change $dQ$ in $Q$, the entropy increases. In other words, removing a positive $dQ$ from the +ve plate, and likewise with a negative charge on the -ve plate is a move towards equilibrium and entropy increases. $TdS$ is the amount of work necessary to restore the system to its original state, which is $-VdQ$ (Note: $dQ$ negative means $TdS$ is positive). So now the fundamental equation looks like 
$$VdQ = -VdQ + X \text { or } X=2VdQ$$ 
What are the extra terms? Is the recombination of a positive and a negative charge a chemical process which emits heat and involves a chemical potential? I've seen a $VdQ$ term tacked onto the fundamental equation as well, but never a $2VdQ$.
If the Gibbs energy $G$ obeys $dG = dU-TdS+pdV$, then $dG = 2VdQ$ and $dG=0$ at equilibrium, which means $V=0$. That's correct, the maximum entropy of a capacitor (at fixed T and P) is its completely discharged state.
Is this argument valid? If so, what are the extra terms?
 A: I found a relevant paper at https://arxiv.org/pdf/1201.3890.pdf and it develops the entropy of a capacitor assuming the charge carriers in the plates are electrons in an ideal Fermi gas. It says that without this small contribution, the entropy of a capacitor is zero. The discharge of a capacitor is then pure work, and no entropy is produced. When discharging through a resistor at a constant temperature, the energy of the charge transfer is converted to heat in the resistor, which is dumped to the constant-temperature heat bath. The temperature of the resistor never changes, so it too has no change in entropy. The entropy of the RC system is unchanged, and the entropy of the heat bath increases by $VdQ$.
The fundamental law is then $dU=T(dSc+dSr) + Pdv + Vdq$, with the entropy and volume terms equal to zero, so that $VdQ=VdQ$. The Gibbs energy is $dG = dU-TdS-Pdv = VdQ$ which at equilibrium is zero, implying V=0, a fully discharged capacitor. 
So yes, Bob Jacobsen is right, practically no entropy change for a real capacitor, none for an "ideal" capacitor.
