Skip to content

Add option to evaluate unit cells symbolically #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
50c21ab
Pass string data directly in to symmetry evaluator
janbridley Mar 19, 2025
61de03e
Update test to check for rhombohedral symbols
janbridley Mar 19, 2025
77c6b93
Properly round before wrapping into box
janbridley Mar 19, 2025
e73c78c
Sympy implementation
janbridley Mar 19, 2025
2e9c183
Single failure
janbridley Mar 19, 2025
5b6095d
Lint parsnip.py
janbridley Mar 19, 2025
48fa9ee
Lint patterns.py
janbridley Mar 19, 2025
4677bc8
Lint test_unitcells.py
janbridley Mar 19, 2025
01b253c
Add sympy import logic
janbridley Mar 19, 2025
3dcb388
Fix optional import in patterns.py
janbridley Mar 19, 2025
5020166
Parameterize n_decimal_places in accuracy test
janbridley Mar 19, 2025
403f284
Remove completed TODO
janbridley Mar 19, 2025
6bd955f
Add comment to accuracy test
janbridley Mar 19, 2025
d89521f
Add docs for new parameter
janbridley Mar 19, 2025
7d6c7aa
Fix doc mistake
janbridley Mar 19, 2025
ecff822
Remove numpy printoption
janbridley Mar 19, 2025
a360fd3
Update docstring
janbridley Mar 19, 2025
1b7d12a
Properly fallback parse_mode if sympy is not installed
janbridley Mar 19, 2025
2ae82d3
Add file from #42 to test suite
janbridley Mar 19, 2025
6b39dad
Swap xfail for return
janbridley Mar 19, 2025
7da251e
Fix error formatting
janbridley Mar 19, 2025
8382a67
Remove debug statement
janbridley Mar 19, 2025
88b0b3c
Include sympy in requirements and ci
janbridley Mar 19, 2025
b98ab6c
Update test requirements files and docs
janbridley Mar 19, 2025
654c5e7
Fix pycifrw pin
janbridley Mar 24, 2025
cbdcaa4
Update changelog.rst
janbridley Mar 24, 2025
2e739e1
Update build_unit_cells to use base implementation by default
janbridley Apr 9, 2025
2dd489e
Move _SYMPY_AVAILABLE to class
janbridley Apr 9, 2025
43af870
Update tests for new api
janbridley Apr 9, 2025
1868376
Bump lockfiles and add missing sympy
janbridley Apr 9, 2025
55df8b1
Remove unused comment
janbridley Apr 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/requirements-3.10.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --python-version=3.10 pyproject.toml tests/requirements.in
# uv --allow-python-downloads pip compile --python-version=3.10 pyproject.toml requirements-sympy.txt tests/requirements.in
ase==3.24.0
# via -r tests/requirements.in
contourpy==1.3.1
Expand All @@ -8,19 +8,21 @@ cycler==0.12.1
# via matplotlib
exceptiongroup==1.2.2
# via pytest
fonttools==4.56.0
fonttools==4.57.0
# via matplotlib
gemmi==0.7.0
gemmi==0.7.1
# via -r tests/requirements.in
iniconfig==2.0.0
iniconfig==2.1.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
mpmath==1.3.0
# via sympy
numpy==2.2.4
# via
# parsnip-cif (pyproject.toml)
# ase
Expand All @@ -39,9 +41,11 @@ pluggy==1.5.0
# via pytest
ply==3.11
# via pycifrw
pycifrw==4.4.6
prettytable==3.16.0
# via pycifrw
pycifrw==5.0.1
# via -r tests/requirements.in
pyparsing==3.2.1
pyparsing==3.2.3
# via matplotlib
pytest==8.3.5
# via
Expand All @@ -55,5 +59,11 @@ scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
sympy==1.13.3
# via
# -r requirements-sympy.txt
# -r tests/requirements.in
tomli==2.2.1
# via pytest
wcwidth==0.2.13
# via prettytable
24 changes: 17 additions & 7 deletions .github/requirements-3.11.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --python-version=3.11 pyproject.toml tests/requirements.in
# uv --allow-python-downloads pip compile --python-version=3.11 pyproject.toml requirements-sympy.txt tests/requirements.in
ase==3.24.0
# via -r tests/requirements.in
contourpy==1.3.1
# via matplotlib
cycler==0.12.1
# via matplotlib
fonttools==4.56.0
fonttools==4.57.0
# via matplotlib
gemmi==0.7.0
gemmi==0.7.1
# via -r tests/requirements.in
iniconfig==2.0.0
iniconfig==2.1.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
mpmath==1.3.0
# via sympy
numpy==2.2.4
# via
# parsnip-cif (pyproject.toml)
# ase
Expand All @@ -37,9 +39,11 @@ pluggy==1.5.0
# via pytest
ply==3.11
# via pycifrw
pycifrw==4.4.6
prettytable==3.16.0
# via pycifrw
pycifrw==5.0.1
# via -r tests/requirements.in
pyparsing==3.2.1
pyparsing==3.2.3
# via matplotlib
pytest==8.3.5
# via
Expand All @@ -53,3 +57,9 @@ scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
sympy==1.13.3
# via
# -r requirements-sympy.txt
# -r tests/requirements.in
wcwidth==0.2.13
# via prettytable
24 changes: 17 additions & 7 deletions .github/requirements-3.12.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --python-version=3.12 pyproject.toml tests/requirements.in
# uv --allow-python-downloads pip compile --python-version=3.12 pyproject.toml requirements-sympy.txt tests/requirements.in
ase==3.24.0
# via -r tests/requirements.in
contourpy==1.3.1
# via matplotlib
cycler==0.12.1
# via matplotlib
fonttools==4.56.0
fonttools==4.57.0
# via matplotlib
gemmi==0.7.0
gemmi==0.7.1
# via -r tests/requirements.in
iniconfig==2.0.0
iniconfig==2.1.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
mpmath==1.3.0
# via sympy
numpy==2.2.4
# via
# parsnip-cif (pyproject.toml)
# ase
Expand All @@ -37,9 +39,11 @@ pluggy==1.5.0
# via pytest
ply==3.11
# via pycifrw
pycifrw==4.4.6
prettytable==3.16.0
# via pycifrw
pycifrw==5.0.1
# via -r tests/requirements.in
pyparsing==3.2.1
pyparsing==3.2.3
# via matplotlib
pytest==8.3.5
# via
Expand All @@ -53,3 +57,9 @@ scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
sympy==1.13.3
# via
# -r requirements-sympy.txt
# -r tests/requirements.in
wcwidth==0.2.13
# via prettytable
24 changes: 17 additions & 7 deletions .github/requirements-3.13.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --python-version=3.13 pyproject.toml tests/requirements.in
# uv --allow-python-downloads pip compile --python-version=3.13 pyproject.toml requirements-sympy.txt tests/requirements.in
ase==3.24.0
# via -r tests/requirements.in
contourpy==1.3.1
# via matplotlib
cycler==0.12.1
# via matplotlib
fonttools==4.56.0
fonttools==4.57.0
# via matplotlib
gemmi==0.7.0
gemmi==0.7.1
# via -r tests/requirements.in
iniconfig==2.0.0
iniconfig==2.1.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
mpmath==1.3.0
# via sympy
numpy==2.2.4
# via
# parsnip-cif (pyproject.toml)
# ase
Expand All @@ -37,9 +39,11 @@ pluggy==1.5.0
# via pytest
ply==3.11
# via pycifrw
pycifrw==4.4.6
prettytable==3.16.0
# via pycifrw
pycifrw==5.0.1
# via -r tests/requirements.in
pyparsing==3.2.1
pyparsing==3.2.3
# via matplotlib
pytest==8.3.5
# via
Expand All @@ -53,3 +57,9 @@ scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
sympy==1.13.3
# via
# -r requirements-sympy.txt
# -r tests/requirements.in
wcwidth==0.2.13
# via prettytable
26 changes: 18 additions & 8 deletions .github/requirements-3.8.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --python-version=3.8 pyproject.toml tests/requirements.in
# uv --allow-python-downloads pip compile --python-version=3.8 pyproject.toml requirements-sympy.txt tests/requirements.in
ase==3.23.0
# via -r tests/requirements.in
contourpy==1.1.1
Expand All @@ -8,23 +8,25 @@ cycler==0.12.1
# via matplotlib
exceptiongroup==1.2.2
# via pytest
fonttools==4.55.3
fonttools==4.57.0
# via matplotlib
gemmi==0.7.0
gemmi==0.7.1
# via -r tests/requirements.in
importlib-resources==6.4.5
# via matplotlib
iniconfig==2.0.0
iniconfig==2.1.0
# via pytest
kiwisolver==1.4.7
# via matplotlib
matplotlib==3.7.5
# via ase
more-itertools==10.5.0
# via parsnip (pyproject.toml)
# via parsnip-cif (pyproject.toml)
mpmath==1.3.0
# via sympy
numpy==1.24.4
# via
# parsnip (pyproject.toml)
# parsnip-cif (pyproject.toml)
# ase
# contourpy
# matplotlib
Expand All @@ -41,11 +43,13 @@ pluggy==1.5.0
# via pytest
ply==3.11
# via pycifrw
pycifrw==4.4.6
prettytable==3.11.0
# via pycifrw
pycifrw==5.0.1
# via -r tests/requirements.in
pyparsing==3.1.4
# via matplotlib
pytest==8.3.4
pytest==8.3.5
# via
# -r tests/requirements.in
# pytest-doctestplus
Expand All @@ -57,7 +61,13 @@ scipy==1.10.1
# via ase
six==1.17.0
# via python-dateutil
sympy==1.13.3
# via
# -r requirements-sympy.txt
# -r tests/requirements.in
tomli==2.2.1
# via pytest
wcwidth==0.2.13
# via prettytable
zipp==3.20.2
# via importlib-resources
22 changes: 16 additions & 6 deletions .github/requirements-3.9.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --python-version=3.9 pyproject.toml tests/requirements.in
# uv --allow-python-downloads pip compile --python-version=3.9 pyproject.toml requirements-sympy.txt tests/requirements.in
ase==3.24.0
# via -r tests/requirements.in
contourpy==1.3.0
Expand All @@ -8,20 +8,22 @@ cycler==0.12.1
# via matplotlib
exceptiongroup==1.2.2
# via pytest
fonttools==4.56.0
fonttools==4.57.0
# via matplotlib
gemmi==0.7.0
gemmi==0.7.1
# via -r tests/requirements.in
importlib-resources==6.5.2
# via matplotlib
iniconfig==2.0.0
iniconfig==2.1.0
# via pytest
kiwisolver==1.4.7
# via matplotlib
matplotlib==3.9.4
# via ase
more-itertools==10.6.0
# via parsnip-cif (pyproject.toml)
mpmath==1.3.0
# via sympy
numpy==2.0.2
# via
# parsnip-cif (pyproject.toml)
Expand All @@ -41,9 +43,11 @@ pluggy==1.5.0
# via pytest
ply==3.11
# via pycifrw
pycifrw==4.4.6
prettytable==3.16.0
# via pycifrw
pycifrw==5.0.1
# via -r tests/requirements.in
pyparsing==3.2.1
pyparsing==3.2.3
# via matplotlib
pytest==8.3.5
# via
Expand All @@ -57,7 +61,13 @@ scipy==1.13.1
# via ase
six==1.17.0
# via python-dateutil
sympy==1.13.3
# via
# -r requirements-sympy.txt
# -r tests/requirements.in
tomli==2.2.1
# via pytest
wcwidth==0.2.13
# via prettytable
zipp==3.21.0
# via importlib-resources
4 changes: 2 additions & 2 deletions .github/workflows/update-uv-lockfiles.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

for version in 3.{9..13}; do
uv pip compile --python-version="$version" pyproject.toml tests/requirements.in > ".github/requirements-$version.txt"
for version in 3.{8..13}; do
uv pip compile --python-version="$version" pyproject.toml requirements-sympy.txt tests/requirements.in > ".github/requirements-$version.txt"
done
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ additional dependencies are required to run the tests and build the docs.
.. code:: bash

pip install . # Install with no additional dependencies
pip install .[tests] # Install with dependencies required to run tests
pip install .[sympy] # Install with sympy for symbolic unit cell math
pip install .[tests] # Install with dependencies required to run tests (including sympy)
pip install .[tests,doc] # Install with dependencies required to run tests and make docs

Dependencies
Expand Down
8 changes: 8 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ v0.X.X - 20XX-XX-XX
Added
~~~~~
- Additional testpath flag to conftest
- Symbolic parsing mode for ``build_unit_cell``

Changed
~~~~~~~
- ``build_unit_cell`` now uses sympy by default if it is intalled - otherwise, it falls
back to the previous variant

Fixed
~~~~~
- Accessing data pairs with ``get_from_pairs`` or ``__getitem__`` now allows for case-insensitive searches
- Quote-delimited strings containing the delimiting character are now parsed properly
- ``build_unit_cell`` now rounds coordinates before wrapping into the box, fixing edge cases
where boundary atoms were not properly deduplicated

v0.2.1 - 2025-03-12
-------------------
Expand Down
Loading
Loading