Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clears output for restarted jobs #1549

Merged
merged 8 commits into from
Aug 28, 2024
20 changes: 16 additions & 4 deletions pyiron_atomistics/sphinx/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ def restart(
)
if recreate_guess:
new_job.load_guess_group()

new_job.output.clear() # temporary fix for clearing output for restarted jobs (restarted jobs copy output of parent job)
return new_job

def relocate_hdf5(self, h5_path=None):
Expand Down Expand Up @@ -1888,10 +1890,11 @@ class Output:

def __init__(self, job):
self._job = job
self.generic = DataContainer(table_name="output/generic")
self.charge_density = SphinxVolumetricData()
self.electrostatic_potential = SphinxVolumetricData()
self.generic.create_group("dft")
# --- define internal variables (overwritten in clear()) as None to silence code linters
self.generic = None
skatnagallu marked this conversation as resolved.
Show resolved Hide resolved
self.charge_density = None
self.electrostatic_potential = None
self.clear()
self.old_version = False

def collect_spins_dat(self, file_name="spins.dat", cwd=None):
Expand Down Expand Up @@ -2151,6 +2154,15 @@ def from_hdf(self, hdf):
self.old_version = True
pass

def clear(self):
"""(Re)set to a clean state."""
# This function is part of a temporary fix for restart jobs (see SphinxBase.restart).
# It could also be used when existing jobs should be reparsed (e.g. after code fixes, updates, etc.)
self.generic = DataContainer(table_name="output/generic")
self.charge_density = SphinxVolumetricData()
self.electrostatic_potential = SphinxVolumetricData()
self.generic.create_group("dft")


def _update_datacontainer(job):
job.output.generic.create_group("dft")
Expand Down
Loading