LAMMPS + Mace

I am trying to run LAMMPS with a MACE foundation model, but I get some errors.
First off, I cannot use torch, as the supercomputer has torch-2.8.0 and I need torch-2.5.0. Installing torch-2.5.0 in a python environment still results in an error as the torch-2.8.0 cannot be properly uninstalled. So I resorted to using mace-torch instead.

It runs the first steps without crashing, but the forces are orders of magnitude larger than they should be (compared to ASE). Also, when I print the elements everything is labeled “C” in the dump. How could I fix this?

Start of input file:

units metal
atom_style atomic

read_data data.water

pair_style mliap unified MACE-OFF24_medium.model-mliap_lammps.pt 0
pair_coeff * * H O

start of data file:

#Water box

384 atoms
2 atom types

0 15.6404 xlo xhi
0 15.6404 ylo yhi
0 15.6404 zlo zhi

Masses

1 1.0080
2 15.9994

Atoms

1 2 4.963362000000 8.433745000000 6.522726000000
2 2 8.071195000000 10.247451000000 13.276063000000
3 2 13.850862000000 12.652854000000 15.313528000000

Sorry, but since MACE is not part of LAMMPS, we cannot help you. You need to talk about this with the MACE developers.

Please see the documentation of the dump_modify command. By default LAMMPS does not know anything about the correlation between atom type (a number) and element (a string). Even when assigning elements in the pair style, this operation only maps the LAMMPS atom type to the entry in the potential and not the other way around. At least not yet. The closest you can get currently is to use type labels with the labelmap command.

But the MACE model is fine, it works with programs like I-PI or ASE, so the problem has to be the ML-IAP interface right? Or something in my input

But it is up to the MACE developers how they implement the interface to ML-IAP. The LAMMPS developers don’t know anything about it.

You have to understand the dynamics of Open Source software here. By making LAMMPS publicly available and under an Open Source license, people can implement whatever they want on top of it and distribute the modifications and additions as Open Source as well with a compatible license. However, that does not mean that the LAMMPS developers are included in any choices or developments. We may make incompatible changes or the external package developers may implement things in a way that require modifications to LAMMPS or specific ways to use their software. There can be changes to the LAMMPS internals between every release (except between stable releases and their updates). If an external package depends on some internal choice, it can be easily broken without knowing about it. The only places where the LAMMPS developers make an effort to retain backward compatibility are the file formats and the LAMMPS input file syntax as well as the documented library interfaces; and there we document incompatible changes in the manual. The use of machine learning potentials is an area of rapid development, so it is quite natural that there are frequent changes. The ML-IAP package does not have a properly published API and the python wrappers on top of it are highly experimental and not maintained by the core LAMMPS development team. If you look through the list of (still) open and closed pull requests on GitHub, you can see that there are regular changes.

Bottom line, it is not as simple as you seem to think.

Ah, okay. Thank you!
I’ll go bother them then