In thermodynamics, in the canonical ensemble, it is said that the state of the system with the lowest free energy will be the equilibrium one.
However, I don't understand how we can defined the free energy of a "state". Indeed, given a system, let us describe a microscopic configuration simply by "$\phi$". Usually in thermodynamics we use $(q,p)$, just to specify what I am talking about. Then, in the canonical ensemble the Free energy is defined as :
$$ F=- k_B T \ln(Z) $$ Where (roughly)
$$ Z = \int d\phi e^{-\beta E(\phi)} $$
Where $E(\phi)$ is the energy of a microscopic configuration $\phi$. Given that, I do not understand, given two different states $\phi_1$ and $\phi_2$, how could I compare their "free energy". Indeed we integrate over all possible states to define the free energy, and thus I do not see how to define it for individual states. Is there a notion of "compartimentalized" free energy, where in some sense we restrict the integral defining $Z$ just to "subset" of states ?
In several resources of thermodynamics, this discussion is not brought up, even though it seems to be a very important point.