From 898290bfcda11ba12c885685d912c8e55ef46cb2 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Wed, 18 Mar 2026 18:21:58 -0400 Subject: [PATCH 1/2] Save temperature/pressure sweep data as npz too Between compression and binary rep, this seems to save ~50% storage. --- calphy/integrators.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/calphy/integrators.py b/calphy/integrators.py index 5649c85..3c95c7e 100644 --- a/calphy/integrators.py +++ b/calphy/integrators.py @@ -226,7 +226,7 @@ def integrate_rs( Notes ----- - Writes the output in a file reversible_scaling.dat + Writes the output in a file temperature_sweep.dat and temperature_sweep.npz """ ws = [] @@ -269,6 +269,8 @@ def integrate_rs( if not return_values: outfile = os.path.join(simfolder, "temperature_sweep.dat") np.savetxt(outfile, np.column_stack((temp, f, werr))) + outfile = os.path.join(simfolder, "temperature_sweep.npz") + np.savez_compressed(outfile, (temp, f, werr)) return None, e_diss else: return (temp, f, werr), e_diss @@ -293,7 +295,7 @@ def integrate_ps(simfolder, f0, natoms, pi, pf, nsims=1, return_values=False): Notes ----- - Writes the output in a file pressure_sweep.dat + Writes the output in a file pressure_sweep.dat and pressure_sweep.npz """ @@ -329,6 +331,8 @@ def integrate_ps(simfolder, f0, natoms, pi, pf, nsims=1, return_values=False): if not return_values: outfile = os.path.join(simfolder, "pressure_sweep.dat") np.savetxt(outfile, np.column_stack((press, f, werr))) + outfile = os.path.join(simfolder, "pressure_sweep.npz") + np.savez_compressed(outfile, (press, f, werr)) else: return (press, f, werr) From 3eefa613bae2b0804c6e3c1c83c9515b7167db00 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Wed, 18 Mar 2026 18:22:31 -0400 Subject: [PATCH 2/2] WIP: Write temperature sweep data as its own report --- calphy/phase.py | 11 +++++++++++ calphy/routines.py | 1 + 2 files changed, 12 insertions(+) diff --git a/calphy/phase.py b/calphy/phase.py index 6c434d1..8e2e6ea 100644 --- a/calphy/phase.py +++ b/calphy/phase.py @@ -917,6 +917,17 @@ def submit_report(self, extra_dict=None): self.publications.append("10.1016/j.commatsci.2018.12.029") self.publications.append("10.1063/1.4967775") + def submit_ts_report(self): + datafile = os.path.join(self.simfolder, "temperature_sweep.npz") + T, f, ferr = np.load(datafile).values() + report = {} + report["results"] = {} + report["temperature"] = T + report["free_energy"] = f + reportfile = os.path.join(self.simfolder, "report_ts.yaml") + with open(reportfile, "w") as f: + yaml.dump(report, f) + def reversible_scaling(self, iteration=1): """ Perform reversible scaling calculation in NPT diff --git a/calphy/routines.py b/calphy/routines.py index 8d1de7d..803c8d6 100644 --- a/calphy/routines.py +++ b/calphy/routines.py @@ -392,6 +392,7 @@ def routine_ts(job): job.logger.info("TS integration cycle %d finished in %f s" % (i + 1, te)) job.integrate_reversible_scaling(scale_energy=True) + job.submit_ts_report() job.clean_up() return job