From 598fa7b710f54cdc8fcc97d793040043344dfaea Mon Sep 17 00:00:00 2001 From: bastonero Date: Wed, 27 Mar 2024 15:43:09 +0000 Subject: [PATCH 1/5] LammpsPotential: adapt for using Nequip potentials The current implementation cannot exploit other potentials, such as neural network potentials, in this case, coming from Nequip architecture. The implementation now is extended to be able to use this ML family of potentials. --- aiida_lammps/calculations/base.py | 11 ++++++++--- aiida_lammps/data/lammps_potentials.json | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/aiida_lammps/calculations/base.py b/aiida_lammps/calculations/base.py index e146bb41..21795d8e 100644 --- a/aiida_lammps/calculations/base.py +++ b/aiida_lammps/calculations/base.py @@ -41,7 +41,7 @@ class LammpsBaseCalculation(CalcJob): "parser_name": "lammps.base", } - _POTENTIAL_FILENAME = "potential.dat" + _POTENTIAL_FILENAME = "potential.pth" # In restarts, will not copy but use symlinks _default_symlink_usage = True @@ -365,8 +365,12 @@ def prepare_for_submission(self, folder): handle.write(structure_filecontent) # Write the potential to the remote folder - with folder.open(self._POTENTIAL_FILENAME, "w") as handle: - handle.write(self.inputs.potential.get_content()) + # with folder.open(self._POTENTIAL_FILENAME, "w") as handle: + # handle.write(self.inputs.potential.get_content()) + + with folder.open(self._POTENTIAL_FILENAME, 'wb') as handle1: + with self.inputs.potential.open(mode='rb') as handle2: + handle1.write(handle2.read()) # Write the input file content. This function will also check the # sanity of the passed parameters when comparing it to a schema @@ -374,6 +378,7 @@ def prepare_for_submission(self, folder): potential=self.inputs.potential, structure=self.inputs.structure, parameters=_parameters, + potential_filename=self._POTENTIAL_FILENAME, restart_filename=_restart_filename, trajectory_filename=_trajectory_filename, variables_filename=_variables_filename, diff --git a/aiida_lammps/data/lammps_potentials.json b/aiida_lammps/data/lammps_potentials.json index a8df82d7..a61feb8d 100644 --- a/aiida_lammps/data/lammps_potentials.json +++ b/aiida_lammps/data/lammps_potentials.json @@ -28,6 +28,8 @@ "wavepacket" ], "pair_style": { + "allegro":{"units": "metal", "atom_style": "atomic", "read_from_file": true}, + "nequip":{"units": "metal", "atom_style": "atomic", "read_from_file": true}, "adp":{"units": "unknown", "atom_style": "atomic", "read_from_file": true}, "agni":{"units": "unknown", "atom_style": "atomic", "read_from_file": true}, "airebo":{"units": "unknown", "atom_style": "atomic", "read_from_file": true}, From ffb555e62518cb86f11dec0773abb2871553bbb4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:47:14 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- aiida_lammps/calculations/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aiida_lammps/calculations/base.py b/aiida_lammps/calculations/base.py index 21795d8e..35f57cfa 100644 --- a/aiida_lammps/calculations/base.py +++ b/aiida_lammps/calculations/base.py @@ -367,9 +367,9 @@ def prepare_for_submission(self, folder): # Write the potential to the remote folder # with folder.open(self._POTENTIAL_FILENAME, "w") as handle: # handle.write(self.inputs.potential.get_content()) - - with folder.open(self._POTENTIAL_FILENAME, 'wb') as handle1: - with self.inputs.potential.open(mode='rb') as handle2: + + with folder.open(self._POTENTIAL_FILENAME, "wb") as handle1: + with self.inputs.potential.open(mode="rb") as handle2: handle1.write(handle2.read()) # Write the input file content. This function will also check the From e55a8e5d0354187a9ef56158d79df3b07ac4cb00 Mon Sep 17 00:00:00 2001 From: Lorenzo <79980269+bastonero@users.noreply.github.com> Date: Wed, 6 Nov 2024 01:04:03 +0100 Subject: [PATCH 3/5] Fix jsonschema version --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d10f684b..718df5a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,9 +23,9 @@ classifiers = [ keywords = ["aiida", "workflows", "lammps"] requires-python = ">=3.8" dependencies = [ - "aiida-core[atomic_tools]>=2.0.0,<3.0.0", + "aiida-core[atomic_tools]~=2.3", "importlib_resources", - "jsonschema", + "jsonschema~=3.2.0", "numpy", "packaging", "python-dateutil" From 0befdde2798c88040a307986a9492b1049b4bf9d Mon Sep 17 00:00:00 2001 From: bastonero Date: Tue, 28 Jan 2025 18:35:44 +0000 Subject: [PATCH 4/5] Add newton default to ML pair styles --- aiida_lammps/data/lammps_potentials.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiida_lammps/data/lammps_potentials.json b/aiida_lammps/data/lammps_potentials.json index a61feb8d..6edb6fa7 100644 --- a/aiida_lammps/data/lammps_potentials.json +++ b/aiida_lammps/data/lammps_potentials.json @@ -28,8 +28,8 @@ "wavepacket" ], "pair_style": { - "allegro":{"units": "metal", "atom_style": "atomic", "read_from_file": true}, - "nequip":{"units": "metal", "atom_style": "atomic", "read_from_file": true}, + "allegro":{"units": "metal", "newton":"on", "atom_style": "atomic", "read_from_file": true}, + "nequip":{"units": "metal", "newton":"off", "atom_style": "atomic", "read_from_file": true}, "adp":{"units": "unknown", "atom_style": "atomic", "read_from_file": true}, "agni":{"units": "unknown", "atom_style": "atomic", "read_from_file": true}, "airebo":{"units": "unknown", "atom_style": "atomic", "read_from_file": true}, From 46f7c74f9a3efd01f9f3039a8ab638c82bff610b Mon Sep 17 00:00:00 2001 From: bastonero Date: Tue, 28 Jan 2025 18:56:16 +0000 Subject: [PATCH 5/5] Add pair allegro variants --- aiida_lammps/data/lammps_potentials.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aiida_lammps/data/lammps_potentials.json b/aiida_lammps/data/lammps_potentials.json index 6edb6fa7..c2d98188 100644 --- a/aiida_lammps/data/lammps_potentials.json +++ b/aiida_lammps/data/lammps_potentials.json @@ -29,6 +29,10 @@ ], "pair_style": { "allegro":{"units": "metal", "newton":"on", "atom_style": "atomic", "read_from_file": true}, + "allegro3232":{"units": "metal", "newton":"on", "atom_style": "atomic", "read_from_file": true}, + "allegro3264":{"units": "metal", "newton":"on", "atom_style": "atomic", "read_from_file": true}, + "allegro6464":{"units": "metal", "newton":"on", "atom_style": "atomic", "read_from_file": true}, + "allegro6432":{"units": "metal", "newton":"on", "atom_style": "atomic", "read_from_file": true}, "nequip":{"units": "metal", "newton":"off", "atom_style": "atomic", "read_from_file": true}, "adp":{"units": "unknown", "atom_style": "atomic", "read_from_file": true}, "agni":{"units": "unknown", "atom_style": "atomic", "read_from_file": true},