How to choose the microstates so that thermodynamical entropy coincides with statistical mechanics entropy?

As turned out in this question, thermodynamical entropy (which does not depend on microstates) and statistical mechanics entropy (which depends on the choice of microstates) are two different things. Suppose that we have a system in canonical ensemble. How can we choose the microstates so that the thermodynamical entropy and SM entropy coincide?

For example, consider a gas where the microstates are combinations of positions and velocities of molecules. We can view a pair (position,velocity) as an element of $$\mathbb R^4$$, and then discretize $$\mathbb R^4$$ to obtain a grid. How large should the grid size/density be?

Update: The thermodynamical entropy is actually also not uniquely defined: we have $$dS=\frac{dQ_{rev}}{T}$$. Therefore, it is defined up to an additive constant. So in orther for the two entropies to coincide, one should choose both the additive constant for thermodynamical entropy and the number of microstates for SM entropy.

First on the additive constant: it doesn't matter. Since, as you point out, classical thermodynamics defines $$\Delta S$$, not $$S$$, the classical entropy has an arbitrary constant attached to it. But it is always $$\Delta S$$ that we measure or care to calculate, the additive constant is irrelevant. The statistical entropy only needs to match the classical entropy when we take the difference between the same two states.

On the calculation of the statistical entropy – The short answer: By taking the microstate to be a volume element in momentum $$\times$$ space (phase space) and by assigning equal weight to all microstates with the same energy, volume and number of particles, we end up with a statistical entropy that behaves exactly the same as classical entropy. That's the beauty of statistical mechanics. No additional assumptions, discretizations or other such operations required.

On the calculation of the statistical entropy – The longer answer: We do not discretize the continuous phase space, we integrate over it. The easiest demonstration is in the canonical partition function: $$Q = \frac{1}{h^{3N}N!} \int e^{-\mathbf{p}^2/2mkT} d^N \mathbf{p} \int e^{-E_P/mkT} d^{N} \mathbf{r}$$ where $$\mathbf{p}$$ is the vector of all $$(x,y,z)$$ components of momentum of all particles and $$\mathbf{r}$$ is the vector of all positions. Here a volume element of phase space is represented by the product $$d^N\mathbf{p}~ d^N\mathbf{r} = dr_{1x} dp_{1x} dr_{1y} dp_{1y} dr_{1z} dp_{1z} \cdots$$ This is a true differential, which is to say that the size of the grid goes to zero. The momentum integral can be solved directly: $$\frac{1}{h^{3N}} \int e^{-\mathbf{p}^2/2mkT} d^N \mathbf{p} = \left(\frac{2\pi m k T}{h^2}\right)^{3N/2}$$ The integral over space cannot be solved for arbitrary potential energy but in the special case $$E_P=0$$ (no interactions) we obtain the simple result $$\int e^{-E_P/mkT} d^{N} \mathbf{r} = V^N$$ Combining with the momentum integral we obtain the canonical partition of the ideal gas: $$Q^\text{ig} = \frac{V^N}{N!}\left(\frac{2\pi m k T}{h^2}\right)^{3N/2} \tag{1}$$ Since the question was about entropy, in the canonical ensemble we calculate it as $$\frac{S}{k} = \ln Q - \beta \left(\frac{\ln\partial Q}{\partial\beta}\right)$$ Applying this to the partition function of the ideal gas we obtain the an entropy that matches the classical entropy of the ideal gas to within an additive constant. The result can be found in any standard textbook. The point of this lengthier answer was to address the question about how to discretize the phase space: there is no discretization involved.

• @MichaelMitsopoulos If you can perform the experiment you are describing, ie choose the spin of the electron on hydrogen atoms, then spin is thermodynamically relevant. Statistical entropy does not exist independently of the macroscopic state: it is the number (actually its log) of microscopic ways that correspond to the same macroscopic state. This is the underlying principle in all ensembles. Oct 20, 2022 at 10:43
• Aha, I see! That's what was a bit unclear to me. If we have fast moving atoms on the left and slow moving on the right, then we can exploit the difference in pressure to do work - say move a piston. Are you saying that, assuming we do have the ability to separate H atoms based on their spin, that means automatically that we have the ability to also get useful work out of this system even if temperature is the same in every point? Makes sense since after all we need to put work in order to separate them. Oct 20, 2022 at 11:17
• @Themis : So to put it into practical terms, if we can separate hydrogen atoms based on their spin, probably with some kind of electromagnet, then we can have that electromagnet generate electricity when we mix the separate sides? Oct 20, 2022 at 11:27
• @MichaelMitsopoulos The aha moment! You answered your own question: it takes work to separate a mixture and this work can, in principle at least, be recovered when mixing. Oct 20, 2022 at 12:03
• @MichaelMitsopoulos Good question! You might be interested in this. You also might want to check Jaynes' "The Gibbs Paradox" paper. The essence is that more knowledge of the system, say the partitioned gas(es) in in the box, might allow one to extract more work. And observers (e.g. experimenters with different experimental ability to control the system/process) might assign different entropy changes to the very same physical process, e.g. the expansion of the gas(es). Oct 20, 2022 at 14:39

Actually, thermodynamic entropy depends on the definition of your system in some sense, just as the statistical entropy depends on the micro-states.

The classic example is Gibbs’ paradox. If you have two different gases in a container that are initially divided by a separation and you remove the separation to mix them, entropy increases. However if you did not know that they were different and you assume that they are the same gas, the entropy remains constant, on a macroscopic level nothing happened.

Thus, coarse graining your system changes its thermodynamic entropy, even physically nothing changed. Entropy is always relative to the limited knowledge of your system. The same is true with energy btw.

For your question on the gas, the grid size is irrelevant as it will only contribute to an additive constant to entropy. Only differences of entropy matter. So when you look for example at the difference of entropy when the volume is increased for example, it drops out. Note that the measure you use to measure the volume of phase space matters (the “gridlines”). From Hamiltonian mechanics, there is only one (up to multiplicative factor) natural candidate that is preserved by canonical transformations (induced by the natural symplectic structure), which is the measure you must be implicitly thinking about in canonical coordinates.

Hope this helps.