From 2110301da9ab761d4da597a4d2bf03b93d990a76 Mon Sep 17 00:00:00 2001 From: skatnagallu Date: Wed, 28 Aug 2024 09:27:42 +0200 Subject: [PATCH 1/8] clears output for restarted jobs --- pyiron_atomistics/sphinx/base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index 48ed204a1..3cbccff57 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -836,6 +836,8 @@ def restart( ) if recreate_guess: new_job.load_guess_group() + + new_job.output.clear_output_for_restart() # 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): @@ -2151,6 +2153,14 @@ def from_hdf(self, hdf): self.old_version = True pass + def clear_output_for_restart(self): + """Clears the output for restarted job. Temporary fix.""" + 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") From f7309dfa9baae11f31bcd2b48b392774bf92c0ca Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 07:29:27 +0000 Subject: [PATCH 2/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyiron_atomistics/sphinx/base.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index 3cbccff57..120d08e3e 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -837,7 +837,7 @@ def restart( if recreate_guess: new_job.load_guess_group() - new_job.output.clear_output_for_restart() # temporary fix for clearing output for restarted jobs (restarted jobs copy output of parent job) + new_job.output.clear_output_for_restart() # 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): @@ -2155,11 +2155,10 @@ def from_hdf(self, hdf): def clear_output_for_restart(self): """Clears the output for restarted job. Temporary fix.""" - self.generic = DataContainer (table_name="output/generic") - self.charge_density = SphinxVolumetricData () - self.electrostatic_potential = SphinxVolumetricData () - self.generic.create_group ("dft") - + self.generic = DataContainer(table_name="output/generic") + self.charge_density = SphinxVolumetricData() + self.electrostatic_potential = SphinxVolumetricData() + self.generic.create_group("dft") def _update_datacontainer(job): From 02b28422f0956041cac4cbed6854af9cca02f006 Mon Sep 17 00:00:00 2001 From: skatnagallu Date: Wed, 28 Aug 2024 09:40:09 +0200 Subject: [PATCH 3/8] output init calls the clear_output_for_restart --- pyiron_atomistics/sphinx/base.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index 120d08e3e..76d17864b 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1890,10 +1890,7 @@ 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") + self.clear_output_for_restart() self.old_version = False def collect_spins_dat(self, file_name="spins.dat", cwd=None): From 0c8da16a3fb187e893c5cad5c3b33912e911bfa7 Mon Sep 17 00:00:00 2001 From: Shyam <85609781+skatnagallu@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:07:44 +0200 Subject: [PATCH 4/8] Update pyiron_atomistics/sphinx/base.py Co-authored-by: Jan Janssen --- pyiron_atomistics/sphinx/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index 76d17864b..ed3291c14 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1890,6 +1890,9 @@ class Output: def __init__(self, job): self._job = job + self.generic = None + self.charge_density = None + self.electrostatic_potential = None self.clear_output_for_restart() self.old_version = False From 46186d1979e7d454837652ab7f12d96e065452cf Mon Sep 17 00:00:00 2001 From: Shyam <85609781+skatnagallu@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:49:18 +0200 Subject: [PATCH 5/8] Update pyiron_atomistics/sphinx/base.py Co-authored-by: freyso <63301887+freyso@users.noreply.github.com> --- pyiron_atomistics/sphinx/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index ed3291c14..9edb75c9e 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -2154,7 +2154,9 @@ def from_hdf(self, hdf): pass def clear_output_for_restart(self): - """Clears the output for restarted job. Temporary fix.""" + """(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() From 4f35bdc8e387e7e4edc3e3570f43745e8844d829 Mon Sep 17 00:00:00 2001 From: Shyam <85609781+skatnagallu@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:49:26 +0200 Subject: [PATCH 6/8] Update pyiron_atomistics/sphinx/base.py Co-authored-by: freyso <63301887+freyso@users.noreply.github.com> --- pyiron_atomistics/sphinx/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index 9edb75c9e..fe830530c 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1890,6 +1890,7 @@ class Output: def __init__(self, job): self._job = job + # --- define internal variables (overwritten in clear_output_for_restart) as None to silence code linters self.generic = None self.charge_density = None self.electrostatic_potential = None From ffc1aef42103d51bd1ba3d8ea7c30d68df66d61f Mon Sep 17 00:00:00 2001 From: skatnagallu Date: Wed, 28 Aug 2024 13:52:24 +0200 Subject: [PATCH 7/8] changed the function name to clear --- pyiron_atomistics/sphinx/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index fe830530c..63dd4b08b 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -837,7 +837,7 @@ def restart( if recreate_guess: new_job.load_guess_group() - new_job.output.clear_output_for_restart() # temporary fix for clearing output for restarted jobs (restarted jobs copy output of parent job) + 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): @@ -1894,7 +1894,7 @@ def __init__(self, job): self.generic = None self.charge_density = None self.electrostatic_potential = None - self.clear_output_for_restart() + self.clear() self.old_version = False def collect_spins_dat(self, file_name="spins.dat", cwd=None): @@ -2154,7 +2154,7 @@ def from_hdf(self, hdf): self.old_version = True pass - def clear_output_for_restart(self): + 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.) From 9ee71e77520603a4c3858a4352b69a5c586ba2e2 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Wed, 28 Aug 2024 15:52:57 +0200 Subject: [PATCH 8/8] Update comment to reflect changed method name --- pyiron_atomistics/sphinx/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index 63dd4b08b..768425892 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1890,7 +1890,7 @@ class Output: def __init__(self, job): self._job = job - # --- define internal variables (overwritten in clear_output_for_restart) as None to silence code linters + # --- define internal variables (overwritten in clear()) as None to silence code linters self.generic = None self.charge_density = None self.electrostatic_potential = None