Skip to content

Commit 598fa7b

Browse files
committed
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.
1 parent 6611b2a commit 598fa7b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

aiida_lammps/calculations/base.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class LammpsBaseCalculation(CalcJob):
4141
"parser_name": "lammps.base",
4242
}
4343

44-
_POTENTIAL_FILENAME = "potential.dat"
44+
_POTENTIAL_FILENAME = "potential.pth"
4545

4646
# In restarts, will not copy but use symlinks
4747
_default_symlink_usage = True
@@ -365,15 +365,20 @@ def prepare_for_submission(self, folder):
365365
handle.write(structure_filecontent)
366366

367367
# Write the potential to the remote folder
368-
with folder.open(self._POTENTIAL_FILENAME, "w") as handle:
369-
handle.write(self.inputs.potential.get_content())
368+
# with folder.open(self._POTENTIAL_FILENAME, "w") as handle:
369+
# handle.write(self.inputs.potential.get_content())
370+
371+
with folder.open(self._POTENTIAL_FILENAME, 'wb') as handle1:
372+
with self.inputs.potential.open(mode='rb') as handle2:
373+
handle1.write(handle2.read())
370374

371375
# Write the input file content. This function will also check the
372376
# sanity of the passed parameters when comparing it to a schema
373377
input_filecontent = generate_input_file(
374378
potential=self.inputs.potential,
375379
structure=self.inputs.structure,
376380
parameters=_parameters,
381+
potential_filename=self._POTENTIAL_FILENAME,
377382
restart_filename=_restart_filename,
378383
trajectory_filename=_trajectory_filename,
379384
variables_filename=_variables_filename,

aiida_lammps/data/lammps_potentials.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"wavepacket"
2929
],
3030
"pair_style": {
31+
"allegro":{"units": "metal", "atom_style": "atomic", "read_from_file": true},
32+
"nequip":{"units": "metal", "atom_style": "atomic", "read_from_file": true},
3133
"adp":{"units": "unknown", "atom_style": "atomic", "read_from_file": true},
3234
"agni":{"units": "unknown", "atom_style": "atomic", "read_from_file": true},
3335
"airebo":{"units": "unknown", "atom_style": "atomic", "read_from_file": true},

0 commit comments

Comments
 (0)