Skip to content

Commit

Permalink
Format black
Browse files Browse the repository at this point in the history
  • Loading branch information
pyiron-runner authored and pmrv committed Jun 9, 2024
1 parent 5f5402b commit 8ac546d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pyiron_atomistics/atomistics/job/atomistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ def load_default(self):
"""
self.load_string(file_content)


def _suppress_notfound(meth):
@wraps(meth)
def f(*args, **kwargs):
Expand All @@ -1014,8 +1015,10 @@ def f(*args, **kwargs):
except ValueError:
logger.warning(f"Could not access {meth.__name__}, returning None!")
return None

return f


class GenericOutput(object):
def __init__(self, job):
self._job = job
Expand Down Expand Up @@ -1076,7 +1079,9 @@ def computation_time(self):
@property
def unwrapped_positions(self):
try:
unwrapped_positions = self._job.project_hdf5["output/generic/unwrapped_positions"]
unwrapped_positions = self._job.project_hdf5[
"output/generic/unwrapped_positions"
]
return unwrapped_positions
except ValueError:
return self._job.structure.positions + self.total_displacements
Expand All @@ -1102,13 +1107,17 @@ def displacements(self):
two snapshots (due to periodic boundary conditions)
"""
try:
unwrapped_positions = self._job.project_hdf5["output/generic/unwrapped_positions"]
unwrapped_positions = self._job.project_hdf5[
"output/generic/unwrapped_positions"
]
return np.diff(
np.append([self._job.structure.positions], unwrapped_positions, axis=0),
axis=0,
)
except ValueError:
return self.get_displacements(self._job.structure, self.positions, self.cells)
return self.get_displacements(
self._job.structure, self.positions, self.cells
)

@staticmethod
def get_displacements(structure, positions, cells):
Expand Down Expand Up @@ -1154,7 +1163,9 @@ def total_displacements(self):
two snapshots (due to periodic boundary conditions)
"""
try:
unwrapped_positions = self._job.project_hdf5["output/generic/unwrapped_positions"]
unwrapped_positions = self._job.project_hdf5[
"output/generic/unwrapped_positions"
]
return unwrapped_positions - self._job.structure.positions
except ValueError:
return np.cumsum(self.displacements, axis=0)
Expand Down

0 comments on commit 8ac546d

Please sign in to comment.