From d16413a4292bdaa896bbbcb9cadb43f9a825890f Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Mon, 15 Jul 2024 11:41:36 +0200 Subject: [PATCH] Write and return default mlip.ini in potential_files Enables use of MTP potentials with default lammps job. --- pyiron_potentialfit/mlip/mlip.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pyiron_potentialfit/mlip/mlip.py b/pyiron_potentialfit/mlip/mlip.py index 48ed2e84..7e00b0b6 100644 --- a/pyiron_potentialfit/mlip/mlip.py +++ b/pyiron_potentialfit/mlip/mlip.py @@ -88,10 +88,17 @@ def calculation_dataframe(self): @property def potential_files(self): + if not self.status.finished: + return [] pot = os.path.join(self.working_directory, "Trained.mtp_") states = os.path.join(self.working_directory, "state.mvs") - if os.path.exists(pot) and os.path.exists(states): - return [pot, states] + if not (os.path.exists(pot) and os.path.exists(states)): + raise RuntimeError("Potential files not created!") + ini = os.path.join(self.working_directory, "mlip.ini") + if not os.path.exists(ini): + with open(ini, "w") as f: + f.write("mtp-filename Trained.mtp_\nselect FALSE\n") + return [pot, states, ini] def _get_elements(self): """