Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 11, 2024
1 parent 44d152a commit ede525b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions aiida_cp2k/utils/input_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ def add_wfn_restart_section(input_dict, is_kpoints):


@calcfunction
def add_ext_restart_section(input_dict,first_snapshot=None):
def add_ext_restart_section(input_dict, first_snapshot=None):
"""Add external restart section to the input dictionary."""
params = input_dict.get_dict()
if first_snapshot is not None:
params["MOTION"]["MD"]["REFTRAJ"]["FIRST_SNAPSHOT"] = first_snapshot
params["MOTION"]["MD"]["REFTRAJ"]["FIRST_SNAPSHOT"] = first_snapshot
# overwrite the complete EXT_RESTART section if present
params["EXT_RESTART"] = {"RESTART_FILE_NAME": "./parent_calc/aiida-1.restart"}
if params["GLOBAL"]["RUN_TYPE"] == "MD":
Expand All @@ -221,5 +221,5 @@ def add_ext_restart_section(input_dict,first_snapshot=None):
params["EXT_RESTART"]["RESTART_VEL"] = ".TRUE."
params["EXT_RESTART"]["RESTART_CELL"] = ".TRUE."
params["EXT_RESTART"]["RESTART_THERMOSTAT"] = ".TRUE."
params["EXT_RESTART"]["RESTART_CONSTRAINT"] = ".FALSE."
params["EXT_RESTART"]["RESTART_CONSTRAINT"] = ".FALSE."
return Dict(params)
2 changes: 1 addition & 1 deletion aiida_cp2k/workchains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def restart_incomplete_calculation(self, calc):
try:
first_snapshot = int(params['MOTION']['MD']['REFTRAJ']['FIRST_SNAPSHOT']) + calc.outputs.output_trajectory.get_shape('positions')[0]
except KeyError:
pass
pass
params = add_ext_restart_section(params,first_snapshot=first_snapshot)

self.ctx.inputs.parameters = params # params (new or old ones) that include the necessary restart information.
Expand Down

0 comments on commit ede525b

Please sign in to comment.