Skip to content
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

Composition support formula strings with curly brackets #4283

Merged

Conversation

janosh
Copy link
Member

@janosh janosh commented Feb 6, 2025

This PR extends the existing bracket normalization for square brackets [...] to curly brackets {...}. Important e.g. for a few of the 8k+ metallic glass compositions reported in Ward et al. (2018) https://doi.org/10.1016/j.actamat.2018.08.002. previously, some of those formulas raised

ValueError: Invalid formula: {[(Fe0.6Co0.4)0.75B0.2Si0.05]0.96Nb0.04}100

i added 5 unit tests to ensure they now parse correctly

this PR extends the existing bracket normalization for square brackets to curly brackets
important e.g. for bulk metallic glass compositions
@mkhorton mkhorton enabled auto-merge (squash) February 10, 2025 03:46
@mkhorton
Copy link
Member

Thanks @janosh! Enabled auto-merge on this, looks like there's an unrelated linting error

src/pymatgen/io/vasp/outputs.py:4724: error: Unsupported operand types for < ("int" and "None")  [operator]
src/pymatgen/io/vasp/outputs.py:4724: note: Right operand is of type "int | None"
Found 1 error in 1 file (checked 295 source files)
auto-merge was automatically disabled February 10, 2025 10:46

Head branch was pushed to by a user without write access

@janosh
Copy link
Member Author

janosh commented Feb 10, 2025

@mkhorton i fixed the lint error. now there's another unrelated issue:

from coverage.sqldata import CoverageData as CoverageData  # pylint: disable=useless-import-alias
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/micromamba/envs/pmg/lib/python3.11/site-packages/coverage/sqldata.py", line 16, in <module>
    import sqlite3
  File "/Users/runner/micromamba/envs/pmg/lib/python3.11/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/Users/runner/micromamba/envs/pmg/lib/python3.11/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: dlopen(/Users/runner/micromamba/envs/pmg/lib/python3.11/lib-dynload/_sqlite3.cpython-311-darwin.so, 0x0002): Symbol not found: _sqlite3_enable_load_extension
  Referenced from: <52946D93-13ED-30[78](https://github.com/materialsproject/pymatgen/actions/runs/13239058137/job/36950164427#step:8:79)-8584-03D10CF0E4D2> /Users/runner/micromamba/envs/pmg/lib/python3.11/lib-dynload/_sqlite3.cpython-311-darwin.so
  Expected in:     <7A829707-57EA-3128-A489-DFB2872CC69A> /usr/lib/libsqlite3.dylib

@mkhorton mkhorton merged commit 75afbb1 into materialsproject:master Feb 13, 2025
33 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants