Skip to content

Commit

Permalink
Use a stricter chemical formula regexp
Browse files Browse the repository at this point in the history
- Formulas are unlikely to be empty strings.
- Integer proportions cannot be equal to 1.
  • Loading branch information
merkys authored and ml-evs committed Oct 26, 2021
1 parent 8d94df0 commit ec7ee84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion optimade/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def anonymous_element_generator():
ANONYMOUS_ELEMENTS = tuple(itertools.islice(anonymous_element_generator(), 150))
""" Returns the first 150 values of the anonymous element generator. """

CHEMICAL_FORMULA_REGEXP = r"^([A-Z][a-z]?\d*)*$"
CHEMICAL_FORMULA_REGEXP = r"^([A-Z][a-z]?([02-9]|[1-9]\d+)?)+$"

EXTRA_SYMBOLS = ["X", "vacancy"]

Expand Down

0 comments on commit ec7ee84

Please sign in to comment.