Skip to content

Commit

Permalink
Merge branch 'feat/clean_iteration' of https://github.com/aiidateam/a…
Browse files Browse the repository at this point in the history
  • Loading branch information
bastonero committed Jul 12, 2023
2 parents 63e018d + cf50ce6 commit be0363d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/aiida_quantumespresso_hp/workflows/hubbard.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ def define(cls, spec):
if_(cls.should_check_convergence)(
cls.check_convergence,
),
if_(cls.should_clean_workdir)(
cls.clean_iteration,
)
),
cls.run_results,
)
Expand Down Expand Up @@ -646,14 +649,12 @@ def run_results(self):
self.report(f'Hubbard parameters self-consistently converged in {self.ctx.iteration} iterations')
self.out('hubbard_structure', self.ctx.current_hubbard_structure)

def on_terminated(self):
"""Clean the working directories of all child calculations if `clean_workdir=True` in the inputs."""
super().on_terminated()

if self.inputs.clean_workdir.value is False:
self.report('remote folders will not be cleaned')
return
def should_clean_workdir(self):
"""Whether to clean the work directories at each iteration."""
return self.inputs.clean_workdir.value

def clean_iteration(self):
"""Clean all work directiories of the current iteration."""
cleaned_calcs = []

for called_descendant in self.node.called_descendants:
Expand Down

0 comments on commit be0363d

Please sign in to comment.