Skip to content

Commit

Permalink
Check atoms is Atoms, clearer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
harveydevereux committed Nov 8, 2024
1 parent 93f75ef commit d1d7e47
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions janus_core/processing/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,14 @@ def __call__(self, atoms: Atoms) -> list[float]:
-------
list[float]
The stress components in GPa units.
Raises
------
ValueError
If atoms is not an Atoms object.
"""
if not isinstance(atoms, Atoms):
raise ValueError("atoms should be an Atoms object")
sliced_atoms = atoms[self.atoms_slice]
# must be re-attached after slicing for get_stress
sliced_atoms.calc = atoms.calc
Expand Down

0 comments on commit d1d7e47

Please sign in to comment.