On the derivation of diffusion coefficient in thermodynamic terms I'm trying to express the diffusion coefficient $D$, regarding particles suspended in a liquid, in terms of thermodynamic parameters. In this, some evident problems were encountered when trying to utilize the Helmholtz potential applied for equilibrium, as seen here: On an equality following from the Helmholtz free energy expression Firstly, if one is to think of these particles in a thermodynamic sense (in the thermodynamic limit) one is to adopt inevitably the equipartition theorem, which for a monoatomic system as the one at hand derives $\frac{1}{2}kT$ as the average energy per degree of freedom of the ensemble, not a function of anything else. Violations of the equipartition theorem can be thought of only when quantum effects are at play or when the particles are somehow coupled. The system in On an equality following from the Helmholtz free energy expression is purely classical and the motion of the particles is independent of each other. Therefore, the equipartition theorem should apply in full force in the case observed. However, as seen in On an equality following from the Helmholtz free energy expression the average energy derived is not $\frac{1}{2}kT$, as expected, but is $kT$ and it is multiplied by an $x$-dependent function, in conflict with what is known for such systems in terms of energy equipartition. And, perhaps, the most obvious problem is that what is derived requires that a negative quantity be equal to a positive quantity which is obviously impossible.
Since the above attempt to express $D$ in thermodynamic terms failed, I'm trying to figure out how van't Hoff's osmotic pressure formula $\Pi = i mRT$, containing thermodynamic parameters, where $i$ is the van't Hoff factor, $m$ is molality, $R$ is the gas constant and $T$ is the temperature, can be employed for the purpose at hand, in combination with Stoke's and Fick's first law. However, it appears I'm stumbling as early as the first steps of this derivation. 
Thus, let's have $n$ particles in volume $V$ of cross-sectional area $A$ perpendicular to the $x$-axis but let the concentration of these particles $\nu(x)$ vary with $x$.
Let's now observe a sub-volume $\Delta V$ between $x$ and $x + \Delta x$ and let now this sub-volume contain $n_{sub}$ particles. 
We can denote the osmotic pressure by $\Pi = \Pi(x)$ and note that this osmotic pressure $\Pi(x)$ exerted by the particles lying on the plane at $x$ (said plane being perpendicular to the $x$-axis, as noted) is in fact the overall force $F(x)$ of all these particles divided by the cross-sectional area $A$ of the perpendicular plane. The same applies for $\Pi(x + \Delta x)$. So, now, because concentration $\nu(x)$ changes with $x$, we can write for the change of osmotic pressure, when the independent variable $x$ runs from $x$ to $x + \Delta x$, the following
$$\frac{F(x)}{A} - \frac{F(x + \Delta x)}{A} = \Pi(x) - \Pi(x + \Delta x). \ \ \ \ \ \ \ \ \ \ (1)$$
Again, $F$ is the overall force acting on all the particles that are situated on the plane with surface area $A$, perpendicular to the $x$-axis at coordinates $x$ (respectively, $x + \Delta x$).  
Notice, because the force is to the left (toward the negative direction of the $x$-axis), we consider $\Pi(x + \Delta x)$ as the initial, while $\Pi(x)$ as the final value of the osmotic pressure and that's why we write $\Pi_{final} - \Pi_{initial} = \Pi(x) - \Pi(x + \Delta x)$.
Now, let's denote by $f$ the average force which acts on the individual molecules in the volume $A\Delta x(x,t)$. Then, 
$$\frac{n_{sub}}{A \Delta x(x, t)} \ \ \ \ \ \ \ \ \ \ (2)$$ 
will be the number of particles in the sub-volume and 
$$F_{average} = \frac{n_{sub}}{A \Delta x(x, t)} f(x, t) \ \ \ \ \ \ \ \ \ \ (3)$$ 
will be the average overall force acting on all the particles contained in the volume $A dx$. But, then, this means that $F_{average}$ will be the same, both when acting on the molecules sitting on the plane at $x$ and on those sitting on the plane at $x + \Delta x$. Indeed, $F_{average}$ will differ for the different $dx(x, t)$ but for a given $dx$ it will be the same. However, this means that 
$$\frac{F(x) - F(x + \Delta x)}{A} = \Pi(x) - \Pi(x + \Delta x) = 0 \ \ \ \ \ \ \ \ \ \ (4)$$
if these $F$ are expressed with the $F_{average}$. So, some different expression has to be sought for those $F(x)$ and $F(x + \Delta x$ but no matter what these new expressions might be, it seems it will complicate the formula for $D$, compared to the clean expression for $D$ known from the literature. Does anyone know a way to improve this derivation or perhaps offer some other way of connecting $D$ with thermodynamics?
 A: Deriving the diffusion coefficient from consideration about the osmotic pressure is what Einstein did in his paper "On the movement of small particles suspended in a stationary liquid by the molecular-kinetic theory of heat". You can find the paper for example here.
Considering the dynamic equilibrium of particles suspended in a liquid under the action of a force $F$, he derived from thermodynamic considerations the expression
$$\frac{\partial \nu}{\partial x} = \frac{F}{k_B T} \nu \tag{1}\label{1}$$
where $\nu$ is the number density of the particles and $k_B$ is Boltzmann's constant. We also note that $p=k_B T \nu$ is the osmotic pressure, so that we conclude that the equilibrium with the force $F$ is brought about by osmotic pressure.
Assuming that the particle have spherical shape and radius $R$, he then used Stoke's formula to write the velocity of the particles as 
$$V=\frac{F}{6 \pi \eta R}$$
where $\eta$ is the viscosity of the solvent and $R$ the radius of the particles. He then argued that if $D$ is the diffusion coefficient of the particles, then the condition of dynamic equilibrium can be equivalentely expressed as 
$$V\nu = \frac{F \nu}{6 \pi \eta R} = D\frac{\partial \nu}{\partial x} \tag{2}\label{2} \longrightarrow \frac{\partial \nu}{\partial x} = \frac{F \nu}{6 \pi \eta R D}$$
Combining \ref{1} and \ref{2} you get 
$$D=\frac{k_B T}{6 \pi \eta R}$$
which is known as the Stokes-Einstein formula.
