flory
flory: A Python package for finding coexisting phases in multicomponent mixtures - Published in JOSS (2025)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
2 of 2 committers (100.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Repository
Python package for finding coexisting phases in multicomponent mixtures.
Basic Info
- Host: GitHub
- Owner: qiangyicheng
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://flory.readthedocs.io/en/latest/
- Size: 601 KB
Statistics
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 3
- Releases: 3
Metadata Files
README.md
flory
flory is a Python package for analyzing field theories of multicomponent mixtures.
In particular, the package provides routines to determine coexisting states numerically, which is a challenging problem since the thermodynamic coexistence conditions are many coupled non-linear equations.
flory supports finding coexisting phases with an arbitrary number of components.
The associated average free energy density of the system reads
$$\bar{f}({N\mathrm{P}}, {Jp}, {\phi{p,i}}) = \sum{p=1}^{{N\mathrm{P}}} Jp f({\phi_{p,i}}) ,$$
where $N\mathrm{C}$ is the number of components, $N\mathrm{P}$ is the number of phases, $Jp$ is the fraction of the system volume occupied by phase $p$, and $\phi{p,i}$ is the volume fraction of component $i$ in phase $p$.
flory supports different forms of interaction, entropy, ensemble, and constraints to describe the free energy of phases.
For example, with the commonly used Flory-Huggins free energy, the free energy density of each homogeneous phase reads
$$f({\phii}) = \frac{1}{2}\sum{i,j=1}^{N\mathrm{C}} \chi{ij} \phii \phij + \sum{i=1}^{N\mathrm{C}} \frac{\phii}{li} \ln \phi_i ,$$
where $\chi{ij}$ is the Flory-Huggins interaction parameter between component $i$ and $j$, and $li$ is the relative molecular size of component $i$.
Given an interaction matrix $\chi{ij}$, average volume fractions of all components across the system $\bar{\phi}i$, and the relative molecule sizes $l_i$, flory provides tools to find the coexisting phases in equilibrium.
Installation
flory is available on pypi, so you should be able to install it through pip:
bash
pip install flory
As an alternative, you can install flory through conda using the conda-forge channel:
bash
conda install -c conda-forge flory
Optional dependencies
By default, only the minimal set of dependencies of flory package will be installed. To install all dependencies, run:
bash
pip install 'flory[dev]'
You can also select the optional dependencies, such as example, test or doc. For example, you can install the package with the optional dependencies only for tests:
bash
pip install 'flory[test]'
If you are using conda, consider install the optional dependencies directly:
bash
conda install -c conda-forge --file https://raw.githubusercontent.com/qiangyicheng/flory/main/examples/requirements.txt
conda install -c conda-forge --file https://raw.githubusercontent.com/qiangyicheng/flory/main/tests/requirements.txt
conda install -c conda-forge --file https://raw.githubusercontent.com/qiangyicheng/flory/main/docs/requirements.txt
Test installation
If the optional dependencies for tests are installed, you can run tests in root directory of the package with pytest. By default, some slow tests are skipped. You can run them with the --runslow option:
bash
pytest --runslow
Usage
The following example determines the coexisting phases of a binary mixture with Flory-Huggins free energy:
```python import flory
numcomp = 2 # Set number of components chis = [[0, 4.0], [4.0, 0]] # Set the \chi matrix phimeans = [0.5, 0.5] # Set the average volume fractions
obtain coexisting phases
phases = flory.findcoexistingphases(numcomp, chis, phimeans) ```
It is equivalent to a more advanced example:
```python import flory
numcomp = 2 # Set number of components chis = [[0, 4.0], [4.0, 0]] # Set the \chi matrix phimeans = [0.5, 0.5] # Set the average volume fractions
create a free energy
fh = flory.FloryHuggins(num_comp, chis)
create a ensemble
ensemble = flory.CanonicalEnsemble(numcomp, phimeans)
construct a finder from interaction, entropy and ensemble
finder = flory.CoexistingPhasesFinder(fh.interaction, fh.entropy, ensemble)
obtain phases by clustering compartments
phases = finder.run().get_clusters() ```
The free energy instance provides more tools for analysis, such as:
```python
calculate the chemical potentials of the coexisting phases
mus = fh.chemical_potentials(phases.fractions) ```
More information
- See examples in examples folder
- Full documentation on readthedocs
Owner
- Name: Yicheng QIang (强 宜澄)
- Login: qiangyicheng
- Kind: user
- Repositories: 3
- Profile: https://github.com/qiangyicheng
JOSS Publication
flory: A Python package for finding coexisting phases in multicomponent mixtures
Authors
Tags
physics phase separation free energyGitHub Events
Total
- Issues event: 24
- Watch event: 4
- Delete event: 6
- Issue comment event: 12
- Push event: 30
- Pull request review event: 1
- Pull request event: 22
- Fork event: 1
- Create event: 8
Last Year
- Issues event: 24
- Watch event: 4
- Delete event: 6
- Issue comment event: 12
- Push event: 30
- Pull request review event: 1
- Pull request event: 22
- Fork event: 1
- Create event: 8
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Yicheng Qiang | y****g@d****e | 218 |
| David Zwicker | d****r@d****e | 38 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 11
- Total pull requests: 26
- Average time to close issues: about 1 month
- Average time to close pull requests: 4 days
- Total issue authors: 5
- Total pull request authors: 2
- Average comments per issue: 0.91
- Average comments per pull request: 1.31
- Merged pull requests: 25
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 11
- Pull requests: 23
- Average time to close issues: about 1 month
- Average time to close pull requests: 5 days
- Issue authors: 5
- Pull request authors: 2
- Average comments per issue: 0.91
- Average comments per pull request: 1.26
- Merged pull requests: 22
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- srmnitc (5)
- qiangyicheng (2)
- SunyongKwon (2)
- david-zwicker (1)
- vchirag (1)
Pull Request Authors
- qiangyicheng (32)
- david-zwicker (13)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 24 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
pypi.org: flory
Python package for finding coexisting phases in multicomponent mixtures
- Documentation: https://flory.readthedocs.io/
- License: MIT License
-
Latest release: 0.3.0
published about 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v4 composite
- actions/setup-python v5 composite
- codecov/codecov-action v4 composite
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- openjournals/openjournals-draft-action master composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- Sphinx >=4
- sphinx-autodoc-typehints >=2.2
- sphinx-paramlinks >=0.6
- sphinx-rtd-theme >=2.0
- numba >=0.57
- numpy >=1.22
- scipy >=1.7
- tqdm >=4.60
- pytest >=6.2 test
- pytest-cov >=4.0 test
