qsb300/vdwloop
0
van der Waals loop explorer
Enter a "van der Waals loop" equation y = f(x; params) as a string (parsed with sympy). Pick two parameters to sweep over a 2D grid; any others need a fixed value. The app computes, at every grid point where a loop exists:
rho_m*— the naive midpoint of the two spinodal points (roots ofdy/dx = 0)rho_m— the Maxwell equal-area coexistence density, solved numerically (root-finding + integration, not a shortcut formula)
and plots the difference rho_m* - rho_m as a heatmap.
Example: the plain cubic x**3 + a*x**2 + b*x gives rho_m* == rho_m exactly everywhere (a cubic is always point-symmetric about its inflection point), while eps*x**4 + x**3 + a*x**2 + b*x (a small quartic term added for asymmetry) gives a genuine non-zero difference field.
See vdw_loop_generic.py for the underlying model.
