A lot of solubility theories are built around the idea of a "lattice" of molecules. The idea that solvent molecules are arranged in a neat pseudo-crystalline order is clearly nonsense, but it turns out that this approach yields maximum insight for minimum effort and in fact the perfect lattice is more a "guide for the eye" than an intrinsic part of the theory.
The core idea in lattice theory is that if one molecule at a lattice position is replaced with another, three things happen.
- Entropy increases (more disorder), so ΔS is negative
- Enthalpy increases (worse), so ΔH is positive
- The free energy, ΔG is a balance of the two, with a negative value being good for mixing
Why does the enthalpy increase? Interactions of like molecule with like are generally stronger than like with unlike. The number of like/unlike interactions depends, of course, on the % mix of the two molecules. Both the entropy and enthalpy terms are a maximum at 50%.
If we assign a "solubility parameter" δ1 and δ2 to the self-interactions of molecules 1 and 2 then, via some elementary algebra and the "mean field theory" which assumes no self-organisation within the fluid, and if we assume, for simplicity, that volume fraction is the same as number fraction, n, then we can compute each term in the ΔG balance, ΔG=ΔH-TΔS, setting T=8 in this simple demo, for reasons discussed shortly:
ΔS = n1.log(n1)+n2.log(n2)
ΔH = -n1.n2.z(δ1δ2-0.5(δ1²+δ2²))
We see that the δ values capture the balance of self-liking 0.5(δ1²+δ2²) and the weaker unlike interaction (δ1*δ2). The self-like term is the mean, the unlike term is the geometric mean. To put it into more familiar terms, it is 0.5(δ1-δ2)², the classic solubility parameter "Distance". The factor z is simply the number of near-neighbours in whatever lattice is being used, in this app n=4. The value T=8 for ΔS in the calculation here is simply to give a balance of ΔS and ΔH resulting in a reasonable correlation of mutual (in)solubility with the distance.
By playing with the % Solvent 2 and the different δ values, and by looking at lattice itself, you get a good feeling for what basic lattice theory is all about. If the view is confusing, just rotate it with your mouse or touchscreen.
The numbers themselves are neither important nor realistic. They simply convey the trends, emphasising that for good solubility, δ values have to be comparatively close. Of course, as discussed on this site, the single (Hildebrand) solubility parameter is positively wrong and the full 3-parameter HSP should be used. But, again, the point of this app is to demonstrate the broad principles.
When, for demo purposes only, ΔG>5 then it is assumed that the solvents cannot mix so they separate into individual phases.