‘flory’ Python package

The flory Python package provides tools for investigating phase separation in multicomponent mixtures. In particular, it allows to determine equilibrium states of \(N_\mathrm{P}\) coexisting phases, each described by the volume fractions \(\phi_{p,i}\) of the \(i=1, \ldots, N_\mathrm{C}\) components.

flory finds coexisting phases by minimizing the average free energy density

\[\bar{f}({N_\mathrm{P}}, \{J_p\}, \{\phi_{p,i}\}) = \sum_{p=1}^{{N_\mathrm{P}}} J_p f(\{\phi_{p,i}\}) \; ,\]

where \(J_p\) is the fraction of the system volume occupied by phase \(p\).

flory supports different forms of interaction, entropy, ensemble, and constraints to assemble the free energy of the phases. For example, with the commonly used Flory-Huggins free energy, the free energy density of each homogeneous phase reads

\[f(\{\phi_i\}) = \frac{1}{2}\sum_{i,j=1}^{N_\mathrm{C}} \chi_{ij} \phi_i \phi_j + \sum_{i=1}^{N_\mathrm{C}} \frac{\phi_i}{l_i} \ln \phi_i \; ,\]

where \(\chi_{ij}\) is the Flory interaction parameter between component \(i\) and \(j\), and \(l_i\) is the relative molecule size of the component \(i\). For a given interaction matrix \(\chi_{ij}\), average volume fractions of all components across the system \(\bar{\phi}_i\), and the relative molecule sizes \(l_i\), the coexisting phases are those configurations that minimize \(\bar f\), which is used by flory:

1import flory
2chis = [[0, 4.0], [4.0, 0]]
3phi_means = [0.5, 0.5]
4phases = flory.find_coexisting_phases(2, chis, phi_means)

The example above is equivalent to a detailed one,

1fh = flory.FloryHuggins(2, chis)
2ensemble = flory.CanonicalEnsemble(2, phi_means)
3finder = flory.CoexistingPhasesFinder(fh.interaction, fh.entropy, ensemble)
4phases = finder.run().get_clusters()

See Examples for more use cases.

Contents

Indices and tables