Skip to content

Commit

Permalink
Base workchain: improve output parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha committed Jan 28, 2025
1 parent 44a77a5 commit a5ddaad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aiida_cp2k/workchains/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Base work chain to run a CP2K calculation."""

import re

from aiida import common, engine, orm, plugins

from .. import utils
Expand Down Expand Up @@ -85,7 +87,7 @@ def restart_incomplete_calculation(self, calc):
content_string = calc.outputs.retrieved.base.repository.get_object_content(calc.base.attributes.get('output_filename'))

# CP2K was updating geometry - continue with that.
restart_geometry_transformation = "Max. gradient =" in content_string or "OPT| Maximum gradient " in content_string or "MD| Step number" in content_string
restart_geometry_transformation = re.search(r"Max. gradient\s+=", content_string) or re.search(r"OPT\| Maximum gradient\s*[-+]?\d*\.?\d+", content_string) or "MD| Step number" in content_string
end_inner_scf_loop = "Total energy: " in content_string
# The message is written in the log file when the CP2K input parameter `LOG_PRINT_KEY` is set to True.
if not (restart_geometry_transformation or end_inner_scf_loop or "Writing RESTART" in content_string):
Expand Down

0 comments on commit a5ddaad

Please sign in to comment.