Skip to content

Commit

Permalink
Rename builtins, multi-line error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
harveydevereux committed Nov 4, 2024
1 parent 24ffd26 commit 3b9cea0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions janus_core/processing/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ def _set_components(self, components: list[str]):
ValueError
If any component is invalid.
"""
for component in self.allowed_components.keys() - components.keys():
if component not in self.allowed_components:
raise ValueError(
f"'{component}' invalid, must be '{', '.join(component_names)}'"
)
if any(components - self.allowed_components.keys()):
raise ValueError(
f"'{components-self.allowed_components.keys()}'"
" invalid, must be '{', '.join(self._components)}'"
)

self.components = components


Expand Down Expand Up @@ -228,8 +229,8 @@ def __call__(self, atoms: Atoms) -> list[float]:
)[self._indices]


StressDiagonal = Stress(components=["xx", "yy", "zz"])
ShearStress = Stress(components=["xy", "yz", "zx"])
StressHydrostatic = Stress(components=["xx", "yy", "zz"])
StressShear = Stress(components=["xy", "yz", "zx"])


# pylint: disable=too-few-public-methods
Expand Down

0 comments on commit 3b9cea0

Please sign in to comment.