I'm probably making a relatively basic mistake here, but I'm a bit confused about the relation between the Hamiltonian and Helmholtz free energy.
From what I can see, the free energy can be written as a function of the partition function as:
$$ A= -\frac{1}{\beta}log(Z) $$
And the partition function can be written as a function of the Hamiltonian as:
$$ Z = tr(e^{-\beta H}) $$
(This is for the quantum case, but my question applies equally to the classical case)
From this, as far as I can see the free energy depends only on the Hamiltonian, not on the actual state of the system (other than its temperature), which I find hard to understand.
For example, imagine the free energy of a free particle before and after it collides with another particle. It will have the same Hamiltonian before and after the collision, but conceptually it seems like the free energy should change (for example if the collision increases its momentum)
Could somebody unravel my confusion here?