Skip to content

Commit ae833cb

Browse files
authored
Merge pull request #160 from sandialabs/dev
dev
2 parents e371777 + 972e18e commit ae833cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+8710
-1327
lines changed

.github/workflows/julia.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ env:
88
CARGO_TERM_COLOR: always
99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [macos-latest, ubuntu-latest]
15+
runs-on: ${{ matrix.os }}
1216
steps:
1317
- name: checkout
1418
uses: actions/checkout@v3
@@ -21,15 +25,12 @@ jobs:
2125
uses: julia-actions/setup-julia@v1
2226
with:
2327
version: 1.8
24-
- name: add
25-
if: github.event_name != 'pull_request'
26-
run: julia -e 'using Pkg; Pkg.add(url="https://github.com/sandialabs/Polymers", rev="'${GITHUB_REF##*/}'")'
27-
- name: add
28-
if: github.event_name == 'pull_request'
29-
run: julia -e 'using Pkg; Pkg.add(url="https://github.com/sandialabs/Polymers", rev="'${GITHUB_HEAD_REF##*/}'")'
30-
- name: build
31-
run: julia -e 'using Pkg; Pkg.build("Polymers")'
3228
- name: test
33-
run: julia -e 'using Pkg; Pkg.test("Polymers")'
29+
if: runner.os == 'Windows'
30+
run: julia -e 'using Pkg; Pkg.add(path=\".\"); Pkg.test(\"Polymers\")'
31+
- name: test
32+
if: runner.os != 'Windows'
33+
run: julia -e 'using Pkg; Pkg.add(path="."); Pkg.test("Polymers")'
3434
- name: format
35-
run: julia -e 'using Pkg; Pkg.add("JuliaFormatter"); using JuliaFormatter; if format("./") == true; exit(0); else exit(1); end'
35+
if: runner.os == 'Linux'
36+
run: julia -e 'using Pkg; Pkg.add("JuliaFormatter"); using JuliaFormatter; if format("./") == true; exit(0); else exit(1); end'

.github/workflows/python.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
osx-wheels:
2424
runs-on: macos-latest
2525
strategy:
26+
fail-fast: false
2627
matrix:
2728
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
2829
steps:
@@ -75,15 +76,23 @@ jobs:
7576
run: twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} wheelhouse/*.whl
7677
test:
7778
if: github.event_name != 'release'
78-
runs-on: ubuntu-latest
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
os: [macos-latest, windows-latest, ubuntu-latest]
83+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
84+
runs-on: ${{ matrix.os }}
7985
steps:
8086
- name: checkout
8187
uses: actions/checkout@v3
88+
- uses: actions/setup-python@v4
89+
with:
90+
python-version: ${{ matrix.python-version }}
8291
- name: maturin
8392
run: |
8493
pip install maturin
85-
maturin build --features python
86-
pip install target/wheels/*.whl
94+
maturin build --features python --out .
95+
pip install --find-links=. polymers
8796
- name: pytest
8897
run: |
8998
pip install pytest
@@ -95,4 +104,4 @@ jobs:
95104
- name: pylint
96105
run: |
97106
pip install pylint
98-
pylint --verbose src/
107+
pylint --verbose src

.github/workflows/rust.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ env:
99
jobs:
1010
test:
1111
if: github.event_name != 'release'
12-
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [macos-latest, ubuntu-latest]
16+
runs-on: ${{ matrix.os }}
1317
steps:
1418
- name: checkout
1519
uses: actions/checkout@v3
@@ -63,4 +67,4 @@ jobs:
6367
- name: login
6468
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
6569
- name: publish
66-
run: cargo publish --verbose
70+
run: cargo publish --verbose

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
**.vscode/
99
**Cargo.lock
1010
**target/
11-
**.log
11+
**.log
12+
**.whl

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polymers"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
description = "Polymers Modeling Library"
66
license = "BSD-3-Clause"

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Polymers"
22
uuid = "8aef037c-a721-4e8a-9d81-eb7093daef2c"
33
authors = ["mrbuche <[email protected]>"]
4-
version = "0.1.0"
4+
version = "0.1.1"
55

66
[deps]
77
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pip install target/wheels/*.whl
3232

3333
[![docs (stable)](https://raw.githubusercontent.com/sandialabs/Polymers/main/pages/assets/images/julia-docs-stable.svg)](https://sandialabs.github.io/Polymers/julia/docs/stable)
3434
[![docs (latest)](https://raw.githubusercontent.com/sandialabs/Polymers/main/pages/assets/images/julia-docs-latest.svg)](https://sandialabs.github.io/Polymers/julia/docs/latest)
35+
[![Pkg](https://img.shields.io/github/v/release/sandialabs/Polymers?color=cb3c33&label=Pkg&logo=Julia&logoColor=cb3c33)](https://juliapackages.com/p/polymers)
3536

3637
The library can be installed as a Julia package:
3738

conftest.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def pytest_collection_finish(session):
1919
)
2020
f.close()
2121
run(
22-
['/bin/sed', '-i', 's@: test@@', '__pycache__/cargo.tests']
22+
['sed', '-i', 's@: test@@', '__pycache__/cargo.tests']
2323
)
2424
f = open("__pycache__/julia.tests", "w")
2525
run(
@@ -28,10 +28,10 @@ def pytest_collection_finish(session):
2828
)
2929
f.close()
3030
run(
31-
['/bin/sed', '-i', 's@^.*testset "@@', '__pycache__/julia.tests']
31+
['sed', '-i', 's@^.*testset "@@', '__pycache__/julia.tests']
3232
)
3333
run(
34-
['/bin/sed', '-i', 's@".*$@@', '__pycache__/julia.tests']
34+
['sed', '-i', 's@".*$@@', '__pycache__/julia.tests']
3535
)
3636
stdout = open('__pycache__/pytest.tests', 'w')
3737
if session.config.option.compare is not None:
@@ -46,35 +46,35 @@ def pytest_collection_finish(session):
4646
)
4747
stdout.close()
4848
run(
49-
['/bin/sed', '-i', '[email protected]::@::@', '__pycache__/pytest.tests']
49+
['sed', '-i', '[email protected]::@::@', '__pycache__/pytest.tests']
5050
)
5151
run(
52-
['/bin/sed', '-i', 's@test_@@', '__pycache__/pytest.tests']
52+
['sed', '-i', 's@test_@@', '__pycache__/pytest.tests']
5353
)
5454
run(
55-
['/bin/sed', '-i', 's@^.*src/@@', '__pycache__/pytest.tests']
55+
['sed', '-i', 's@^.*src/@@', '__pycache__/pytest.tests']
5656
)
5757
run(
58-
['/bin/sed', '-i', 's@/@::@g', '__pycache__/pytest.tests']
58+
['sed', '-i', 's@/@::@g', '__pycache__/pytest.tests']
5959
)
6060
run(
61-
['/bin/sort', '__pycache__/cargo.tests',
61+
['sort', '__pycache__/cargo.tests',
6262
'-o', '__pycache__/cargo.tests']
6363
)
6464
run(
65-
['/bin/sort', '__pycache__/pytest.tests',
65+
['sort', '__pycache__/pytest.tests',
6666
'-o', '__pycache__/pytest.tests']
6767
)
6868
run(
69-
['/bin/sort', '__pycache__/julia.tests',
69+
['sort', '__pycache__/julia.tests',
7070
'-o', '__pycache__/julia.tests']
7171
)
7272
code = run(
73-
['/bin/cmp', '-s', '__pycache__/cargo.tests',
73+
['cmp', '-s', '__pycache__/cargo.tests',
7474
'__pycache__/pytest.tests']
7575
).returncode
7676
code += run(
77-
['/bin/cmp', '-s', '__pycache__/cargo.tests',
77+
['cmp', '-s', '__pycache__/cargo.tests',
7878
'__pycache__/julia.tests']
7979
).returncode
8080
if code == 0:

deps/build.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
cd("../")
1+
cd("..")
22
run(`cargo build --features extern`)

docs/source/physics/single_chain/fjc/thermodynamics/modified_canonical/example_asymptotic.ipynb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@
4141
"For sufficiently strong potentials, the modified canonical ensemble can be accurately approximated using the reference system (the isometric ensemble) and an asymptotic correction. For example, the nondimensional force $\\eta$ as a function of the nondimensional potential distance $\\gamma$ is approximated as\n",
4242
"\n",
4343
"$$\n",
44-
" \\eta(\\gamma) \\sim \\eta_0(\\gamma) - \\frac{1}{\\varpi}\\left[\\eta_0(\\gamma)\\,\\frac{\\partial\\eta_0(\\gamma)}{\\partial\\gamma} - \\frac{1}{2N_b}\\frac{\\partial^2\\eta_0(\\gamma)}{\\partial\\gamma^2}\\right]\\quad\\text{for }\\varpi\\gg 1,\n",
44+
" \\eta(\\gamma) \\sim \\eta_0(\\gamma) - \\frac{1}{N_b\\varpi}\\left[\\eta_0(\\gamma)\\,\\frac{\\partial\\eta_0(\\gamma)}{\\partial\\gamma} - \\frac{1}{2N_b}\\frac{\\partial^2\\eta_0(\\gamma)}{\\partial\\gamma^2}\\right]\\quad\\text{for }\\varpi\\gg 1,\n",
4545
"$$\n",
4646
"\n",
47-
"where $\\varpi\\equiv\\beta W\\ell_b^2$ is the reduced nondimensional potential stiffness, $N_b$ is the number of links, and the nondimensional force $\\eta_0$ for the freely-jointed chain model in the isometric ensemble as a function of the nondimensional end-to-end length per link $\\gamma'$ is given by\n",
47+
"where $\\varpi\\equiv\\beta W\\ell_b^2$ is the reduced nondimensional potential stiffness, $N_b$ is the number of links, and the nondimensional force $\\eta_0$ for the freely-jointed chain model in the isometric ensemble as a function of the nondimensional end-to-end length per link $\\gamma$ is given by\n",
4848
"\n",
4949
"$$\n",
50-
" \\eta_0(\\gamma') = \\frac{1}{N_b\\gamma'} + \\left(\\frac{1}{2} - \\frac{1}{N_b}\\right)\\frac{\\sum_{s=0}^{s_\\mathrm{max}}(-1)^s\\binom{N_b}{s}\\left(\\frac{1-\\gamma'}{2} - \\frac{s}{N_b}\\right)^{N_b - 3}}{\\sum_{s=0}^{s_\\mathrm{max}}(-1)^s\\binom{N_b}{s}\\left(\\frac{1-\\gamma'}{2} - \\frac{s}{N_b}\\right)^{N_b - 2}},\n",
50+
" \\eta_0(\\gamma) = \\frac{1}{N_b\\gamma} + \\left(\\frac{1}{2} - \\frac{1}{N_b}\\right)\\frac{\\sum_{s=0}^{s_\\mathrm{max}}(-1)^s\\binom{N_b}{s}\\left(\\frac{1-\\gamma}{2} - \\frac{s}{N_b}\\right)^{N_b - 3}}{\\sum_{s=0}^{s_\\mathrm{max}}(-1)^s\\binom{N_b}{s}\\left(\\frac{1-\\gamma}{2} - \\frac{s}{N_b}\\right)^{N_b - 2}},\n",
5151
"$$\n",
5252
"\n",
53-
"where $s_\\mathrm{max}\\leq N_b m\\leq s_\\mathrm{max}+1$. In contrast, the exact relation for $\\eta(\\gamma)$ is obtained by numerically evaluating\n",
53+
"where $s_\\mathrm{max}\\leq (1-\\gamma/2)N_b \\leq s_\\mathrm{max}+1$. In contrast, the exact relation for $\\eta(\\gamma)$ is obtained by numerically evaluating\n",
5454
"\n",
5555
"$$\n",
56-
" \\eta(\\gamma) = -\\frac{1}{N_b}\\frac{\\partial}{\\partial\\gamma}\\,\\ln\\left[\\iiint Q_0(\\boldsymbol{\\gamma}') e^{-\\tfrac{\\varpi}{2} N_b^2\\left(\\boldsymbol{\\gamma} - \\boldsymbol{\\gamma}'\\right)^2} d^3\\boldsymbol{\\gamma}'\\right],\n",
56+
" \\eta(\\gamma) = -\\frac{1}{N_b}\\frac{\\partial}{\\partial\\gamma}\\,\\ln\\left[\\iiint Q_0(\\boldsymbol{\\gamma}') \\, e^{-\\tfrac{\\varpi}{2} N_b^2\\left(\\boldsymbol{\\gamma} - \\boldsymbol{\\gamma}'\\right)^2} d^3\\boldsymbol{\\gamma}'\\right],\n",
5757
"$$\n",
5858
"\n",
5959
"where $Q_0$ is the partition function in the isometric ensemble. This exact relation is plotted below along with the asymptotic relation while varying $\\varpi$, the nondimensional potential stiffness. As $\\varpi$ increases, the asymptotic approach appears to do increasingly well, but always eventually fails as $\\gamma$ becomes large. This is because the asymptotic approach in this case is completely invalid for larger values of $\\gamma$ (approaching 1), where the massive associated entropic force would cause the end of the chain to leave the bottom of the potential well, even though it may be quite strong. It is therefore apparent that $\\varpi\\gg\\eta$ in addition to $\\varpi\\gg 1$ is a requirement for the asymptotic relation to succeed in accurately approximating the full system."
@@ -98,13 +98,13 @@
9898
"For sufficiently distant potentials, the modified canonical ensemble can be accurately approximated using the reference system (the isotensional ensemble) and an asymptotic correction. The potential is considered sufficiently distant when the length of center of the potential well to the end of the chain experiencing it is much larger than the expected end-to-end length of the chain. This disparity in length is only typically possible considering weak potentials. For example, if $\\eta/N_b\\varpi$ is the nondimensional potential distance, the nondimensional end-to-end length per link $\\gamma$ as a function of the effective nondimensional potential force $\\eta$ is approximated as\n",
9999
"\n",
100100
"$$\n",
101-
" \\gamma(\\eta) \\sim \\gamma_0(\\eta)\\left[1 - N_b\\varpi\\,\\frac{\\partial\\gamma_0}{\\partial\\eta}\\right]\\quad\\text{for }\\varpi\\ll 1,\n",
101+
" \\gamma(\\eta) \\sim \\gamma_0(\\eta)\\left[1 - N_b\\varpi\\,\\frac{\\partial\\gamma_0(\\eta)}{\\partial\\eta}\\right]\\quad\\text{for }\\varpi\\ll 1,\n",
102102
"$$\n",
103103
"\n",
104104
"where $\\gamma_0(\\eta)=\\mathcal{L}(\\eta)$ for the freely-jointed chain model in the isotensional ensemble, and where $\\mathcal{L}(x)=\\coth(x)-1/x$ is of course the Langevin function. In contrast, the exact relation for $\\gamma(\\eta)$ is obtained by numerically evaluating\n",
105105
"\n",
106106
"$$\n",
107-
" \\gamma(\\eta) = \\frac{1}{N_b}\\frac{\\partial}{\\partial\\eta}\\,\\ln\\left[\\iiint Q_0(\\boldsymbol{\\gamma}') e^{N_b\\boldsymbol{\\eta}\\cdot\\boldsymbol{\\gamma}'} d^3\\boldsymbol{\\gamma}'\\right].\n",
107+
" \\gamma(\\eta) = \\frac{1}{N_b}\\frac{\\partial}{\\partial\\eta}\\,\\ln\\left[\\iiint Q_0(\\boldsymbol{\\gamma}') \\, e^{N_b\\boldsymbol{\\eta}\\cdot\\boldsymbol{\\gamma}'} e^{-\\tfrac{\\varpi}{2} N_b^2\\left(\\boldsymbol{\\gamma}'\\right)^2} d^3\\boldsymbol{\\gamma}'\\right].\n",
108108
"$$\n"
109109
]
110110
},
@@ -113,7 +113,7 @@
113113
"id": "8a77ab06",
114114
"metadata": {},
115115
"source": [
116-
"This exact relation is plotted below along with the asymptotic relation while varying $\\varpi$, the nondimensional potential stiffness. As $\\varpi$ decreases and/or the nondimensional force $\\eta$ increases (the nondimensional potential distance $\\eta/N_b\\varpi$ increases), the asymptotic approach appears to do increasingly well. Notably, the asymptoic approach appears to succeed for sufficiently distance potentials for any value of $\\varpi$. This is because the freely-jointed chain model has inextensible links, so even a stiff potential that is distant ($\\eta/N_b\\varpi\\gg 1$) will not stretch the chain past $\\gamma=1$. For chain models which have extensible links, the link stiffness will compete with the potential stiffness, such that the potential would need to be weak ($\\varpi\\gg 1$) in addition to distant ($\\eta/N_b\\varpi\\gg 1$) in order for the asymptotic approach to become accurate."
116+
"This exact relation is plotted below along with the asymptotic relation while varying $\\varpi$, the nondimensional potential stiffness. As $\\varpi$ decreases and/or the nondimensional force $\\eta$ increases (the nondimensional potential distance $\\eta/N_b\\varpi$ increases), the asymptotic approach appears to do increasingly well. Notably, the asymptoic approach appears to succeed for sufficiently distance potentials for any value of $\\varpi$. This is because the freely-jointed chain model has inextensible links, so even a stiff potential that is distant ($\\eta/N_b\\varpi\\gg 1$) will not stretch the chain past $\\gamma=1$. For chain models which have extensible links, the link stiffness will compete with the potential stiffness, such that the potential would need to be weak ($\\varpi\\ll 1$) in addition to distant ($\\eta/N_b\\varpi\\gg 1$) in order for the asymptotic approach to become accurate."
117117
]
118118
},
119119
{
@@ -126,7 +126,6 @@
126126
"gamma_in = np.linspace(5e-1, 5, 256)\n",
127127
"for varpi in [1e0, 1e-1, 1e-2]:\n",
128128
" w = varpi*fjc.number_of_links**2\n",
129-
" eta = gamma_in*w/fjc.number_of_links\n",
130129
" gamma = fjc.nondimensional_end_to_end_length_per_link(gamma_in, w)\n",
131130
" line = plt.plot(gamma, gamma_in, label=r'$\\varpi=$' + str(varpi))\n",
132131
" gamma_asymptotic = \\\n",
@@ -136,7 +135,7 @@
136135
"plt.xlim([0, 1])\n",
137136
"plt.ylim([0.5, 5])\n",
138137
"plt.xlabel(r'$\\gamma$')\n",
139-
"plt.ylabel(r'$\\eta/N_b\\varphi$')\n",
138+
"plt.ylabel(r'$\\eta/N_b\\varpi$')\n",
140139
"plt.show()"
141140
]
142141
}
@@ -157,7 +156,7 @@
157156
"name": "python",
158157
"nbconvert_exporter": "python",
159158
"pygments_lexer": "ipython3",
160-
"version": "3.10.4"
159+
"version": "3.11.0"
161160
}
162161
},
163162
"nbformat": 4,

0 commit comments

Comments
 (0)