Skip to content

Commit

Permalink
Add logic to parse trajectory only if last_structure is parsed.
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha committed Feb 7, 2024
1 parent afd8e5d commit 7dd201a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions aiida_cp2k/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,21 @@ def parse(self, **kwargs):
exit_code = self._parse_stdout()

# Even though the simpulation might have failed, we still want to parse the output structure.
last_structure = None
try:
last_structure = self._parse_final_structure()
if isinstance(last_structure, StructureData):
self.out("output_structure", last_structure)
except common.NotExistent:
last_structure = None
self.logger.warning("No Restart file found in the retrieved folder.")
self.logger.warning("No restart file found in the retrieved folder.")

trajectory = None
try:
trajectory = self._parse_trajectory(last_structure)
if isinstance(trajectory, orm.TrajectoryData):
self.out("output_trajectory", trajectory)
if last_structure is not None:
trajectory = self._parse_trajectory(last_structure)
if isinstance(trajectory, orm.TrajectoryData):
self.out("output_trajectory", trajectory)
except common.NotExistent:
trajectory = None
self.logger.warning("No trajectory file found in the retrieved folder.")

if exit_code is not None:
Expand Down

0 comments on commit 7dd201a

Please sign in to comment.