Skip to content

Commit

Permalink
Always set restart arguments explicitly.
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha committed Mar 6, 2024
1 parent aa05103 commit 8f93820
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
19 changes: 10 additions & 9 deletions aiida_cp2k/utils/input_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,14 @@ def add_ext_restart_section(input_dict, first_snapshot=None):
if first_snapshot is not None:
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":
params["EXT_RESTART"]["RESTART_DEFAULT"] = ".TRUE."
params["EXT_RESTART"]["RESTART_COUNTERS"] = ".TRUE."
params["EXT_RESTART"]["RESTART_POS"] = ".TRUE."
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_FILE_NAME": "./parent_calc/aiida-1.restart",
"RESTART_DEFAULT": ".TRUE.",
"RESTART_COUNTERS": ".TRUE.",
"RESTART_POS": ".TRUE.",
"RESTART_VEL": ".TRUE.",
"RESTART_CELL": ".TRUE.",
"RESTART_THERMOSTAT": ".TRUE.",
"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 @@ -95,7 +95,7 @@ def restart_incomplete_calculation(self, calc):
first_snapshot = int(params['MOTION']['MD']['REFTRAJ']['FIRST_SNAPSHOT']) + calc.outputs.output_trajectory.get_shape('positions')[0]
except KeyError:
pass
params = add_ext_restart_section(params,first_snapshot=first_snapshot)
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.
self.report(
Expand Down
1 change: 0 additions & 1 deletion examples/workchains/example_base_md_reftraj_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from aiida.engine import run
from aiida.orm import Dict, SinglefileData, load_code
from aiida.plugins import DataFactory, WorkflowFactory
from ase import Atoms

Cp2kBaseWorkChain = WorkflowFactory("cp2k.base")
StructureData = DataFactory("core.structure")
Expand Down

0 comments on commit 8f93820

Please sign in to comment.