flory 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flory-0.0.0/.github/workflows/codecov.yml +45 -0
- flory-0.0.0/.github/workflows/python-package.yml +34 -0
- flory-0.0.0/.github/workflows/release.yml +41 -0
- flory-0.0.0/.gitignore +16 -0
- flory-0.0.0/.readthedocs.yaml +32 -0
- flory-0.0.0/CODE_OF_CONDUCT.md +134 -0
- flory-0.0.0/LICENSE +21 -0
- flory-0.0.0/PKG-INFO +82 -0
- flory-0.0.0/README.md +49 -0
- flory-0.0.0/docs/Makefile +24 -0
- flory-0.0.0/docs/make.bat +35 -0
- flory-0.0.0/docs/paper/flory.bib +87 -0
- flory-0.0.0/docs/paper/flory.md +83 -0
- flory-0.0.0/docs/requirements.txt +4 -0
- flory-0.0.0/docs/rtd-requirements.txt +2 -0
- flory-0.0.0/docs/source/_templates/custom-module-template.rst +62 -0
- flory-0.0.0/docs/source/api.rst +13 -0
- flory-0.0.0/docs/source/conf.py +71 -0
- flory-0.0.0/docs/source/detail.rst +14 -0
- flory-0.0.0/docs/source/examples.rst +95 -0
- flory-0.0.0/docs/source/index.rst +50 -0
- flory-0.0.0/docs/source/theory.rst +92 -0
- flory-0.0.0/examples/binary_phase_diagram.py +33 -0
- flory-0.0.0/examples/binary_phase_diagram.py.jpg +0 -0
- flory-0.0.0/examples/find_coexiting_phases.py +10 -0
- flory-0.0.0/examples/find_coexiting_phases.py.out +3 -0
- flory-0.0.0/examples/find_coexiting_phases_ternary.py +11 -0
- flory-0.0.0/examples/find_coexiting_phases_ternary.py.out +3 -0
- flory-0.0.0/examples/find_coexiting_phases_unequal_sizes.py +11 -0
- flory-0.0.0/examples/find_coexiting_phases_unequal_sizes.py.out +3 -0
- flory-0.0.0/examples/finite_size_effect.py +29 -0
- flory-0.0.0/examples/finite_size_effect.py.jpg +0 -0
- flory-0.0.0/examples/ternary_phase_diagram.py +82 -0
- flory-0.0.0/examples/ternary_phase_diagram.py.jpg +0 -0
- flory-0.0.0/flory/__init__.py +18 -0
- flory-0.0.0/flory/_version.py +16 -0
- flory-0.0.0/flory/detail/mcmp_impl.py +524 -0
- flory-0.0.0/flory/mcmp.py +641 -0
- flory-0.0.0/flory.egg-info/PKG-INFO +82 -0
- flory-0.0.0/flory.egg-info/SOURCES.txt +47 -0
- flory-0.0.0/flory.egg-info/dependency_links.txt +1 -0
- flory-0.0.0/flory.egg-info/requires.txt +12 -0
- flory-0.0.0/flory.egg-info/top_level.txt +1 -0
- flory-0.0.0/pyproject.toml +46 -0
- flory-0.0.0/requirements.txt +4 -0
- flory-0.0.0/setup.cfg +4 -0
- flory-0.0.0/tests/detail/test_mcmp_impl.py +149 -0
- flory-0.0.0/tests/requirements.txt +2 -0
- flory-0.0.0/tests/test_mcmp.py +189 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and report code coverage to Codecov
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: Codecov
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "main" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "main" ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
timeout-minutes: 30
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
python-version: ["3.12"]
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
python -m pip install pytest pytest-cov
|
|
32
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
33
|
+
- name: Test with pytest
|
|
34
|
+
env:
|
|
35
|
+
NUMBA_DISABLE_JIT: 1
|
|
36
|
+
run: |
|
|
37
|
+
python -m pytest --cov=flory --cov-report xml:.coverage_report.xml
|
|
38
|
+
- name: Upload coverage reports to Codecov
|
|
39
|
+
uses: codecov/codecov-action@v4.0.1
|
|
40
|
+
with:
|
|
41
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
42
|
+
file: ./.coverage_report.xml
|
|
43
|
+
flags: Tests
|
|
44
|
+
name: codecov-flory
|
|
45
|
+
fail_ci_if_error: true
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests with a variety of Python versions
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: Tests
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "main" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "main" ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
python -m pip install pytest
|
|
31
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
32
|
+
- name: Test with pytest
|
|
33
|
+
run: |
|
|
34
|
+
python -m pytest
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Upload Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [released]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
deploy:
|
|
10
|
+
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
timeout-minutes: 30
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
- name: Set up Python 3.12
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: 3.12
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install build twine
|
|
29
|
+
|
|
30
|
+
- name: Prepare build
|
|
31
|
+
run: |
|
|
32
|
+
python -m build
|
|
33
|
+
|
|
34
|
+
- name: Check the package
|
|
35
|
+
run: twine check --strict dist/*
|
|
36
|
+
|
|
37
|
+
- name: Build and publish
|
|
38
|
+
env:
|
|
39
|
+
TWINE_USERNAME: __token__
|
|
40
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
41
|
+
run: python -m twine upload dist/*
|
flory-0.0.0/.gitignore
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# .readthedocs.yaml
|
|
2
|
+
# Read the Docs configuration file
|
|
3
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
4
|
+
|
|
5
|
+
# Required
|
|
6
|
+
version: 2
|
|
7
|
+
|
|
8
|
+
# Set the OS, Python version and other tools you might need
|
|
9
|
+
build:
|
|
10
|
+
os: ubuntu-22.04
|
|
11
|
+
tools:
|
|
12
|
+
python: "3.12"
|
|
13
|
+
# You can also specify other tool versions:
|
|
14
|
+
# nodejs: "19"
|
|
15
|
+
# rust: "1.64"
|
|
16
|
+
# golang: "1.19"
|
|
17
|
+
|
|
18
|
+
# Build documentation in the "docs/source" directory with Sphinx
|
|
19
|
+
sphinx:
|
|
20
|
+
configuration: docs/source/conf.py
|
|
21
|
+
|
|
22
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
|
23
|
+
formats:
|
|
24
|
+
- pdf
|
|
25
|
+
- epub
|
|
26
|
+
|
|
27
|
+
# Optional but recommended, declare the Python requirements required
|
|
28
|
+
# to build your documentation
|
|
29
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
30
|
+
python:
|
|
31
|
+
install:
|
|
32
|
+
- requirements: docs/rtd-requirements.txt
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
|
|
2
|
+
# Contributor Covenant Code of Conduct
|
|
3
|
+
|
|
4
|
+
## Our Pledge
|
|
5
|
+
|
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
7
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
9
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
10
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
11
|
+
identity and orientation.
|
|
12
|
+
|
|
13
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
14
|
+
diverse, inclusive, and healthy community.
|
|
15
|
+
|
|
16
|
+
## Our Standards
|
|
17
|
+
|
|
18
|
+
Examples of behavior that contributes to a positive environment for our
|
|
19
|
+
community include:
|
|
20
|
+
|
|
21
|
+
* Demonstrating empathy and kindness toward other people
|
|
22
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
23
|
+
* Giving and gracefully accepting constructive feedback
|
|
24
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
25
|
+
and learning from the experience
|
|
26
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
27
|
+
community
|
|
28
|
+
|
|
29
|
+
Examples of unacceptable behavior include:
|
|
30
|
+
|
|
31
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
32
|
+
any kind
|
|
33
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
34
|
+
* Public or private harassment
|
|
35
|
+
* Publishing others' private information, such as a physical or email address,
|
|
36
|
+
without their explicit permission
|
|
37
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
38
|
+
professional setting
|
|
39
|
+
|
|
40
|
+
## Enforcement Responsibilities
|
|
41
|
+
|
|
42
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
43
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
44
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
45
|
+
or harmful.
|
|
46
|
+
|
|
47
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
48
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
49
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
50
|
+
decisions when appropriate.
|
|
51
|
+
|
|
52
|
+
## Scope
|
|
53
|
+
|
|
54
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
55
|
+
an individual is officially representing the community in public spaces.
|
|
56
|
+
Examples of representing our community include using an official email address,
|
|
57
|
+
posting via an official social media account, or acting as an appointed
|
|
58
|
+
representative at an online or offline event.
|
|
59
|
+
|
|
60
|
+
## Enforcement
|
|
61
|
+
|
|
62
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
63
|
+
reported to the community leaders responsible for enforcement at
|
|
64
|
+
[yicheng.qiang@ds.mpg.de].
|
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
66
|
+
|
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
68
|
+
reporter of any incident.
|
|
69
|
+
|
|
70
|
+
## Enforcement Guidelines
|
|
71
|
+
|
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
74
|
+
|
|
75
|
+
### 1. Correction
|
|
76
|
+
|
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
78
|
+
unprofessional or unwelcome in the community.
|
|
79
|
+
|
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
|
83
|
+
|
|
84
|
+
### 2. Warning
|
|
85
|
+
|
|
86
|
+
**Community Impact**: A violation through a single incident or series of
|
|
87
|
+
actions.
|
|
88
|
+
|
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
93
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
94
|
+
ban.
|
|
95
|
+
|
|
96
|
+
### 3. Temporary Ban
|
|
97
|
+
|
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
|
99
|
+
sustained inappropriate behavior.
|
|
100
|
+
|
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
102
|
+
communication with the community for a specified period of time. No public or
|
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
105
|
+
Violating these terms may lead to a permanent ban.
|
|
106
|
+
|
|
107
|
+
### 4. Permanent Ban
|
|
108
|
+
|
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
112
|
+
|
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
114
|
+
community.
|
|
115
|
+
|
|
116
|
+
## Attribution
|
|
117
|
+
|
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
119
|
+
version 2.1, available at
|
|
120
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
121
|
+
|
|
122
|
+
Community Impact Guidelines were inspired by
|
|
123
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
124
|
+
|
|
125
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
127
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
128
|
+
|
|
129
|
+
[homepage]: https://www.contributor-covenant.org
|
|
130
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
131
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
132
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
133
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
134
|
+
|
flory-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Yicheng Qiang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
flory-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: flory
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Python package for finding coexisting phases in multicomponent mixtures
|
|
5
|
+
Author-email: Yicheng Qiang <yicheng.qiang@ds.mpg.de>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: homepage, https://github.com/qiangyicheng/flory
|
|
8
|
+
Project-URL: repository, https://github.com/qiangyicheng/flory
|
|
9
|
+
Keywords: physics,phase-separation,free-energy
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numba>=0.57
|
|
23
|
+
Requires-Dist: numpy>=1.22
|
|
24
|
+
Requires-Dist: scipy>=1.7
|
|
25
|
+
Requires-Dist: tqdm>=4.60
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=6.2; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: Sphinx>=4; extra == "dev"
|
|
30
|
+
Requires-Dist: sphinx-autodoc-typehints>=2.2; extra == "dev"
|
|
31
|
+
Requires-Dist: sphinx-paramlinks>=0.6; extra == "dev"
|
|
32
|
+
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "dev"
|
|
33
|
+
|
|
34
|
+
# flory
|
|
35
|
+
|
|
36
|
+
[](https://github.com/qiangyicheng/flory/actions/workflows/python-package.yml)
|
|
37
|
+
[](https://codecov.io/github/qiangyicheng/flory)
|
|
38
|
+
[](https://flory.readthedocs.io/en/latest/?badge=latest)
|
|
39
|
+
|
|
40
|
+
`flory` is a Python package for determining multiple coexisting phases in multicomponent mixtures.
|
|
41
|
+
Although finding coexisting phases of binary mixture is simple, finding multiple coexisting phases in many-component mixtures is challenging, mainly due to the coupling of lots of nolinear equations.
|
|
42
|
+
Currently `flory` supports finding coexisting phases of arbitrary multicomponent system with Flory-Huggins interactions in the canonical ensemble, whose average free energy density reads
|
|
43
|
+
|
|
44
|
+
$$\bar{f}({N_\mathrm{p}}, \{J_\alpha\}, \{\phi_i^{(\alpha)}\}) = \sum_{\alpha=1}^{{N_\mathrm{p}}} J_\alpha f(\{\phi_i^{(\alpha)}\}) \; ,$$
|
|
45
|
+
|
|
46
|
+
where $N_\mathrm{c}$ is the number of components, $N_\mathrm{p}$ is the number of phases, $J_\alpha$ is the volume fraction of the phase $\alpha$ and $\phi_i^{(\alpha)}$ is the volume fraction of the component $i$ in the phase $\alpha$.
|
|
47
|
+
Each phase is considered to be homogeneous with a energy density
|
|
48
|
+
|
|
49
|
+
$$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 \; ,$$
|
|
50
|
+
|
|
51
|
+
where $\chi_{ij}$ is the Flory-Huggins interaction between component $i$ and $j$, and $l_i$ is the relative molecule size of the component $i$.
|
|
52
|
+
With given 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.
|
|
53
|
+
|
|
54
|
+
Installation
|
|
55
|
+
------------
|
|
56
|
+
|
|
57
|
+
`flory` is available on `pypi`, so you should be able to install it through `pip`:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install flory
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Usage
|
|
64
|
+
-----
|
|
65
|
+
|
|
66
|
+
A simple example finds the coexisting phases of a binary mixture:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import flory
|
|
70
|
+
|
|
71
|
+
chis = [[0, 4.0], [4.0, 0]] # Set the \chi matrix
|
|
72
|
+
phi_means = [0.5, 0.5] # Set the average volume fractions
|
|
73
|
+
|
|
74
|
+
volumes, phis = flory.find_coexisting_phases(chis, phi_means, 16) # obtain the relative volumes and the compositions of the two coexisting phases
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
More information
|
|
79
|
+
----------------
|
|
80
|
+
* See examples in [examples folder](https://github.com/qiangyicheng/flory/tree/main/examples)
|
|
81
|
+
* [Full documentation on readthedocs](https://flory.readthedocs.io/)
|
|
82
|
+
|
flory-0.0.0/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# flory
|
|
2
|
+
|
|
3
|
+
[](https://github.com/qiangyicheng/flory/actions/workflows/python-package.yml)
|
|
4
|
+
[](https://codecov.io/github/qiangyicheng/flory)
|
|
5
|
+
[](https://flory.readthedocs.io/en/latest/?badge=latest)
|
|
6
|
+
|
|
7
|
+
`flory` is a Python package for determining multiple coexisting phases in multicomponent mixtures.
|
|
8
|
+
Although finding coexisting phases of binary mixture is simple, finding multiple coexisting phases in many-component mixtures is challenging, mainly due to the coupling of lots of nolinear equations.
|
|
9
|
+
Currently `flory` supports finding coexisting phases of arbitrary multicomponent system with Flory-Huggins interactions in the canonical ensemble, whose average free energy density reads
|
|
10
|
+
|
|
11
|
+
$$\bar{f}({N_\mathrm{p}}, \{J_\alpha\}, \{\phi_i^{(\alpha)}\}) = \sum_{\alpha=1}^{{N_\mathrm{p}}} J_\alpha f(\{\phi_i^{(\alpha)}\}) \; ,$$
|
|
12
|
+
|
|
13
|
+
where $N_\mathrm{c}$ is the number of components, $N_\mathrm{p}$ is the number of phases, $J_\alpha$ is the volume fraction of the phase $\alpha$ and $\phi_i^{(\alpha)}$ is the volume fraction of the component $i$ in the phase $\alpha$.
|
|
14
|
+
Each phase is considered to be homogeneous with a energy density
|
|
15
|
+
|
|
16
|
+
$$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 \; ,$$
|
|
17
|
+
|
|
18
|
+
where $\chi_{ij}$ is the Flory-Huggins interaction between component $i$ and $j$, and $l_i$ is the relative molecule size of the component $i$.
|
|
19
|
+
With given 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.
|
|
20
|
+
|
|
21
|
+
Installation
|
|
22
|
+
------------
|
|
23
|
+
|
|
24
|
+
`flory` is available on `pypi`, so you should be able to install it through `pip`:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install flory
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Usage
|
|
31
|
+
-----
|
|
32
|
+
|
|
33
|
+
A simple example finds the coexisting phases of a binary mixture:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import flory
|
|
37
|
+
|
|
38
|
+
chis = [[0, 4.0], [4.0, 0]] # Set the \chi matrix
|
|
39
|
+
phi_means = [0.5, 0.5] # Set the average volume fractions
|
|
40
|
+
|
|
41
|
+
volumes, phis = flory.find_coexisting_phases(chis, phi_means, 16) # obtain the relative volumes and the compositions of the two coexisting phases
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
More information
|
|
46
|
+
----------------
|
|
47
|
+
* See examples in [examples folder](https://github.com/qiangyicheng/flory/tree/main/examples)
|
|
48
|
+
* [Full documentation on readthedocs](https://flory.readthedocs.io/)
|
|
49
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
21
|
+
|
|
22
|
+
cleanall:
|
|
23
|
+
@$(SPHINXBUILD) -M clean ${@:2} "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
24
|
+
rm -r $(SOURCEDIR)/_autosummary
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
@article{zwicker2022Evolved,
|
|
2
|
+
title = {Evolved Interactions Stabilize Many Coexisting Phases in Multicomponent Liquids},
|
|
3
|
+
author = {Zwicker, David and Laan, Liedewij},
|
|
4
|
+
year = {2022},
|
|
5
|
+
month = jul,
|
|
6
|
+
journal = {Proc. Natl. Acad. Sci. U.S.A.},
|
|
7
|
+
volume = {119},
|
|
8
|
+
number = {28},
|
|
9
|
+
pages = {e2201250119},
|
|
10
|
+
publisher = {Proceedings of the National Academy of Sciences},
|
|
11
|
+
doi = {10.1073/pnas.2201250119},
|
|
12
|
+
urldate = {2023-06-21}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@incollection{panagiotopoulos1995Gibbs,
|
|
16
|
+
title = {Gibbs {{Ensemble Techniques}}},
|
|
17
|
+
booktitle = {Observation, {{Prediction}} and {{Simulation}} of {{Phase Transitions}} in {{Complex Fluids}}},
|
|
18
|
+
author = {Panagiotopoulos, Athanassios Z.},
|
|
19
|
+
editor = {Baus, Marc and Rull, Luis F. and Ryckaert, Jean-Paul},
|
|
20
|
+
year = {1995},
|
|
21
|
+
series = {Nato {{Science Series C}}},
|
|
22
|
+
pages = {463--501},
|
|
23
|
+
publisher = {Springer Netherlands},
|
|
24
|
+
address = {Dordrecht},
|
|
25
|
+
doi = {10.1007/978-94-011-0065-6_11},
|
|
26
|
+
urldate = {2024-03-01},
|
|
27
|
+
isbn = {978-94-011-0065-6},
|
|
28
|
+
langid = {english}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@article{mester2013Numerical,
|
|
32
|
+
title = {Numerical Self-Consistent Field Theory of Multicomponent Polymer Blends in the {{Gibbs}} Ensemble},
|
|
33
|
+
author = {Mester, Zoltan and A.~Lynd, Nathaniel and H.~Fredrickson, Glenn},
|
|
34
|
+
year = {2013},
|
|
35
|
+
journal = {Soft Matter},
|
|
36
|
+
volume = {9},
|
|
37
|
+
number = {47},
|
|
38
|
+
pages = {11288--11294},
|
|
39
|
+
publisher = {Royal Society of Chemistry},
|
|
40
|
+
doi = {10.1039/C3SM51893K},
|
|
41
|
+
urldate = {2024-03-01},
|
|
42
|
+
langid = {english}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@article{schmid1998Selfconsistentfield,
|
|
46
|
+
title = {Self-Consistent-Field Theories for Complex Fluids},
|
|
47
|
+
author = {Schmid, F.},
|
|
48
|
+
year = {1998},
|
|
49
|
+
month = sep,
|
|
50
|
+
journal = {J. Phys.: Condens. Matter},
|
|
51
|
+
volume = {10},
|
|
52
|
+
number = {37},
|
|
53
|
+
pages = {8105},
|
|
54
|
+
issn = {0953-8984},
|
|
55
|
+
doi = {10.1088/0953-8984/10/37/002},
|
|
56
|
+
urldate = {2024-03-26},
|
|
57
|
+
langid = {english}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@misc{qiang2024Scaling,
|
|
61
|
+
title = {Scaling of Phase Count in Multicomponent Liquids},
|
|
62
|
+
author = {Qiang, Yicheng and Luo, Chengjie and Zwicker, David},
|
|
63
|
+
year = {2024},
|
|
64
|
+
month = may,
|
|
65
|
+
number = {arXiv:2405.01138},
|
|
66
|
+
eprint = {2405.01138},
|
|
67
|
+
primaryclass = {cond-mat, physics:physics},
|
|
68
|
+
publisher = {arXiv},
|
|
69
|
+
urldate = {2024-08-12},
|
|
70
|
+
archiveprefix = {arXiv}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@inproceedings{lam2015Numba,
|
|
74
|
+
title = {Numba: A {{LLVM-based Python JIT}} Compiler},
|
|
75
|
+
shorttitle = {Numba},
|
|
76
|
+
booktitle = {Proceedings of the {{Second Workshop}} on the {{LLVM Compiler Infrastructure}} in {{HPC}}},
|
|
77
|
+
author = {Lam, Siu Kwan and Pitrou, Antoine and Seibert, Stanley},
|
|
78
|
+
year = {2015},
|
|
79
|
+
month = nov,
|
|
80
|
+
pages = {1--6},
|
|
81
|
+
publisher = {ACM},
|
|
82
|
+
address = {Austin Texas},
|
|
83
|
+
doi = {10.1145/2833157.2833162},
|
|
84
|
+
urldate = {2024-08-12},
|
|
85
|
+
isbn = {978-1-4503-4005-2},
|
|
86
|
+
langid = {english}
|
|
87
|
+
}
|